Hello, I have signed a PDF document with an external signature:
Sign Parameters: - SHA256withRSA - 2048 Bit key - Self Signed Mode If i verify the PDF with Acrobat it says: "valid signature". But itext says "invalid signature"; If i switch the hash alogo to SHA1withRSA and sign the document, Acrobat and also itext says signature is valid. Other hash Algos like MD5withRSA, SHA384withRSA, ... also fails with itext. Verification code: http://www.nabble.com/file/p25379604/signed.pdf signed.pdf Here is the verification source: try { String pkcs12Key = "C:\\myCert2048.p12"; String fileKeyPassword = "my_password" ; Security.addProvider(new BouncyCastleProvider()); KeyStore ks = KeyStore.getInstance("pkcs12", "BC"); ks.load(new FileInputStream(pkcs12Key), fileKeyPassword.toCharArray()); String alias = (String)ks.aliases().nextElement(); X509Certificate cert = (X509Certificate) ks.getCertificate(alias); Certificate[] chain = ks.getCertificateChain(alias); PdfReader pdfReader = new PdfReader("c:\\signed.pdf"); AcroFields acroFields = pdfReader.getAcroFields(); ArrayList<String> signatureNames = acroFields.getSignatureNames(); String signatureFieldName; for (Iterator<String> it = signatureNames.iterator(); it.hasNext();) { signatureFieldName = (String) it.next(); PdfPKCS7 pkcs7 = acroFields.verifySignature(signatureFieldName, "BC"); pkcs7.verify(); // returns false, although acrobat says valid! } } catch (Exception ex) { ex.printStackTrace(); } -- View this message in context: http://www.nabble.com/Signature-verification%3A-Acrobat-says-valid%2C-itext-says-invalid-tp25379604p25379604.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
