Some test text!

menu
Verify a documentkeyboard_arrow_down

Verify a signature on Linux

Try our experimental web demo for digital signature verification.

EXPERIMENTAL FEATURE. Digital signature verification is undergoing active development, but currently does not support a number of features. If we are missing a feature that is important to you, or if you have files that do not act as expected, please contact us using one of the following forms: https://www.pdftron.com/form/trial-support/ or https://www.pdftron.com/form/request/

To verify all cryptographic digital signatures in a document:

// Open an existing PDF
using (PDFDoc doc = new PDFDoc(in_docpath))
{
    // Choose a security level to use, and change any verification options you wish to change
    VerificationOptions opts = new VerificationOptions(VerificationOptions.SignatureVerificationSecurityLevel.e_compatibility_and_archiving);

    // Trust a binary DER X509 certificate
    byte[] trusted_cert_buf = File.ReadAllBytes(in_public_key_file_path);
    opts.AddTrustedCertificate(trusted_cert_buf);

    // Iterate over the signatures and verify all of them.
    DigitalSignatureFieldIterator digsig_fitr = doc.GetDigitalSignatureFieldIterator();
    for (; digsig_fitr.HasNext(); digsig_fitr.Next())
    {
        DigitalSignatureField curr = digsig_fitr.Current();
        VerificationResult result = curr.Verify(opts);
        if (result.GetVerificationStatus())
        {
            Console.Write("Signature verified");
        }
        else
        {
            Console.Write("Signature verification failed");
        }
    }
}

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

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

Webinar: Integrate PDF/MS Office viewing & editing into Salesforce Lightning

Learn More
close