Hello again,

I did the detached method now, learned a few things on what works a little
better but still gives an error (Error encountered while BER decoding:)... 
sample:
http://www.filefactory.com/file/b3hcd3b/n/signed_pdf

Key code samples that i believe might be the reason for the errors:
PdfSignatureAppearance appearance = stamp.getSignatureAppearance();
...
appearance.setCrypto(null, CcMethods.getChain(), null,
PdfSignatureAppearance.SELF_SIGNED);
...
PdfSignature dic1 = new PdfSignature(PdfName.ADOBE_PPKLITE,
PdfName.ADBE_PKCS7_DETACHED);
...
// i believe this reserves 128 bytes for the signedHash byte array
int csize = 128;
HashMap<PdfName, Integer> exc = new HashMap<PdfName, Integer>();
exc.put(PdfName.CONTENTS, new Integer(csize * 2 + 2));
appearance.preClose(exc);
...
// regurns the signedHash (verified)
byte[] signedHash = CcMethods.sign(hashDig);
PdfDictionary dic = new PdfDictionary();
dic.put(PdfName.CONTENTS, new PdfString(signedHash).setHexWriting(true));
appearance.close(dic);


i didnt things here like setting the name and date on the signature thats
why i have all the "...".
i believe im following the howtosign to the letter, but i still have errors. 
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Another-invalid-signature-thread-tp3003710p3010293.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

Reply via email to