Aspose::Words::DigitalSignatures::DigitalSignature class

DigitalSignature class

Represents a digital signature on a document and the result of its verification. To learn more, visit the Work with Digital Signatures documentation article.

class DigitalSignature : public System::Object

Methods

MethodDescription
get_CertificateHolder() constReturns the certificate holder object that contains the certificate was used to sign the document.
get_Comments() constGets the signing purpose comment.
get_IssuerName()Returns the subject distinguished name of the certificate isuuer.
get_IsValid() constReturns true if this digital signature is valid and the document has not been tampered with.
get_SignatureType() constGets the type of the digital signature.
get_SignatureValue() constGets an array of bytes representing a signature value.
get_SignTime() constGets the time the document was signed.
get_SubjectName()Returns the subject distinguished name of the certificate that was used to sign the document.
GetType() const override
Is(const System::TypeInfo&) const override
ToString() const overrideReturns a user-friendly string that displays the value of this object.
static Type()

Examples

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

auto doc = MakeObject<Document>(MyDir + u"Digitally signed.docx");

for (const auto& signature : doc->get_DigitalSignatures())
{
    std::cout << (signature->get_IsValid() ? String(u"Valid") : String(u"Invalid")) << " signature: " << std::endl;
    std::cout << "\tReason:\t" << signature->get_Comments() << std::endl;
    std::cout << String::Format(u"\tType:\t{0}", signature->get_SignatureType()) << std::endl;
    std::cout << "\tSign time:\t" << signature->get_SignTime() << std::endl;
    std::cout << "\tSubject name:\t" << signature->get_CertificateHolder()->get_Certificate()->get_SubjectName() << std::endl;
    std::cout << "\tIssuer name:\t" << signature->get_CertificateHolder()->get_Certificate()->get_IssuerName()->get_Name() << std::endl;
    std::cout << std::endl;
}

See Also