This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/java/editor/validate-pdf-signatures.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Validate PDF signatures | Nutrient Java 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 Java 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 validate the signatures of a PDF against a trusted root certificate and how to read the results.

Common use cases include:

  • Checking signed contracts and invoices before processing them
  • Rejecting documents that changed after they were signed
  • Accepting only signatures from certification authorities your organization trusts
Download sample

How Nutrient helps

Nutrient Java SDK validates every signature of a document with one method call. For each signature, the SDK:

  • 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, from the certificate revocation lists (CRLs) and Online Certificate Status Protocol (OCSP) responses the document embeds, or from the network
  • Validates the signature timestamp, when the signature has one
  • Validates document timestamps (PAdES B-LTA)

Preparing the project

Import Nutrient Java SDK and create the sample class:

package io.nutrient.Sample;
import io.nutrient.sdk.*;
import io.nutrient.sdk.enums.*;
import io.nutrient.sdk.signing.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class ValidatePdfSignatures {

Create the main method as the sample entry point:

public static void main(String[] args) {

Signing 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 baseline levels guide:

try (Signature signer = new Signature()) {
try (Document document = Document.open("input.pdf")) {
DigitalSignatureOptions options = new DigitalSignatureOptions();
options.setCertificatePath("certificate.pfx");
options.setCertificatePassword("Nutrient answers all your document needs");
options.setSignerName("Legal Department");
options.setReason("Contract approval");
signer.sign(document, "signed.pdf", options);
}

Configuring 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 the certificate as a byte[]: a DER-encoded certificate, a PKCS#7 certificate bundle, or PEM text with one or more certificates:

SignatureValidationOptions validationOptions = new SignatureValidationOptions();
validationOptions.addTrustedCertificate(Files.readAllBytes(Paths.get("root_ca_cert.pem")));
// The sample certificate authority publishes no revocation data.
validationOptions.setRevocationMode(SignatureRevocationMode.None);

The setRevocationMode() method sets where the revocation status of the certificates comes from:

  • EmbeddedOnly — Only the CRLs and 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:

  • setValidationTime() — The time to validate the signatures at, as an ISO 8601 string such as "2026-01-31T12:00:00Z". The default is the current time.
  • setNetworkTimeout() — 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.

Validating the signatures

Open the signed document and pass it to validate, which returns one result per signed signature field. The sample prints each result and writes a short report:

List<String> report = new ArrayList<>();
try (Document signedDocument = Document.open("signed.pdf")) {
for (SignatureValidationResult result : signer.validate(signedDocument, validationOptions)) {
String line = result.getFieldName() + ": " + result.getIndication() + " " + result.getSubIndication();
System.out.println(line);
System.out.println(" Unchanged since signing: " + result.getIsIntegrityValid());
System.out.println(" Certificate chain: " + result.getCertificateChain().length + " certificates");
System.out.println(" Signer certificate: " + result.getSignerCertificate().length + " bytes");
if (result.getIndication() != SignatureValidationIndication.TotalPassed) {
System.out.println(" Reason: " + result.getMessage());
}
report.add(line);
}
}
Files.write(Paths.get("validation-report.txt"), report);
} catch (Exception e) {
System.err.println("Error validating signatures: " + e.getMessage());
}
}
}

The sample signature chains to the trusted root, so the sample prints TotalPassed None.

Each result has the following getters:

  • getFieldName() — The name of the signature field.
  • getIndication() and getSubIndication() — The result of the validation, and the reason when it didn’t pass.
  • getMessage() — A description of the problem found. Empty when the validation passed.
  • getIsIntegrityValid() — Whether the signed bytes match the signature.
  • getCoversWholeDocument() — 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.
  • getSignerCertificate() — The DER-encoded certificate of the signer.
  • getCertificateChain() — The signer’s certificate, its issuers, and the trusted certificate, each with its certificate, whether it’s a trust anchor, its revocation status and source, and its revocation time.
  • getTimestamp() — The validation of the signature timestamp, or null when the signature has no timestamp.
  • getBestSignatureTime() — The earliest time the signature is proven to exist, as an ISO 8601 string in UTC: the time of a valid signature timestamp, otherwise the validation time.
  • getIsDocumentTimestamp() — Whether the result is for a document timestamp rather than a signature.

Reading the results

getIndication() 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

validate reports an invalid signature in its result, not as an exception. It throws an exception when the validation fails to run — for example, when the document isn’t a PDF or when an option is invalid. addTrustedCertificate throws an InvalidArgumentException 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 opened from. Edits made to the document in memory aren’t validated.

Conclusion

Use this workflow to validate the signatures of a PDF:

  1. Create SignatureValidationOptions and add the root certificates you trust with addTrustedCertificate().
  2. Set the revocation mode to match where the revocation data of your documents comes from.
  3. Open the document using try-with-resources and call validate() on a Signature instance.
  4. Accept a signature only when its indication is TotalPassed, and use the sub-indication and message to diagnose the others.

For related signing workflows, refer to the Java SDK guides.