You need to sign in to do that
Don't have an account?
PureFacts
I am working through the example
https://developer.salesforce.com/page/Configuring-SAML-SSO-to-Custom-.Net-Application
and the sample code is getting the exception
m_SafeCertContext is an invalid handle
status = signedXml.CheckSignature(cert, true);
Googling this it seems the it may be related to an uninitialized field
The actual exception we are getting is
checking the signature failed!
System.Security.Cryptography.CryptographicException: m_safeCertContext is an invalid handle.
at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PublicKey()
at System.Security.Cryptography.Xml.SignedXml.CheckSignature(X509Certificate2 certificate, Boolean verifySignatureOnly)
Anyone know how to address this.
Thanks in advance.
Whatty
m_safeCertContext is an invalid handle - please help!
I am working through the example
https://developer.salesforce.com/page/Configuring-SAML-SSO-to-Custom-.Net-Application
and the sample code is getting the exception
m_SafeCertContext is an invalid handle
status = signedXml.CheckSignature(cert, true);
Googling this it seems the it may be related to an uninitialized field
The actual exception we are getting is
checking the signature failed!
System.Security.Cryptography.CryptographicException: m_safeCertContext is an invalid handle.
at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PublicKey()
at System.Security.Cryptography.Xml.SignedXml.CheckSignature(X509Certificate2 certificate, Boolean verifySignatureOnly)
Anyone know how to address this.
Thanks in advance.
Whatty
First and foremost sincerely regret for the delayed reply.
The error is thrown because no valid certificate is found.
This can be caused by either:
- A problem with the cert. A common reason for this in a development environment is one of the cert properties differing from that of the environment eg cert common name does not match the site name. I guess this would also occur if the cert had expired.
- The cert did not get passed to the request.
For more details, please visit Error (m_safeCertContext is an invalid handle.) when accessing a client certificate using .NET 2.0/VS2005 (http://geekswithblogs.net/TimH/archive/2006/04/18/75477.aspx" style="padding:0px;border:none;font-size:16px;vertical-align:baseline;list-style-type:none;text-decoration:underline;color:rgb(0, 118, 163);cursor:pointer;" title="Title of this entry.), also check out here for another discussion about this issue.For more information on similar issue please check here:
- https://social.msdn.microsoft.com/Forums/vstudio/en-US/9a6461ac-79e6-43fb-8ab4-12ab28b92844/msafecertcontext-is-an-invalid-handle-generating-signature?forum=clr
- https://social.technet.microsoft.com/Forums/sharepoint/en-US/23644056-9106-47b2-bec6-978aea117e1b/cryptographic-exception-msafecertcontext-is-an-invalid-handle?forum=sharepointadminprevious
- https://na43.salesforce.com/chatteranswers/ChatterAnswersQuestionSingleItem.apexp?id=906F0000000kJob
Mark this as solved if it's resolved.Best Regards,
Nagendra.P