Creating the same PDFSignatureAppearance twice....

View: New views
3 Messages — Rating Filter:   Alert me  

Creating the same PDFSignatureAppearance twice....

by Javadoc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I am in a situation where I need to create the PDFSignatureAppearance for a PDF I am signing twice. This is because I am having to read the actual PDF file twice. I need the signature to have the same getRangeStream somehow. The only thing I can see that would be difference when creating the signature twice would be the date name field signDate (signDate = new GregorianCalendar(); in constructor). I have seen that there is a setSignDate method in the PDFsignatureAppearance class and have tested to see if two PDF signatures would be equal when created with the same set date. This did not work, the range stream was still off, even though it was the same PDF file.

Any ideas on mimicking PDF signatures would be great.

Thanks,
Jared

Re: Creating the same PDFSignatureAppearance twice....

by Leonard Rosenthol-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can't sign the same byte range more than once in a PDF.  The concept of "parallel signatures" is not supported.  Instead, PDF uses a "serial signature" model instead.

Leonard

-----Original Message-----
From: Javadoc [mailto:tacobelljared@...]
Sent: Monday, October 26, 2009 8:16 PM
To: itext-questions@...
Subject: [iText-questions] Creating the same PDFSignatureAppearance twice....


Hello all,

I am in a situation where I need to create the PDFSignatureAppearance for a
PDF I am signing twice. This is because I am having to read the actual PDF
file twice. I need the signature to have the same getRangeStream somehow.
The only thing I can see that would be difference when creating the
signature twice would be the date name field signDate (signDate = new
GregorianCalendar(); in constructor). I have seen that there is a
setSignDate method in the PDFsignatureAppearance class and have tested to
see if two PDF signatures would be equal when created with the same set
date. This did not work, the range stream was still off, even though it was
the same PDF file.

Any ideas on mimicking PDF signatures would be great.

Thanks,
Jared

--
View this message in context: http://www.nabble.com/Creating-the-same-PDFSignatureAppearance-twice....-tp26070126p26070126.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@...
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/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@...
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/

Re: Creating the same PDFSignatureAppearance twice....

by mkl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Javadoc wrote:
I am in a situation where I need to create the PDFSignatureAppearance for a PDF I am signing twice.
Your problem has been discussed here quite often, e.g. in

http://www.nabble.com/Pdf-signature-Issues-to23059531.html

or

http://www.nabble.com/Hash-computation-problem-to22801988.html

Javadoc wrote:
The only thing I can see that would be difference when creating the signature twice would be the date name field signDate (signDate = new GregorianCalendar(); in constructor).
 You forgot to take the individually created /ID entries in the trailer into account. Also there is the ModDate in DocInfo and XMP.

 For your requirement you have to change or enhance iText a bit (it's not too complicated, though). Some hints on how to do that can be found in the threads pointed to above.

 Your requirement, though, is a bit against the nature of PDF as each time you start to manipulate some document (e.g. by preparing it for signing), you generate a completely new unique revision; thus starting twice to sign conceptionally should create different revisions having different hash values.

 Maybe, therefore, you should change the architecture of your software instead of iText.

Regards, Michael.