Tuesday 15 February 2011

.Net 4.0 C# When loading SHA256 key SignatureAlgorithm changes to SHA1 -


I am struggling together this week and hope someone can help me. I need to sign the XML using i SHA256 and xmldsig for that I use the SignedXML class. When viewed in this class, I see the signature of the loaded key to use which type of loading it uses the algorithm value.

No matter how I load the key (through loading the certificate store) show SHA1 as SignatureAlgorithm when I see the details of my certificate in the MMC certificate It shows SHA256 as signature algorithm.

I tried both opensl and makecart to create a SHA256 certificate key, but both will load as SHA1. Net and hence signXml.ComputeSignature (); SHA1 as a SignatureMethod

Does Net 4.0 require correct support for SHA256?

It was revealed that I was probably using the wrong class.

Instead of using Microsoft.Web.Services.Security.SignedXml System.Security.Cryptography.Xml.SignedXML does not use the SignatureAlgorithm key used to determine whether the key Use algorithms. Now I can set myself algorithm with 'SignedXml.SignedInfo.SignatureMethod' and use a SHA1 key.

No comments:

Post a Comment