Works for me. Make sure that the first signature was not certified and if it was that you have a signature field to sign in the second. You can't create new field when the doc is certified.
Paulo > -----Original Message----- > From: HidekiT [mailto:[email protected]] > Sent: Monday, December 29, 2008 8:46 AM > To: [email protected] > Subject: Re: [iText-questions] itext invalidates first > signature. Why ? > > > Hi Paulo, > > thanks for the info, but we append the 2nd signature as follows: > > PdfStamper stp = PdfStamper.createSignature(reader, fout, > '\0', null, true); > > Below the code we use. > > Can you maybe check the internal code of the PDF and see what > is wrong ? > Thank a lot for your feedback. > > We are really stuck with this ... > > KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); > ks.load(new FileInputStream("C:\\Data\\keystore\\test.keystore"), > "123456".toCharArray()); > String alias = ks.aliases().nextElement(); > PrivateKey key = (PrivateKey)ks.getKey(alias, "123456".toCharArray()); > Certificate[] chain = ks.getCertificateChain(alias); > PdfReader reader = new > PdfReader("C:\\samples\\mill\\output\\Example_minimal-v300.pdf"); > FileOutputStream fout = new > FileOutputStream("C:\\samples\\mill\\output\\Example_template- > minimal-signed-itext-v300.pdf"); > //PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0'); > PdfStamper stp = PdfStamper.createSignature(reader, fout, > '\0', null, true); > > PdfSignatureAppearance sap = stp.getSignatureAppearance(); > sap.setCrypto(key, chain, null, PdfSignatureAppearance.SELF_SIGNED); > sap.setReason("I'm the author"); > sap.setLocation("Lisbon"); > //sap.setCertificationLevel(PdfSignatureAppearance.CERTIFIED_N > O_CHANGES_ALLOWED); > // comment next line to have an invisible signature > sap.setVisibleSignature(new Rectangle(100, 100, 200, 200), 1, null); > stp.close(); > > Regards, > > HT. > > > Paulo Soares wrote: > > > > The second and later signatures must be done in append mode. > > > > Paulo > > > > ----- Original Message ----- > > From: "HidekiT" <[email protected]> > > To: <[email protected]> > > Sent: Sunday, December 28, 2008 11:46 AM > > Subject: [iText-questions] itext invalidates first signature. Why ? > > > > > > > > Hi, > > > > we get signed PDF documents made with 3rd party software we > need to add > > additional signature with iText. > > > > Problem is that the 1st signature gets invalid when 2nd is > added. The > > error > > is: > > > > Error during signature verification. > > Unexpected byte range values defining scope of signed data. > > Details: The signature byte range is invalid > > > > We don't understand why this happens ? When we open the > original document > > (with only 1st signature) no error is given so why is this > invalidated > > with > > iText when new signature is added ? > > > > I attach the file with the 2 signatures (only 10 kb) so if > someone can > > tell > > us what the problem is we might solve it. > > > > Any help much appreciated. 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.
------------------------------------------------------------------------------
_______________________________________________ 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
