Signature Integrity Checks

Check signature integrity

This article maps to the same verification workflow exposed by PdfFileSignatureExamples.java.

Steps

  1. Bind the signed PDF with PdfFileSignature.
  2. Select a signature name from the document.
  3. Call verifySignature to validate the signature contents.
  4. Call coversWholeDocument to confirm document-wide coverage.
  5. Close the facade object.

Java example

public static void verifyPdfSignature(Path inputFile) {
    PdfFileSignature pdfSignature = new PdfFileSignature();
    try {
        pdfSignature.bindPdf(inputFile.toString());
        SignatureName signatureName = pdfSignature.getSignatureNames().get_Item(0);
        System.out.println("Signature '" + signatureName + "' is valid: " + pdfSignature.verifySignature(signatureName));
        System.out.println("Signature covers whole document: " + pdfSignature.coversWholeDocument(signatureName));
    } finally {
        pdfSignature.close();
    }
}