/** * Checks if the signature covers the whole document * and throws an exception if the document was altered * @return a PdfPKCS7 object * @throws GeneralSecurityException */ virtual protected PdfPKCS7 CoversWholeDocument() { PdfPKCS7 pkcs7 = fields.VerifySignature(signatureName); if (fields.SignatureCoversWholeDocument(signatureName)) { LOGGER.Info("The timestamp covers whole document."); } else { throw new VerificationException(null, "Signature doesn't cover whole document."); } if (pkcs7.Verify()) { LOGGER.Info("The signed document has not been modified."); return(pkcs7); } throw new VerificationException(null, "The document was altered after the signature was applied."); }