Signature Integrity Checks
Contents
[
Hide
]
Check signature integrity
This article maps to the same verification workflow exposed by PdfFileSignatureExamples.java.
Steps
- Bind the signed PDF with
PdfFileSignature. - Select a signature name from the document.
- Call
verifySignatureto validate the signature contents. - Call
coversWholeDocumentto confirm document-wide coverage. - 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();
}
}