Hi all,
i was trying to sing a pdf in three different steps (teorically in 3  
different machines).
1. read pdf and calculate hash
2. get hash and sign it (using a smartcard)
3. get sign and apply to pdf
First question : is it possible?
I wrote (as found in many places) this code (only to start) :

PdfStamper stamper = PdfStamper.createSignature(reader, fout, '\0');
PdfSignatureAppearance sap = stamper.getSignatureAppearance();
sap.setCrypto(null, certs, null, PdfSignatureAppearance.SELF_SIGNED);
sap.setReason("bla bla bla");
sap.setLocation("anywhere");
sap.setExternalDigest(new byte[128], new byte[20], "RSA");
sap.preClose();
PdfPKCS7 sig = sap.getSigStandard().getSigner();
byte[] content = streamToByteArray(sap.getRangeStream());
byte[] hash = MessageDigest.getInstance("SHA-1").digest(content);

Printing the generated hash (for the same pdf), i read always  
different values, how is it possible?
If the hash of a pdf is always different, how is it possible to verify  
the sign?

I'm sure i done something wrong, but waht?


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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/

Reply via email to