> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Fionn Ziegler
> Sent: Thursday, October 25, 2007 4:21 PM
> To: [email protected]
> Subject: Re: [iText-questions] Signing PDF-Document with 
> external Certificate and Signature (Signature is INVALID)
> 
> 
> Hi Paulo,
> thank you for you fast answers! Signing a document works fine 
> now! I hav
> some questions to understand my code completely :thinking::
> 1)
> ...
> tSignatureAppearance.setExternalDigest(new byte[512], new 
> byte[20], "RSA");
> tSignatureAppearance.preClose();
> ...
> That is a buffer for the extern signature, right? How can i 
> make the size
> dynamic?

The size depends on the signature size and the hash. You must know that
before starting.

> 2)
> ...
> PdfLiteral tPDFLiteral = (PdfLiteral)
> tDocumentSignatureDic.get(PdfName.CONTENTS);
> byte[] tOutBytes = new byte[(tPDFLiteral.getPosLength() - 2) / 2];
> ...
> This is a byte-array with the size of the Contents right? why -2 / 2?

The array is placed as an hex string of the form <AABBCC>.

> 3)
> Now i'am signing these bytes:
> ...
> tMessageDigest.digest();
> ...
> I can't sign the bytes from the "getRangestream" method 
> direct, why? Or why
> do i need the .digest here:
> tSigner.setExternalDigest(sigenedDigest, digest, "RSA");

That's the way things are done. For more information see the source
code.

Paulo

> 
> I'm sorry for all these silly questions, but i'm new in this 
> area and i want
> to understand it.
> 
> Thanks
> 
> Fionn Ziegler
> 
> 
> 
> 
> Paulo Soares wrote:
> > 
> > You'll always need getRangeStream() to get the bytes that must be
> > signed. If your application needs a file or a byte array 
> you'll have to
> > do the conversions and create the needed objects.
> > 
> > Paulo 
> > 
> > 
> 
> 
> -----
> P-(
> -- 
> View this message in context: 
> http://www.nabble.com/Signing-PDF-Document-with-external-Certi
> ficate-and-Signature-%28Signature-is-INVALID%29-tf4639103.html
> #a13409151
> Sent from the iText - General mailing list archive at Nabble.com.
> 
> 
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and 
> a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> 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/
> 


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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