Hi, I have a problem with C5_06_ValidateLTV class. I followed all recommendations about Pades LTV files, but when I verify, this error appear:
"The document can't be verified certificate does not verify with supplied key" I have been working with itextpdf-5.5.0 Adobe Reader says that all signatures are LTV Enable, but I can't pass LtvVerifier. I attach a sample file: https://www.dropbox.com/s/3jns5twd0vbngcy/Test1.pdf attached this example: public static void main(String[] args) throws IOException, GeneralSecurityException { BouncyCastleProvider provider = new BouncyCastleProvider(); Security.addProvider(provider); C5_06_ValidateLTV app = new C5_06_ValidateLTV(); System.out.println(EXAMPLE1); app.validate(new PdfReader(EXAMPLE1)); System.out.println(); } public void validate(PdfReader reader) throws IOException, GeneralSecurityException { KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(null, null); CertificateFactory cf = CertificateFactory.getInstance("X.509"); ks.setCertificateEntry((cf.generateCertificate(new FileInputStream(ROOT))).toString(), cf.generateCertificate(new FileInputStream(ROOT))); CertificateVerifier custom = new CertificateVerifier(null) { public List<VerificationOK> verify(X509Certificate signCert, X509Certificate issuerCert, Date signDate) throws GeneralSecurityException, IOException { System.out.println(signCert.getSubjectDN().getName() + ": ALL VERIFICATIONS DONE"); return new ArrayList<VerificationOK>(); } }; LtvVerifier data = new LtvVerifier(reader); data.setRootStore(ks); data.setCertificateOption(CertificateOption.WHOLE_CHAIN); data.setVerifier(custom); data.setOnlineCheckingAllowed(false); data.setVerifyRootCertificate(false); List<VerificationOK> list = data.verifySignature(); try { data.verify(list); } catch(GeneralSecurityException e) { System.err.println(e.getMessage()); } System.out.println(); if (list.size() == 0) { System.out.println("The document can't be verified"); } for (VerificationOK v : list) System.out.println(v.toString()); } Where ROOT variable is a string with the path where the root certificate of the certificate chain is. It is a file with extension ".crt" and EXAMPLE1 variable is a string with the path where pdf signed is. Thanks to all! -- View this message in context: http://itext-general.2136553.n4.nabble.com/C5-06-ValidateLTV-error-tp4659963p4659977.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php