Hey Andreas, about the ASN1 byte wrapper, i think im not using it when i use: PdfSignature dic1 = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED); dic1.setDate(new PdfDate(appearance.getSignDate())); dic1.setName(PdfPKCS7.getSubjectFields((X509Certificate)appearance.getCertChain()[0]).getField("CN")); dic1.setReason(appearance.getReason()); dic1.setLocation(appearance.getLocation()); dic1.setContact(appearance.getContact()); appearance.setCryptoDictionary(dic1); int csize = 128; HashMap<PdfName, Integer> exc = new HashMap<PdfName, Integer>(); exc.put(PdfName.CONTENTS, new Integer(csize * 2 + 2)); appearance.preClose(exc); when i use this approach i dont use sig.getEncodedPKCS1() that returns the 131 byte array. In this case i just use: dic.put(PdfName.CONTENTS, new PdfString(signedHash).setHexWriting(true)); and the signedHash is the digest signed with the smartcard (which is a 128 byte array)
as for the DigestInfo structure, i dont really understand what you mean, im new to all of this. Is the problem the digest i generate from the file's inputStream or the the method i use to sign that digest? I dont think i have an alternative to sign it since the smartcard uses pkcs11 and i believe i need the wrapper im currently using (though i might be wrong of course). A few things i forgot to mention that might matter is that im using the latest version of itext(5.0.4) and another thing is that when i used that detached mode i couldnt see the algorithm used and certificates in the pdf that was created after being signed. Regards, Pedro -- View this message in context: http://itext-general.2136553.n4.nabble.com/Another-invalid-signature-thread-tp3003710p3013603.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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