On 28.08.2007, at 16:19, Paulo Soares wrote:
> You can put whatever you want in the digital signature payload and  
> in the
> signature dictionary.
Yes. I've successfully implemented it based on examples found on the  
web (http://itextpdf.sourceforge.net/howtosign.html) and with little  
help from javadoc as well. Here is the debug  output from the  
embedding utility (pdfsample.pdf is the pdf originally signed by some  
external program):

...
Found pdfsample.pdf, 13072 bytes.
Total revisions inside PDF file: 0
Embedding the signature payload into PDF...
Size of signature blob: 13568 (what is reserved with CONTENTS)
Length of stamper range: 16816 (what should be fed to external  
hashing according to docs)
Length of payload: 3447 (what I actually want to embed in the PDF)
All done
Resulting PDF file size: 30384 bytes
...


Now I have a PDF file of 30384. My  extraction utility can easily  
extract the  'stamper range' from the resulting pdf file just like  
the examples on the web suggest (locating the signature and using  
getRangeStream):
...
Signature1 filter matches.
Signature covers whole document: true
Document revision: 1 of 1
extractRevision length: 30384
PdfName.BYTERANGE calculation: 16816
...


BUT I would like to get the very original pdf file with the size of  
13072 bytes.  Is it possible ?

> I don't see any issue here.


> If you add the signature
> in append mode you can even get the original PDF before signing.

With append mode you mean PdfStamper.createSignature that creates a  
new revision ? I'm using this:

PdfStamper stamper = PdfStamper.createSignature(pdfreader,  
fsout,'\0', null, true);

I still don't know how could I open the 30384 byte PDF file into what  
I embedded a signature with itext tools and get the 13072 PDF file I  
originally opened with itext and into what I embedded my stuff.

>
> Paulo
>
> ----- Original Message -----
> From: "Martin Paljak" <[EMAIL PROTECTED]>
> To: "Post all your questions about iText here"
> <itext-questions@lists.sourceforge.net>
> Sent: Tuesday, August 28, 2007 2:07 PM
> Subject: Re: [iText-questions] Embedding external signatures inside  
> PDF
> files
>
>
>>
>> On 28.08.2007, at 15:53, Paulo Soares wrote:
>>
>>> Each time a signature is applied new ids are created. Signing the
>>> same PDF
>>> twice will never have the same hash.
>> That's not a requirement. The only requirement is to have a single
>> PDF and a single signature that should be verifiable only with
>> special software (that knows how to extract the needed information
>> and knows what to do with the external signature format and how to
>> verify it).
>>
>> The signature in embedded in the PDF file has nothing to do with PDF
>> signatures - it should not be possible to verify it  with adobe
>> reader for example - only if a special plugin is installed.
>>
>> The idea is to have a proprietary signature format encapsulated into
>> the PDF so that the end user would see a normal PDF with a 'unknown
>> signature' but with special software it would be possible to turn the
>> PDF inside out and and get the digital signature payload from inside
>> the PDF.
>>
>> -- 
>> Martin Paljak
>> http://martin.paljak.pri.ee
>
>
> ---------------------------------------------------------------------- 
> ---
> 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
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/

-- 
Martin Paljak
http://martin.paljak.pri.ee



-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to