Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

Re: [iText-questions] Problem while digitally sighning pdf using
IText.

Jaya Pasachhe

2007-07-16

Replies:

Thanks for your prompt reply. I created self signed digital id in two differnent ways First by using command line keytool -genkey -keyalg RSA -alias jaya -keypass matrix -keystore keystore.ks when i use this key i got following exception java.io.IOException: DerInputStream.getLength(): lengthTag=109, too big. it also fails sighing in acrobat professional. Second by using tool given by acrobat professional. when i use this key following key Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/asn1/DEREncodable i have downloaded latest version of itext from svn and compiled it. Here is the code that i used to sign the PDF. ks = KeyStore.getInstance("pkcs12"); ks.load(new FileInputStream("jaya.pfx"), "matrix321".toCharArray()); String alias = (String) ks.aliases().nextElement(); PrivateKey key = (PrivateKey) ks.getKey(alias, "matrix321".toCharArray()); Certificate[] chain = ks.getCertificateChain(alias); PdfReader reader = new PdfReader("signature.pdf"); FileOutputStream fout = new FileOutputStream("signed.pdf"); PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0'); PdfSignatureAppearance sap = stp.getSignatureAppearance(); sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED); sap.setReason("I'm the author"); sap.setLocation("Kathmandu"); // comment next line to have an invisible signature sap.setVisibleSignature(new Rectangle(100, 100, 200, 200), 1, null); stp.close(); Please help me. where did i make mistake?? Regards Jaya N Pasachhe
Paulo Soares wrote:
You'll be stuck forever if you don't provide more details. Where did you get the signature file from? Does it also fail if signing in Acrobat? What iText version are you using? What particular code are you using from http://itextpdf.sourceforge.net/howtosign.html? Paulo > -----Original Message----- > From: itext-questions-bounces@lists.sourceforge.net > [mailto:itext-questions-bounces@lists.sourceforge.net] On > Behalf Of linkjaya > Sent: Monday, July 16, 2007 9:58 AM > To: itext-questions@lists.sourceforge.net > Subject: [iText-questions] Problem while digitally sighning > pdf using IText. > > Hello all, I want to add a digital signature in pdf file > containing singature field using Itext. i did as given in > http://itextpdf.sourceforge.net/howtosign.html. but i always > get following exception while loading the signature file. > java.io.IOException: DerInputStream.getLength(): > lengthTag=109, too big. can some one know, where is my > problem? I am stuck over here. Any help will be appreciated. > Regards Jaya N Pasachhe. Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/


View this message in context: Re: Problem while digitally sighning pdf using IText.
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.