Search for Digital e-Signatures

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:

  1. Create a new instance of the Signature class and pass the source document path as a parameter.
  2. Create an instance of DigitalSearchOptions class.
  3. Call the search method of the Signature class instance and pass a list with the search options to it.
  4. 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:

from groupdocs.signature import Signature
from groupdocs.signature.options import DigitalSearchOptions


def search_digital():
    with Signature("signed.pdf") as signature:
        result = signature.search([DigitalSearchOptions()])

        print(f"Found {len(result.signatures)} digital signature(s)")
        for digital in result.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

Download full output

Advanced Search Options

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:

from datetime import datetime

from groupdocs.signature import Signature
from groupdocs.signature.options import DigitalSearchOptions


def search_digital_by_criteria():
    with Signature("signed.docx") as signature:
        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 text
        options.comments = "Approved by John Smith"

        result = signature.search([options])

        print(f"Found {len(result.signatures)} matching digital signature(s)")
        for digital in result.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

Download full output

Note
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:

Free Online Apps

Along with the full-featured Python library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.