I want to know how to detect if a PDF was invalidated after been signed. When I open a document with Acrobat Reader, I can see it , but i cant achive this programattically.
BouncyCastleProvider provider = new BouncyCastleProvider();
Security.addProvider(provider);
PdfReader reader;
reader = new PdfReader(bytes);
AcroFields af = reader.getAcroFields();
ArrayList<String> names = af.getSignatureNames();
for (int k = 0; k < names.size(); ++k) {
String name = (String)names.get(k);
PdfPKCS7 pk = af.verifySignature(name);
Calendar cal = pk.getSignDate();
Certificate pkc[] = pk.getCertificates();
List<VerificationException> fails = CertificateVerification.verifyCertificates(pkc, ks, null, cal);
boolean certificateVerified = (fails.isEmpty())?true:false;
boolean documentModified= !pk.verify();}
For each revision documentModified is false, but then the whole document was invalidated. How could I detect it? I want to get the same message as Acrobat Reader "The document has been altered or corrupted since the signature was apllied"