{"id":6669,"date":"2023-02-19T01:05:54","date_gmt":"2023-02-19T01:05:54","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=6669"},"modified":"2025-07-30T06:08:10","modified_gmt":"2025-07-30T06:08:10","slug":"after-updating-the-ssl-certificate-used-by-microsoft-dynamics-crm","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/after-updating-the-ssl-certificate-used-by-microsoft-dynamics-crm","title":{"rendered":"After updating the SSL certificate used by Microsoft Dynamics CRM"},"content":{"rendered":"\n<p><strong>READ <\/strong>-> <a href=\"https:\/\/pariswells.com\/blog\/research\/dynamics-365-9-0-on-premise-ifd-configuration-error-invalid-provider-type-specified-how-to-check-the-keyspec-cng-capi-value-for-your-certificates-keys\">https:\/\/pariswells.com\/blog\/research\/dynamics-365-9-0-on-premise-ifd-configuration-error-invalid-provider-type-specified-how-to-check-the-keyspec-cng-capi-value-for-your-certificates-keys<\/a><\/p>\n\n\n\n<p>Import the Certificate as a Legacy one NOT the default<\/p>\n\n\n\n<p>HTTP 500 Error \u2018Keyset does not exist\u2019<\/p>\n\n\n\n<p>Next we need to grant to the account NETWORK SERVICE the access to the Private key of certificate on CRM Server because it\u2019s the account that has been associated by default to the CRMAppPool in IIS. You can double check it on the Application Pools in IIS.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/pdellecase.wordpress.com\/wp-content\/uploads\/2016\/09\/090416_1534_microsoftdy38.png?w=900\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>&nbsp;Error: Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Security.Cryptography.CryptographicException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #61396B66Detail: -2147220970 System.Security.Cryptography.CryptographicException: Microsoft Dynamics CRM has experienced an error.<\/p>\n\n\n\n<p>Keyset does not exist Not available Not available&nbsp;<a href=\"https:\/\/crmwebsite.domain.com\/Handlers\/FederationMetadata.ashx\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/crmwebsite.domain.com\/Handlers\/FederationMetadata.ashx<\/a>&nbsp;\/Handlers\/FederationMetadata.ashx<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Resolution <\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/improveandrepeat.com\/2018\/12\/how-to-fix-the-keyset-does-not-exist-cryptographicexception\/\">How to Fix the \u201cKeyset does not exist\u201d CryptographicException \u2013 Improve &amp; Repeat (improveandrepeat.com)<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Event code: 3005&nbsp;<br>Event message: An unhandled exception has occurred.&nbsp;<br>Event time: 14\/08\/2023 1:30:07 PM&nbsp;<br>Event time (UTC): 14\/08\/2023 3:30:07 AM&nbsp;<br>Event ID: 8f2981830a2a4adeb9df5df88a50fb76&nbsp;<br>Event sequence: 50&nbsp;<br>Event occurrence: 13&nbsp;<br>Event detail code: 0&nbsp;<br><br>Application information:&nbsp;<br>&nbsp;&nbsp;&nbsp; Application domain: \/LM\/W3SVC\/1\/ROOT-1-133364560657654137&nbsp;<br>&nbsp;&nbsp;&nbsp; Trust level: Full&nbsp;<br>&nbsp;&nbsp;&nbsp; Application Virtual Path: \/&nbsp;<br>&nbsp;&nbsp;&nbsp; Application Path: C:\\Program Files\\Microsoft Dynamics CRM\\CRMWeb\\&nbsp;<br>&nbsp;&nbsp;&nbsp; Machine name: XXXXXXX<br><br>Process information:&nbsp;<br>&nbsp;&nbsp;&nbsp; Process ID: 5164&nbsp;<br>&nbsp;&nbsp;&nbsp; Process name: w3wp.exe&nbsp;<br>&nbsp;&nbsp;&nbsp; Account name: NT AUTHORITY\\NETWORK SERVICE&nbsp;<br><br>Exception information:&nbsp;<br>&nbsp;&nbsp;&nbsp; Exception type: CryptographicException&nbsp;<br>&nbsp;&nbsp;&nbsp; Exception message: Invalid provider type specified.<\/p>\n\n\n\n<p>&nbsp;&nbsp; at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)<br>&nbsp;&nbsp; at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle&amp; safeProvHandle, SafeKeyHandle&amp; safeKeyHandle)<br>&nbsp;&nbsp; at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()<br>&nbsp;&nbsp; at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)<br>&nbsp;&nbsp; at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()<br>&nbsp;&nbsp; at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.get_PrivateKey()<br>&nbsp;&nbsp; at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.GetSignatureFormatter(String algorithm)<br>&nbsp;&nbsp; at System.IdentityModel.SignedXml.ComputeSignature(SecurityKey signingKey)<br>&nbsp;&nbsp; at System.IdentityModel.EnvelopedSignatureWriter.ComputeSignature()<br>&nbsp;&nbsp; at System.IdentityModel.EnvelopedSignatureWriter.OnEndRootElement()<br>&nbsp;&nbsp; at System.IdentityModel.Metadata.MetadataSerializer.WriteEntityDescriptor(XmlWriter inputWriter, EntityDescriptor entityDescriptor)<br>&nbsp;&nbsp; at System.IdentityModel.Metadata.MetadataSerializer.WriteMetadata(Stream stream, MetadataBase metadata)<br>&nbsp;&nbsp; at Microsoft.Crm.Authentication.Claims.MetadataGenerator.GenerateCrmFederationMetadata(Stream stream)<br>&nbsp;&nbsp; at Microsoft.Crm.Application.Components.Handlers.FederationMetadata.ProcessRequestInternal(HttpContext context)<br>&nbsp;&nbsp; at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()<br>&nbsp;&nbsp; at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)<br>&nbsp;&nbsp; at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)<\/p>\n\n\n\n<p><br><br>Request information:&nbsp;<br>&nbsp;&nbsp;&nbsp; Request URL: https:\/\/xxxxxx\/Handlers\/FederationMetadata.ashx<br>&nbsp;&nbsp;&nbsp; Request path: \/Handlers\/FederationMetadata.ashx&nbsp;<br>&nbsp;&nbsp;&nbsp; User host address: 192.168.51.9&nbsp;<br>&nbsp;&nbsp;&nbsp; User:&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp; Is authenticated: False&nbsp;<br>&nbsp;&nbsp;&nbsp; Authentication Type:&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp; Thread account name: NT AUTHORITY\\NETWORK SERVICE&nbsp;<br><br>Thread information:&nbsp;<br>&nbsp;&nbsp;&nbsp; Thread ID: 51&nbsp;<br>&nbsp;&nbsp;&nbsp; Thread account name: NT AUTHORITY\\NETWORK SERVICE&nbsp;<br>&nbsp;&nbsp;&nbsp; Is impersonating: True&nbsp;<br>&nbsp;&nbsp;&nbsp; Stack trace:&nbsp;&nbsp;&nbsp; at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)<br>&nbsp;&nbsp; at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle&amp; safeProvHandle, SafeKeyHandle&amp; safeKeyHandle)<br>&nbsp;&nbsp; at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()<br>&nbsp;&nbsp; at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)<br>&nbsp;&nbsp; at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()<br>&nbsp;&nbsp; at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.get_PrivateKey()<br>&nbsp;&nbsp; at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.GetSignatureFormatter(String algorithm)<br>&nbsp;&nbsp; at System.IdentityModel.SignedXml.ComputeSignature(SecurityKey signingKey)<br>&nbsp;&nbsp; at System.IdentityModel.EnvelopedSignatureWriter.ComputeSignature()<br>&nbsp;&nbsp; at System.IdentityModel.EnvelopedSignatureWriter.OnEndRootElement()<br>&nbsp;&nbsp; at System.IdentityModel.Metadata.MetadataSerializer.WriteEntityDescriptor(XmlWriter inputWriter, EntityDescriptor entityDescriptor)<br>&nbsp;&nbsp; at System.IdentityModel.Metadata.MetadataSerializer.WriteMetadata(Stream stream, MetadataBase metadata)<br>&nbsp;&nbsp; at Microsoft.Crm.Authentication.Claims.MetadataGenerator.GenerateCrmFederationMetadata(Stream stream)<br>&nbsp;&nbsp; at Microsoft.Crm.Application.Components.Handlers.FederationMetadata.ProcessRequestInternal(HttpContext context)<br>&nbsp;&nbsp; at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()<br>&nbsp;&nbsp; at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)<br>&nbsp;&nbsp; at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)<\/p>\n\n\n\n<p><strong>Resolution<\/strong><\/p>\n\n\n\n<p>Make sure the Certificate installed has the correct private key<\/p>\n\n\n\n<p>Use certutil to check on the certificate ( certutil -verifystore my {Thumbprint no squirly brackets} ) <\/p>\n\n\n\n<p>================ Certificate 3 ================<br>================ Begin Nesting Level 1 ================<br>Element 3:<br>Serial Number: XXXXXXXXXXX<br>Issuer: CN=Sectigo RSA Domain Validation Secure Server CA, O=Sectigo Limited, L=Salford, S=Greater Manchester, C=GB<br>NotBefore: 28\/07\/2023 10:00 AM<br>NotAfter: 27\/08\/2024 9:59 AM<br>Subject: CN=XXXXXXXXX<br>Non-root Certificate<br>Cert Hash(sha1): XXXXXXXXXX<br>&#8212;&#8212;&#8212;&#8212;&#8212;-&nbsp; End Nesting Level 1&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;-<br>&nbsp; Key Container = PfxContainer<br>&nbsp; Provider = PfxProvider<br><strong>Encryption test FAILED<br><\/strong>CertUtil: -dump command completed successfully.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>READ -> https:\/\/pariswells.com\/blog\/research\/dynamics-365-9-0-on-premise-ifd-configuration-error-invalid-provider-type-specified-how-to-check-the-keyspec-cng-capi-value-for-your-certificates-keys Import the Certificate as a Legacy one NOT the default HTTP 500 Error \u2018Keyset does not exist\u2019 Next we need to grant to the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4183,4181,4184,4177,4179,4178,4180],"class_list":["post-6669","post","type-post","status-publish","format-standard","hentry","category-research","tag-4183","tag-federationmetadata-xml","tag-getting-an-error-occurred-while-login-to-adfs","tag-http-500-error","tag-microsoft-xrm-sdk","tag-microsoft-xrm-sdk-organizationservicefault","tag-system-security-cryptography-cryptographicexception"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=6669"}],"version-history":[{"count":8,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6669\/revisions"}],"predecessor-version":[{"id":9070,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6669\/revisions\/9070"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=6669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=6669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=6669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}