P3d3r0s0, P3d3r0s0 wrote: > I found out where the 131 bytes come from, apparently its from the > sig.getEncodedPKCS1() array. > This array is the same as the signedHash array (128 bytes) but with 3 > extra bytes ({4}{-127}{-128}), these bytes never change. > Is this normal behaviour?
This byte[] contains a BER-encoded ASN.1 OCTET STRING; 4 indicates that this is an OCTET STRING, the next bytes containing the length in long form format: 0x81 indicates that one length byte follows, 0x80 (=128) being that very length byte. It actually is the DER-encoded variant. The iText method PdfPKCS7.setExternalDigest() expects the naked encrypted data, though. Thus, you have to unpack that ASN.1 BER-encoded OCTET STRING which in your case amounts to removing those three inital bytes. Regards, Michael. -- View this message in context: http://itext-general.2136553.n4.nabble.com/Another-invalid-signature-thread-tp3003710p3007396.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