Max,

madmax wrote
> In the signPdf method the sample Java code has reduced the code to: 
> byte[] data= Base64.decodeBase64(digest.trim().getBytes());

The data you received like that and then inserted in the PDF definitively is
a signature container.

> signed version of the document with my PIV card.

Unfortunately the container is not built as required in your PDF.

The signature dictionary in the PDF specifies that its /SubFilter is
/adbe.pkcs7.detached. According to the PDF spec (ISO 32000-1:2008 section
12.8.3.3.1) this has implications: In contrast to /adbe.pkcs7.sha1
signatures (for which the SHA1 digest of the document’s byte range shall be
encapsulated in the PKCS#7
SignedData field) no data shall be encapsulated in the PKCS#7 SignedData
field for /adbe.pkcs7.detached signatures.

Your signature, though, does have encapsulated data there:

        encapContentInfo (EncapsulatedContentInfo) ::= SEQUENCE {
            eContentType (Oid (Data)) 1.2.840.113549.1.7.1
            eContent    b900f400f100cc007b003f003f00bb00c600f200ea003700
        } 

This might be due to the fact that you call the CAPICOM.SignedData method
Sign with a bDetached parameter value "false".

Another problem becomes appearant here, though: Every other byte in your
encapsulated content is 00 which is not really likely to happen for hashes.
Thus, you seem to have to differently prepare your data.

As mentioned before, I do not use CAPICOM myself. Thus, I cannot tell you
how correctly to create a signature with it as required.

> I will continue to try different things on my side but if you know of how
> to solve the date issue please let me know.

If you do not want to have a SigningTime signed attribute in your signature
container, simply don't add it in sign_IE().

Regards,   Michael

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Sign-and-PDF-with-SmartCard-and-web-browser-only-tp4319344p4369640.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
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