GroupDocs.Signature provides the ability to search for digital electronic signatures in documents. Digital signatures provide a way to verify the authenticity and integrity of a document by using cryptographic techniques.
How to Search for Digital Signatures
The Signature class provides the search method which allows you to search for digital signatures in documents. Here’s how to use it:
Create a new instance of the Signature class and pass the source document path as a parameter.
Call the search method of the Signature class instance and pass a list with the search options to it.
Process the search results: the signatures property of the returned SearchResult holds the found DigitalSignature objects. Their is_valid property tells whether the signature still matches the document content.
Here’s an example of how to search for digital signatures in a document:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportDigitalSearchOptionsdefsearch_digital():withSignature("signed.pdf")assignature:result=signature.search([DigitalSearchOptions()])print(f"Found {len(result.signatures)} digital signature(s)")fordigitalinresult.signatures:print(f"Signed on {digital.sign_time} with the certificate of {digital.certificate.subject}")print(f"Valid: {digital.is_valid}")if__name__=="__main__":search_digital()
signed.pdf is the sample file used in this example. Click here to download it.
Found 1 digital signature(s)
Signed on 2026-10-05 08:08:35 with the certificate of E=moriarty@ex.ex, CN=ProfJamesMoriarty, O=ProfMoriarty, C=AS
Valid: True
You can narrow the search with the properties of DigitalSearchOptions: sign_date_time_from and sign_date_time_to set the signing time range, and comments returns only signatures whose comment is equal to the given text. This example searches a Word document:
fromdatetimeimportdatetimefromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportDigitalSearchOptionsdefsearch_digital_by_criteria():withSignature("signed.docx")assignature:options=DigitalSearchOptions()# Return only signatures made in 2026...options.sign_date_time_from=datetime(2026,1,1)options.sign_date_time_to=datetime(2026,12,31)# ...whose comment is equal to this textoptions.comments="Approved by John Smith"result=signature.search([options])print(f"Found {len(result.signatures)} matching digital signature(s)")fordigitalinresult.signatures:print(f"Signed on {digital.sign_time}, comment: '{digital.comments}', valid: {digital.is_valid}")if__name__=="__main__":search_digital_by_criteria()
signed.docx is the sample file used in this example. Click here to download it.
Found 1 matching digital signature(s)
Signed on 2026-10-05 08:21:06+00:00, comment: 'Approved by John Smith', valid: True
The search criteria are applied to Word Processing and Spreadsheet documents. For PDF documents, search returns every digital signature regardless of them. To check a PDF signature against a certificate, signer, signing time or reason, verify it with DigitalVerifyOptions as described in Verify Digital Signatures in Document.
More Resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: