Signing SAML Request with SHA 256 not working

We have a certificate with Signature Algorithm = sha256RSA The SamlRequest of ComponentPro ignores the sha256 "signature algorithm" and creates a SAMLRequest with SHA 1: > Example URL created by ComponentPro: > But the request should be like: Does anybody have a solution how to use SHA256 or what is wrong here? This is our source code: var sha256DigestMethod = ""; var sha256SignatureMethod = ""; CryptoConfig.AddAlgorithm(typeof(RSAPKCS1SHA256SignatureDescription), sha256SignatureMethod); X509Certificate2 cert = new X509Certificate2(Path.Combine(HttpRuntime.AppDomainAppPath, SPKeyFile), SPKeyPassword, X509KeyStorageFlags.MachineKeySet); AuthnRequest authnRequest = new AuthnRequest(); authnRequest.Destination = ServiceConfig.SpServiceUrl; authnRequest.Issuer = new Issuer(ServiceConfig.Issuer); authnRequest.ForceAuthn = false; AuthnRequest.NameIdPolicy = new NameIdPolicy(null, null, true); authnRequest.Sign(x509Certificate, "", "");
edited 5/19/2021 8:00:00 PM
asked 5/19/2021 7:51:54 PM
add a comment

1 Answers

Hi, To work with SHA-256, please refer to this doc: Dont forget to add this line: CryptoConfig.AddAlgorithm(typeof(RSAPKCS1SHA256SignatureDescription), "");
edited 6/15/2021 8:32:35 AM
answered 6/15/2021 7:46:47 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged saml or ask your own question.