DocumentDigitalSignatures Property
Gets the collection of digital signatures for this document and their validation results.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.6
Syntax
public DigitalSignatureCollection DigitalSignatures { get; }

Property Value

Type: DigitalSignatureCollection
Remarks

This collection contains digital signatures that were loaded from the original document. These digital signatures will not be saved when you save this Document object into a file or stream because saving or converting will produce a document that is different from the original and the original digital signatures will no longer be valid.

This collection is never null. If the document is not signed, it will contain zero elements.

Examples
Shows how to validate all signatures in a document.
[C#]

// Load the signed document.
Document doc = new Document(MyDir + "Document.DigitalSignature.docx");
DigitalSignatureCollection digitalSignatureCollection = doc.DigitalSignatures;

if (digitalSignatureCollection.IsValid)
{
    Console.WriteLine("Signatures belonging to this document are valid");
    Console.WriteLine(digitalSignatureCollection.Count);
    Console.WriteLine(digitalSignatureCollection[0].SignatureType);
}
else
{
    Console.WriteLine("Signatures belonging to this document are NOT valid");
}
Examples
Shows how to validate each signature in a document and display basic information about the signature.
[C#]

// Load the document which contains signature.
Document doc = new Document(MyDir + "Document.DigitalSignature.docx");

foreach (DigitalSignature signature in doc.DigitalSignatures)
{
    Console.WriteLine("*** Signature Found ***");
    Console.WriteLine("Is valid: " + signature.IsValid);
    Console.WriteLine("Reason for signing: " +
                      signature.Comments); // This property is available in MS Word documents only.
    Console.WriteLine("Signature type: " + signature.SignatureType);
    Console.WriteLine("Time of signing: " + signature.SignTime);
    Console.WriteLine("Subject name: " + signature.CertificateHolder.Certificate.SubjectName);
    Console.WriteLine("Issuer name: " + signature.CertificateHolder.Certificate.IssuerName.Name);
    Console.WriteLine();
}
See Also