This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/signatures/digital-signatures/validate-pdf-signatures.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Validate PDF signatures in C# | Nutrient .NET SDK

Signature validation tells you whether a signed PDF is trustworthy: whether the signed content is unchanged since signing, and whether the signer’s certificate chains to a certificate you trust and wasn’t revoked when the document was signed. Nutrient .NET SDK validates each signature as defined by ETSI EN 319 102-1, the European standard for signature validation, and reports one of its three results: passed, failed, or indeterminate.

This guide shows how to:

  • Sign a sample PDF with a P12/PFX certificate
  • Validate the signatures of the PDF against a trusted root certificate
  • Read the validation results

For each signature, the validation checks that the signed bytes match the signature, builds the signer’s certificate chain to one of the certificates you trust, checks the revocation status of each certificate in the chain, and validates the signature timestamp, when the signature has one. It also validates document timestamps (PAdES B-LTA).

Download sample

Prepare the project

Register the SDK license before running signing operations. For setup details, refer to the getting started with .NET SDK guide.

using System;
using System.Collections.Generic;
using System.IO;
using GdPicture14;
void CheckStatus(GdPictureStatus status, string operation)
{
if (status != GdPictureStatus.OK)
{
throw new InvalidOperationException($"{operation} failed. Status: {status}");
}
}
LicenseManager license = new LicenseManager();
license.RegisterKEY(""); // Set your license key

Sign a sample PDF

The sample signs input.pdf first, so it has a signed document to validate. The sample certificate, certificate.pfx, is issued by the sample root certificate authority, root_ca_cert.pem. For more information on signing, refer to the PAdES B-LT and B-LTA signatures guide.

using (GdPicturePDF pdf = new GdPicturePDF())
{
CheckStatus(pdf.LoadFromFile(@"input.pdf", false), "LoadFromFile");
CheckStatus(pdf.SetSignatureCertificateFromP12(@"certificate.pfx", "Nutrient answers all your document needs"), "SetSignatureCertificateFromP12");
CheckStatus(pdf.SetSignatureInfo("Legal Department", "Contract approval", "Toulouse", "sales@nutrient.io"), "SetSignatureInfo");
CheckStatus(pdf.ApplySignature(@"signed.pdf", PdfSignatureMode.PdfSignatureModeAdobeCADES, true), "ApplySignature");
}

Configure the validation

A signature passes validation only when the signer’s certificate chains to a certificate you trust. No certificate is trusted by default. Add the root certificates of the certification authorities you accept with AddTrustedCertificate, which takes a DER-encoded certificate, a PKCS#7 certificate bundle, or PEM text with one or more certificates:

PdfSignatureValidationOptions options = new PdfSignatureValidationOptions();
CheckStatus(options.AddTrustedCertificate(File.ReadAllBytes(@"root_ca_cert.pem")), "AddTrustedCertificate");
// The sample certificate authority publishes no revocation data.
options.RevocationMode = PdfSignatureRevocationMode.None;

The RevocationMode property sets where the revocation status of the certificates comes from:

  • EmbeddedOnly — Only the certificate revocation lists (CRLs) and Online Certificate Status Protocol (OCSP) responses the document embeds. No network access. This is the default.
  • OnlineIfMissing — The embedded data first, then the certificate’s OCSP responder or CRL distribution points for each certificate the embedded data doesn’t cover.
  • AlwaysOnline — The certificate’s OCSP responder or CRL distribution points for every certificate, together with the embedded data.
  • None — Revocation isn’t checked.

The sample uses None because its certificate authority publishes no revocation data: with any other mode, its signature is reported as Indeterminate with CertificateChainGeneralFailure. For certificates from a public certification authority, keep the default for documents signed at PAdES B-LT or higher, which embed their revocation data. Use OnlineIfMissing for other documents.

The options also include the following settings:

  • ValidationTime — The time to validate the signatures at. The default is null, which validates at the current time.
  • NetworkTimeout — The time one network request takes at most, in milliseconds. The default is 30000.
  • AddIntermediateCertificate — Adds certificates that complete a chain between the signer and a trusted certificate when neither the document nor the signature includes them.

Validate the signatures

Load the signed document and validate each of its signatures with ValidateSignature. The signature index ranges from 0 to GetSignatureCount minus 1. The sample prints each result and writes a short report:

