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?
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?
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");

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-Certificate-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/

Reply via email to