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.
Properties
Name | Description |
---|---|
certificate_holder | Returns the certificate holder object that contains the certificate was used to sign the document. |
comments | Gets the signing purpose comment. |
is_valid | Returns True if this digital signature is valid and the document has not been tampered with. |
issuer_name | Returns the subject distinguished name of the certificate isuuer. |
sign_time | Gets the time the document was signed. |
signature_type | Gets the type of the digital signature. |
signature_value | Gets an array of bytes representing a signature value. |
subject_name | Returns the subject distinguished name of the certificate that was used to sign the document. |
Examples
Shows how to validate and display information about each signature in a document.
doc = aw.Document(MY_DIR + 'Digitally signed.docx')
for signature in doc.digital_signatures:
print(f"\n{('Valid' if signature.is_valid else 'Invalid')} signature: ")
print(f'\tReason:\t{signature.comments}')
print(f'\tType:\t{signature.signature_type}')
print(f'\tSign time:\t{signature.sign_time}')
# System.Security.Cryptography.X509Certificates.X509Certificate2 is not supported. That is why the following information is not accesible.
#print(f"\tSubject name:\t{signature.certificate_holder.certificate.subject_name}")
#print(f"\tIssuer name:\t{signature.certificate_holder.certificate.issuer_name.name}")
print()