using GdPicturePDF signedPdf = new GdPicturePDF();
CheckStatus(signedPdf.LoadFromFile(@"signed.pdf", false), "LoadFromFile");
int signatureCount = signedPdf.GetSignatureCount();
CheckStatus(signedPdf.GetStat(), "GetSignatureCount");
List<string> report = new List<string>();
for (int index = 0; index < signatureCount; index++)
{
GdPictureStatus status = signedPdf.ValidateSignature(index, options, out PdfSignatureValidationResult result);
if (status == GdPictureStatus.PdfInvalidContent)
{
// A signature field that isn't signed.
continue;
}
CheckStatus(status, "ValidateSignature");
string line = $"{result.FieldName}: {result.Indication} {result.SubIndication}";
Console.WriteLine(line);
Console.WriteLine($" Unchanged since signing: {result.IsIntegrityValid}");
Console.WriteLine($" Certificate chain: {result.CertificateChain.Length} certificates");
if (result.Indication != PdfSignatureValidationIndication.TotalPassed)
{
Console.WriteLine($" Reason: {result.Message}");
}
report.Add(line);
}
File.WriteAllLines(@"validation-report.txt", report);

The sample signature chains to the trusted root, so the sample prints TotalPassed None. ValidateSignature returns GdPictureStatus.OK when the validation ran, whatever its result: read the result’s Indication to know whether the signature is valid.

Each result has the following properties:

  • FieldName — The name of the signature field.
  • Indication and SubIndication — The result of the validation, and the reason when it didn’t pass.
  • Message — A description of the problem found. Empty when the validation passed.
  • IsIntegrityValid — Whether the signed bytes match the signature.
  • CoversWholeDocument — Whether the signature covers the whole document. It’s false when content was added after signing, for example a later signature or the validation data of a PAdES B-LT signature.
  • SignerCertificate — The DER-encoded certificate of the signer.
  • CertificateChain — The signer’s certificate, its issuers, and the trusted certificate, each with its Certificate, IsTrustAnchor, RevocationStatus, RevocationSource, and RevocationTime.
  • Timestamp — The validation of the signature timestamp, or null when the signature has no timestamp.
  • BestSignatureTime — The earliest time, in UTC, the signature is proven to exist: the time of a valid signature timestamp, otherwise the validation time.
  • IsDocumentTimestamp — Whether the result is for a document timestamp rather than a signature.

To get the signer’s certificate without validating the signature, use GetSignatureCertificate.

Read the results

The Indication property reports one of three results:

IndicationMeaning
TotalPassedThe signature is intact, and the signer’s certificate chains to a trusted certificate and wasn’t revoked at the time the signature is proven to exist.
TotalFailedThe signature is invalid. For example, HashFailure means the document changed after signing.
IndeterminateThe available data doesn’t establish whether the signature is valid. The sub-indication tells you what’s missing.

The most common sub-indications for an Indeterminate result are:

  • NoCertificateChainFound — No chain leads from the signer’s certificate to a trusted certificate. Add the root certificate of the signer’s certification authority.
  • CertificateChainGeneralFailure — No usable revocation data covers a certificate of the chain. Use OnlineIfMissing, or ask the signer for a PAdES B-LT signature.
  • OutOfBoundsNoPoe — The signer’s certificate expired, and no signature timestamp proves the signature existed before then.
  • RevokedNoPoe — The signer’s certificate was revoked, and no signature timestamp proves the signature existed before the revocation.

Error handling

Check every GdPictureStatus value. ValidateSignature returns GdPictureStatus.PdfInvalidContent for a signature field that isn’t signed, and AddTrustedCertificate returns GdPictureStatus.CertificateWrongFormat when the data holds no certificate.

Limitations

  • Only the certificates you add are trusted. The system certificate store and the European Union Trusted List (EUTL) aren’t used.
  • A document timestamp is validated, but it isn’t used as proof that the signatures it covers existed before it.
  • The validation reads the bytes the document was loaded from. Changes made to the loaded document aren’t validated.

Conclusion

This workflow validates the signatures of a PDF against the certificates you trust. Accept a signature only when its indication is TotalPassed, and use the sub-indication and message to diagnose the others. To make signatures that stay verifiable after the signer’s certificate expires, refer to the add LTV information to PDF signatures guide.