DigitalSignatureCollection Class
Provides a read-only collection of digital signatures attached to a document.
Inheritance Hierarchy
SystemObject
  Aspose.WordsDigitalSignatureCollection

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public class DigitalSignatureCollection : IEnumerable<DigitalSignature>, 
	IEnumerable

The DigitalSignatureCollection type exposes the following members.

Constructors
  NameDescription
Public methodDigitalSignatureCollection
Initializes a new instance of the DigitalSignatureCollection class
Properties
  NameDescription
Public propertyCode exampleCount
Gets the number of elements contained in the collection.
Public propertyCode exampleIsValid
Returns true if all digital signatures in this collection are valid and the document has not been tampered with Also returns true if there are no digital signatures. Returns false if at least one digital signature is invalid.
Public propertyCode exampleItem
Gets a document signature at the specified index.
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodCode exampleGetEnumerator
Returns a dictionary enumerator object that can be used to iterate over all items in the collection.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Remarks
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