No, there is no way to make the transformation.

Now a better question - why do you need to?  XAdES is a perfectly fine standard 
and is on the same level as PAdES (the PDF Advanced Electronic Signature 
standard).

Leonard

From: Tomasz Korolczuk [mailto:[email protected]]
Sent: Thursday, August 27, 2009 9:13 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Problem with transforming PDF from XADES signed 
XML file info "normal" signed PDF

Michael,

Thanx for so quick reply. You made me confused about those attributes, you're 
absolutely right.
Let me ask You one more question. Is there ANY chance to make my 
transformation? Maybe setting some ranges for byterange hashing for PDF, 
excluding additional dataobjects? Anything? Modification of 
signing-process-flow is unfortunately impossible :-(

TK.

2009/8/27 mkl <[email protected]<mailto:[email protected]>>

Hello Thomasz,

so you have a regular XaDES signature for the original PDF file and try to
convert it into a PDF with an integrated signature?

I'm afraid this is impossible. In a PDF with an integrated signature, the
hash is not merely calculated for the original PDF revision you had to sign
but also for the additional PDF objects required to embed the signature.


Tomasz Korolczuk wrote:
>    try {
>       sap.preClose(exc);
>    } catch (IOException e) {
>       e.printStackTrace();
>    } catch (DocumentException e) {
>       e.printStackTrace();
>    }
>
>    byte[] hash = null;
>    hash = Base64.decodeBase64(xml.getDocumentDigest().getBytes());
If you had not removed the original code used to calculate the hash digest,
you could have compared it to the digest you take from the XML; you would
have seen that they differ.

If you could change the process in a way that the XaDES signature is not
created for the original PDF but for the range stream returned by
sap.getRangeStream() after sap.preClose(exc), your chances get better to
produce something usable.

Unfortunately in your code you later build a new signedAttributes object.
Why do you expect you do it identically to how it was done by the code that
created the XaDES signature?

I'm afraid it's back to cryptography 101 and the whiteboard...

BTW,


Tomasz Korolczuk wrote:
>    stamper = PdfStamperOSP.createSignature(reader, os, '\0');
it generally a good idea to use the createSignature overload with the append
parameter and set it to true, as otherwise prior signatures are rendered
broken.

Regards,   Michael.
--
View this message in context: 
http://www.nabble.com/Problem-with-transforming-PDF-from-XADES-signed-XML-file-info-%22normal%22-signed-PDF-tp25167508p25167534.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]<mailto:[email protected]>
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/



--

--

Tomasz Korolczuk
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
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/

Reply via email to