The detached method doesn't use an external hash, just the one defined in the signature (RsaWithSha256 for example). This means that you don't have any hash and supply the cms with the full doc. See the detached example.
Paulo On Tue, Mar 20, 2012 at 3:23 PM, Rocco David <[email protected]> wrote: > hi, > > as you said to me , i see again the web page I refered and in exactly > http://itextpdf.sourceforge.net/howtosign.html#signextitextsharp2 this > exemple. > > I force the DigestAlgorithm of CmsSigner but when it ComputeSignature i > have this message: > Invalid algorithm specified. > > System.Security.Cryptography.Pkcs.ContentInfo contentInfo = new > System.Security.Cryptography.Pkcs.ContentInfo(msg); > > // Instantiate SignedCms object with the ContentInfo above. > // Has default SubjectIdentifierType IssuerAndSerialNumber. > SignedCms signedCms = new SignedCms(contentInfo, detached); > > > // Formulate a CmsSigner object for the signer. > CmsSigner cmsSigner = new CmsSigner(signerCert); > > * Oid oid = new Oid(); > oid.FriendlyName = "SHA256"; > cmsSigner.DigestAlgorithm = oid;* > > // Include the following line if the top certificate in the > // smartcard is not in the trusted list. > cmsSigner.IncludeOption = X509IncludeOption.EndCertOnly; > > // Sign the CMS/PKCS #7 message. The second argument is > // needed to ask for the pin. > signedCms.ComputeSignature(cmsSigner, false); > > Can I have some help please > > -- > View this message in context: > http://itext-general.2136553.n4.nabble.com/Problem-to-sign-using-Sha256-tp4471288p4489189.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 ------------------------------------------------------------------------------ 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
