DigitalSignature

DigitalSignature class

Represents a digital signature on a document and the result of its verification.

public class DigitalSignature

Properties

Name Description
CertificateHolder { get; } Returns the certificate holder object that contains the certificate was used to sign the document.
Comments { get; } Gets the signing purpose comment.
IssuerName { get; } Returns the subject distinguished name of the certificate isuuer.
IsValid { get; } Returns true if this digital signature is valid and the document has not been tampered with.
SignatureType { get; } Gets the type of the digital signature.
SignTime { get; } Gets the time the document was signed.
SubjectName { get; } Returns the subject distinguished name of the certificate that was used to sign the document.

Methods

Name Description
override ToString() Returns a user-friendly string that displays the value of this object.

Examples

Shows how to validate and display information about each signature in a document.

Document doc = new Document(MyDir + "Digitally signed.docx");

foreach (DigitalSignature signature in doc.DigitalSignatures)
{
    Console.WriteLine($"{(signature.IsValid ? "Valid" : "Invalid")} signature: ");
    Console.WriteLine($"\tReason:\t{signature.Comments}"); 
    Console.WriteLine($"\tType:\t{signature.SignatureType}");
    Console.WriteLine($"\tSign time:\t{signature.SignTime}");
    Console.WriteLine($"\tSubject name:\t{signature.CertificateHolder.Certificate.SubjectName}");
    Console.WriteLine($"\tIssuer name:\t{signature.CertificateHolder.Certificate.IssuerName.Name}");
    Console.WriteLine();
}

See Also