Verify a signature on Server/Desktop

Try our web demo for digital signature verification.

We offer a higher-level document-based API for verifying signatures, as well as a lower-level per-signature API.

The simple document API has the following possible return values:

  1. PDFDoc.SignaturesVerificationStatus.e_unsigned: document has no signed signature fields.
  2. PDFDoc.SignaturesVerificationStatus.e_failure: hard failure in verification on at least one signature. This does not include trust issues, because those are flaky due to being network/config-related.
  3. PDFDoc.SignaturesVerificationStatus.e_untrusted: could not verify trust for at least one signature. This code can often be avoided by changing your VerificationOptions (add trusted certificates, enable a different revocation checking mode, etc.).
  4. PDFDoc.SignaturesVerificationStatus.e_unsupported: at least one signature contains features not supported in the current version of the SDK. Please contact us if these features are important to you.
  5. PDFDoc.SignaturesVerificationStatus.e_verified: all signed signatures in document verified. Unsigned signatures get skipped. Parts of the document may be unsigned by any signature.

For further verification-related information, the detailed API, which returns a VerificationResult and is demonstrated in the full code samples, can be used. For example, it is possible to call GetUnsupportedFeatures on VerificationResult to check which unsupported features were encountered (requires verification using 'detailed' APIs). It is also possible to retrieve a DigitalSignatureField object from the VerificationResult for further non-verification-related information. For example, if you would like to make sure that the document is entirely covered by signatures, or to look at a previous revision, the function GetByteRanges is available on DigitalSignatureField for this purpose.

To verify all cryptographic digital signatures in a document using the simple API:

1using (PDFDoc doc = new PDFDoc(in_docpath))
2{
3 // Choose a security level to use, and change any verification options you wish to change
4 VerificationOptions opts = new VerificationOptions(VerificationOptions.SignatureVerificationSecurityLevel.e_compatibility_and_archiving);
5
6 // Add trust root to store of trusted certificates contained in VerificationOptions.
7 opts.AddTrustedCertificate(in_public_key_file_path);
8
9 PDFDoc.SignaturesVerificationStatus result = doc.VerifySignedDigitalSignatures(opts);
10}

Digital signatures
Full code sample which demonstrates using the digital signature API to digitally sign, certify, and/or verify PDF documents.

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales