System.Security.Cryptography.CryptographicException: Invalid provider type specified.

Hello,
I’m getting the following exception. I’ve enabled Saml Tracing but I’m not seeing any errors listed in that log file. Any help would be appreciated.


System.Security.Cryptography.CryptographicException: Invalid provider type specified.
at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
at System.Security.Cryptography.RSACryptoServiceProvider…ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()
at System.Security.Cryptography.X509Certificates.RSACertificateExtensions.GetRSAPrivateKey(X509Certificate2 certificate)
at ComponentSpace.SAML2.InternalSAMLIdentityProvider.CreateSAMLResponse(String userName, SAMLAttribute[] attributes, String authnContext, Status status, String assertionConsumerServiceUrl)
at ComponentSpace.SAML2.InternalSAMLIdentityProvider.InitiateSSO(HttpResponseBase httpResponse, String userName, SAMLAttribute[] attributes, String authnContext, String relayState, String partnerSP, String assertionConsumerServiceUrl)
at Tbb.SSOProviders.Providers.SAMLSSO.Login(HttpResponseBase Response, AccountData accountData, List tokens)

This error usually means that the cryptographic service provider (CSP) specified by the PFX file doesn’t support SHA-256 signatures.

Please take a look at the following forum post which explains how to check this and update the PFX file.

https://www.componentspace.com/Forums/1578/SHA256-and-Converting-the-Cryptographic-Service-Provider-Type

[quote]
ComponentSpace - 7/2/2020
This error usually means that the cryptographic service provider (CSP) specified by the PFX file doesn’t support SHA-256 signatures.

Please take a look at the following forum post which explains how to check this and update the PFX file.

https://www.componentspace.com/Forums/1578/SHA256-and-Converting-the-Cryptographic-Service-Provider-Type
[/quote]

Thank you, it turns out that the certificate that was generated for me, wasn't done with the correct CSP.

Thanks for the update.