You'll need to freeze the state after preClose and resume it after the
signature is received. One way of doing it is to keep the instance
around, the other option is to modify the iText code, not very difficult
but not trivial either.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Francesca Merighi
> Sent: Thursday, February 01, 2007 11:24 AM
> To: [email protected]
> Subject: [iText-questions] Question about signing
> 
> Hi, I'm trying to sign a pdf document using external hash and 
> signature.
> I notice that if i hash the same document (the result of the 
> method getRangeStream() ) twice, i obtain two different digests.
> I suppose that this is becouse the pdf signature methods 
> introduce some randomness into the document before hashing it.
> This is a problem in this case:
> - i generate a hash x of the document d
> - i send the hash x to a user to make it signed
> - i receive the signed hash x and i want to build a signed 
> pdf document with it.
> If i use the code in the example "How to sign with an 
> external signature" 
> (http://itextpdf.sourceforge.net/howtosign.html 
> <http://itextpdf.sourceforge.net/howtosign.html> ) , specifing 
> the signed value and the hash x in the method 
> setExternalDigest, i obtain an invalid signature, becouse the 
> hash calculated by 
> the PdfAppearence methods is different from the hash x.
> Is there a method to rebuild the document corrisponding to 
> the hash x and to compose a valid pdf signature? 
> (in some way i want to get the randomness, apply it to the 
> original pdf document, and build the pdf signature structure).
>  
> Thanks
>  
> Francesca Merighi
> 
>  
> 


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.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to