Following the suggestions here:
https://www.componentspace.com/forums/30/sha256-xml-signature-supportSAMLMessageSignature.Generate( samlResponseElement, x509Certificate.PrivateKey, x509Certificate, null, "http://www.w3.org/2001/04/xmlenc#sha256", "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");Calling the code:
SAMLMessageSignature.Generate(
samlResponseElement,
x509Certificate.PrivateKey,
x509Certificate,
null,
"
http://www.w3.org/2001/04/xmlenc#sha256",
"
http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
ComponenSpace version is 2.6.0.2
ASP.NET version is 4.6.1
Getting the following exception:
ComponentSpace.SAML2.Exceptions.SAMLSignatureException
HResult=0x80131600
Message=Failed to generate XML signature.
Source=ComponentSpace.SAML2
StackTrace:
at ComponentSpace.SAML2.Utility.XmlSignature.Generate(XmlElement xmlElement, String elementId, AsymmetricAlgorithm signingKey, KeyInfo keyInfo, SignedXml signedXml, String inclusiveNamespacesPrefixList, String digestMethod, String signatureMethod)
at ComponentSpace.SAML2.Utility.XmlSignature.Generate(XmlElement xmlElement, String elementId, AsymmetricAlgorithm signingKey, X509Certificate2Collection x509Certificates, SignedXml signedXml, String inclusiveNamespacesPrefixList, String digestMethod, String signatureMethod)
at ComponentSpace.SAML2.Utility.XmlSignature.Generate(XmlElement xmlElement, String elementId, AsymmetricAlgorithm signingKey, X509Certificate2 x509Certificate, SignedXml signedXml, String inclusiveNamespacesPrefixList, String digestMethod, String signatureMethod)
at ComponentSpace.SAML2.Protocols.SAMLMessageSignature.Generate(XmlElement xmlElement, AsymmetricAlgorithm signingKey, X509Certificate2 x509Certificate, String inclusiveNamespacesPrefixList, String digestMethod, String signatureMethod)
at Resolver.TrySingleSignon() in C:\Code\WebSites\Doculivery External\Resolver.aspx.vb:line 157
at Resolver.Page_Init(Object sender, EventArgs e) in C:\Code\WebSites\Doculivery External\Resolver.aspx.vb:line 33
Inner Exception 1:
CryptographicException: Invalid algorithm specified.
The certificate appears to support this signature.
Properties from the cert:
Version/: V3
Signature Algorithm: sha256RSA
Signature hash algorithm: sha256
Public key: RSA (2048 bits)
Any help troubleshooting please ?