Subject: ComponentPro.Saml : Invalid Algorithm specified error for assertion.Sign() method
Date: 2021-02-16 15:29:13
From: pjoshi
Source: componentpro-saml-invalid-algorithm-specified-error-assertion-sign-method
----------------------------------------------------------------------

Hi Team,
We are using ComponentPro.Saml dll to generate the SAML response XML. While signing it with SHA256 algorithm we are getting below error

**Assembly: ComponentPro.Saml, Version=7.2.40.234**

**Code**
assertion.Sign(idpCert, "http://www.w3.org/2001/04/xmlenc#sha256", "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");

**Error:** 
Inner Exception: Invalid Alogorithm Specified
   Stack Strace:
      at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
   at System.Security.Cryptography.Utils.SignValue(SafeKeyHandle hKey, Int32 keyNumber, Int32 calgKey, Int32 calgHash, Byte[] hash, Int32 cbHash, ObjectHandleOnStack retSignature)
   at System.Security.Cryptography.Utils.SignValue(SafeKeyHandle hKey, Int32 keyNumber, Int32 calgKey, Int32 calgHash, Byte[] hash)
   at System.Security.Cryptography.RSACryptoServiceProvider.SignHash(Byte[] rgbHash, Int32 calgHash)
   at ComponentPro.Saml.PrefixSignedXml.ComputeSignature()
   at ComponentPro.Saml.SamlUtil.ComputeSignature(XmlElement xmlElement, String elementId, AsymmetricAlgorithm signingKey, KeyInfo keyInfo, PrefixSignedXml signedXml, String inclusiveNamespacesPrefixList, String digestMethod, String signatureMethod)
   
   
However **assertion.Sign(idpCert)** works fine. Not sure issue is with our .pfx file or any configuration is missing in my code.

Please suggest.

----------------------------------------------------------------------

Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand
If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor
who sold you the license and ask for your money back.

Back to ComponentPro Q&A Forum Index