Rocco David,

as Paulo and I have said multiple times in this thread, you should not
simply replace PdfName.ADBE_PKCS7_SHA1 by ADBE_PKCS7_DETACHED and every use
of SHA1 by a SHA2 algorithm and expect everything to work. It won't.

Thus, let's work based on this
http://itextpdf.sourceforge.net/howtosign.html#signextitextsharp2
(Detached).

If I understand you correctly, you are using a smart card (which you think
can sign using SHA2 hash algorithms) and cannot tweak CmsSigner to use
SHA-256 instead of SHA1. You attempt that using this code:

            Oid oid = new Oid(); 
            oid.FriendlyName = "SHA256"; 
            cmsSigner.DigestAlgorithm = oid;  

So essentially your problem is getting .NET System.Security.Cryptography
classes do what you want; this most likely is a question better suited for
MS cryptography forums.

Two ideas, though:

 * Have you checked whether your smart card has multiple signing
application? There are a number of smart cards which have multiple ones, and
not all of these applications support SHA2 digests. Maybe you have to select
the right one.
 * Is "SHA256" really a friendly name recognized by that .NET Oid class?
(I'm doing Java and don't know the .NET libraries in detail...) Have you
tried using the OID string instead?

Regards,   Michael

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Problem-to-sign-using-Sha256-tp4471288p4492153.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
iText-questions mailing list
[email protected]
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