Hi,

mkl wrote:
> 
> In that case it would be helpful if you posted the code and an example PDF
> signed by that code.
> 

Here you go...

Keystore and unsigned PDF:

http://old.nabble.com/file/p26889586/itext-keystore.jks itext-keystore.jks 
(password: password)

http://old.nabble.com/file/p26889586/itext-unsigned.pdf itext-unsigned.pdf 


Code using an external digest and signing the content directly and resulting
PDF:

http://old.nabble.com/file/p26889586/SignContent.java SignContent.java 

http://old.nabble.com/file/p26889586/itext-signed-content.pdf
itext-signed-content.pdf 


Code using an external digest and signing the (SHA1) hashed content and
resulting PDF:

http://old.nabble.com/file/p26889586/SignHashedContent.java
SignHashedContent.java 

http://old.nabble.com/file/p26889586/itext-signed-hash.pdf
itext-signed-hash.pdf 


The SignHashedContent.java should pretty much do the same as the example in
appendix D of "iText in Action" but without smart card, of course. There is
one difference: In line 59 I provide the used hash to the setExternalDigest
method of the signature:

sig.setExternalDigest(sign.sign(), hash, key.getAlgorithm());


In the book's example null is passed instead of hash, but for the non
working validation of the signature this does not matter...


Hope this helps,

Daniel.

-- 
View this message in context: 
http://old.nabble.com/How-to-sign-examples-tp26886381p26889586.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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