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 = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Digitally signed.docx");

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

See Also