adamec,

adamec wrote
> I still quite donet understand. When I sign a pdf with iText by means of
> private key I provide (using PrivateKeySignature), I also create hash for
> document. Then, this hash is signed afterwards and alsdo attached to pdf.

The difference starts with which document bytes are hashed. If I understand
you right, you hashed the bytes of the original document. For the integrated
PDF signature, though, that original document first is prepared for
integration of a signature, and then the hash is calculated for that
prepared document (with the exception of the range of bytes where the
signatrue container will be embedded). Thus, you hashed the wrong data.

The difference continues with which hash is to be encrypted to create the
actual signature: iText embeds CMS signature containers. The respective
SignerInfo inside contains an encrypted hash as signature value, but this
hash value is not the hash calculated for the document bytes but instead the
hash value calculated for the signed attributes of the SignerInfo and the
document hash merely is the value of one of these signed attributes. (This,
BTW, is not PDF specific but valid for non-trivial CMS/PKCS#7 signature
containers in general.)

Regards,   Michael



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/PKCS-1-signature-iText-signed-pdf-tp4657691p4657702.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to