{"id":8565,"date":"2025-02-04T23:50:16","date_gmt":"2025-02-04T23:50:16","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=8565"},"modified":"2025-11-05T08:00:26","modified_gmt":"2025-11-05T08:00:26","slug":"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","status":"publish","type":"post","link":"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","title":{"rendered":"Dynamics 365 9.0 on-premise IFD configuration: Error Invalid provider type specified &#8211; How to check the KeySpec CNG \\ CAPI value for your certificates \/ keys"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code class=\"\">&lt;?xml version=\"1.0\"?&gt;\n \n-&lt;error xmlns:xsi=\"www.w3.org\/...\/XMLSchema-instance\" xmlns:xsd=\"www.w3.org\/...\/XMLSchema\"&gt;\n \n&lt;exception&gt;Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: 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&amp; safeProvHandle, SafeKeyHandle&amp; 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.IdentityModel.Tokens.X509AsymmetricSecurityKey.get_PrivateKey() at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.GetSignatureFormatter(String algorithm) at System.IdentityModel.SignedXml.ComputeSignature(SecurityKey signingKey) at System.IdentityModel.EnvelopedSignatureWriter.ComputeSignature() at System.IdentityModel.EnvelopedSignatureWriter.OnEndRootElement() at System.IdentityModel.Metadata.MetadataSerializer.WriteEntityDescriptor(XmlWriter inputWriter, EntityDescriptor entityDescriptor) at System.IdentityModel.Metadata.MetadataSerializer.WriteMetadata(Stream stream, MetadataBase metadata) at Microsoft.Crm.Authentication.Claims.MetadataGenerator.GenerateCrmFederationMetadata(Stream stream) at Microsoft.Crm.Application.Components.Handlers.FederationMetadata.ProcessRequestInternal(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #52B75F04Detail: &lt;OrganizationServiceFault xmlns:i=\"www.w3.org\/...\/XMLSchema-instance\" xmlns=\"schemas.microsoft.com\/...\/Contracts\"&gt; &lt;ActivityId&gt;d096958b-7e1b-4d58-a0d0-cf1724fe05a4&lt;\/ActivityId&gt; &lt;ErrorCode&gt;-2147220970&lt;\/ErrorCode&gt; &lt;ErrorDetails xmlns:d2p1=\"schemas.datacontract.org\/...\/System.Collections.Generic\" \/&gt; &lt;Message&gt;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&amp;amp; safeProvHandle, SafeKeyHandle&amp;amp; 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.IdentityModel.Tokens.X509AsymmetricSecurityKey.get_PrivateKey() at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.GetSignatureFormatter(String algorithm) at System.IdentityModel.SignedXml.ComputeSignature(SecurityKey signingKey) at System.IdentityModel.EnvelopedSignatureWriter.ComputeSignature() at System.IdentityModel.EnvelopedSignatureWriter.OnEndRootElement() at System.IdentityModel.Metadata.MetadataSerializer.WriteEntityDescriptor(XmlWriter inputWriter, EntityDescriptor entityDescriptor) at System.IdentityModel.Metadata.MetadataSerializer.WriteMetadata(Stream stream, MetadataBase metadata) at Microsoft.Crm.Authentication.Claims.MetadataGenerator.GenerateCrmFederationMetadata(Stream stream) at Microsoft.Crm.Application.Components.Handlers.FederationMetadata.ProcessRequestInternal(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;amp; completedSynchronously): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #52B75F04&lt;\/Message&gt; &lt;Timestamp&gt;2019-03-22T06:30:25.9316984Z&lt;\/Timestamp&gt; &lt;ExceptionRetriable&gt;false&lt;\/ExceptionRetriable&gt; &lt;ExceptionSource i:nil=\"true\" \/&gt; &lt;InnerFault i:nil=\"true\" \/&gt; &lt;OriginalException i:nil=\"true\" \/&gt; &lt;TraceText i:nil=\"true\" \/&gt; &lt;\/OrganizationServiceFault&gt; &lt;\/exception&gt;\n \n&lt;parameters xsi:nil=\"true\"\/&gt;\n \n&lt;displaytitle\/&gt;\n \n&lt;displaytextencoded\/&gt;\n \n&lt;displaytext\/&gt;\n \n&lt;description&gt;Invalid provider type specified. &lt;\/description&gt;\n \n&lt;file&gt;Not available&lt;\/file&gt;\n \n&lt;line&gt;Not available&lt;\/line&gt;\n \n&lt;details&gt;Not available&lt;\/details&gt;\n \n&lt;traceInfo\/&gt;\n \n&lt;requesturl&gt;internalcrm.kcenter.com\/...\/FederationMetadata.ashx&amp;lt;\/requesturl&gt;\n \n&lt;pathAndQuery&gt;\/Handlers\/FederationMetadata.ashx&lt;\/pathAndQuery&gt;\n \n&lt;source&gt;ASHX_XML&lt;\/source&gt;\n \n&lt;stacktrace\/&gt;\n \n&lt;\/error&gt;<\/code><\/pre>\n\n\n\n<p>We had added private key permissions &#8212; which is the usual issue with SSLs and CRM &#8212; so that was not the problem.<\/p>\n\n\n\n<p>The reason is that the commercial SSL issued was not of type CAPI, we had unknowingly been issued a CNG (Certificate Next Generation).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">KeySpec values and associated meanings<a href=\"https:\/\/github.com\/MicrosoftDocs\/windowsserverdocs\/blob\/main\/WindowsServerDocs\/identity\/ad-fs\/technical-reference\/AD-FS-and-KeySpec-Property.md#keyspec-values-and-associated-meanings\"><\/a><\/h2>\n\n\n\n<p>The following are the meanings of the various KeySpec values:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Keyspec value<\/th><th>Means<\/th><th>Recommended AD FS use<\/th><\/tr><\/thead><tbody><tr><td><code>0<\/code><\/td><td>The certificate is a CNG (Certificate Next Generation) cert<\/td><td>SSL certificate only<\/td><\/tr><tr><td><code>1<\/code><\/td><td>For a legacy CAPI (non-CNG) cert, the key can be used for signing and decryption<\/td><td>SSL, token signing, token decrypting, service communication certificates<\/td><\/tr><tr><td><code>2<\/code><\/td><td>For a legacy CAPI (non-CNG) cert, the key can be used only for signing<\/td><td>not recommended<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How to check the KeySpec value for your certificates \/ keys<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/MicrosoftDocs\/windowsserverdocs\/blob\/main\/WindowsServerDocs\/identity\/ad-fs\/technical-reference\/AD-FS-and-KeySpec-Property.md#how-to-check-the-keyspec-value-for-your-certificates--keys\"><\/a><\/p>\n\n\n\n<p>To see a certificate&#8217;s value you can use the&nbsp;<code>certutil<\/code>&nbsp;command line tool.<\/p>\n\n\n\n<p>The following is an example:&nbsp;<code>certutil \u2013v \u2013store my<\/code> {THUMBPRINT] This command dumps the certificate information to the screen.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/github.com\/MicrosoftDocs\/windowsserverdocs\/blob\/main\/WindowsServerDocs\/identity\/ad-fs\/technical-reference\/media\/AD-FS-and-KeySpec-Property\/keyspec1.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/github.com\/MicrosoftDocs\/windowsserverdocs\/raw\/main\/WindowsServerDocs\/identity\/ad-fs\/technical-reference\/media\/AD-FS-and-KeySpec-Property\/keyspec1.png\" alt=\"Keyspec cert\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How to change the keyspec for your certificate to a supported value<a href=\"https:\/\/github.com\/MicrosoftDocs\/windowsserverdocs\/blob\/main\/WindowsServerDocs\/identity\/ad-fs\/technical-reference\/AD-FS-and-KeySpec-Property.md#how-to-change-the-keyspec-for-your-certificate-to-a-supported-value\"><\/a><\/h2>\n\n\n\n<p>Changing the KeySpec value doesn&#8217;t require the certificate to be regenerated or reissued. The KeySpec can be changed by reimporting the complete certificate and private key from a PFX file into the certificate store using the following steps.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Check and record the private key permissions on the existing certificate so that they can be reconfigured if necessary after the reimport.<\/li>\n\n\n\n<li>Export the certificate including private key to a PFX file.<\/li>\n\n\n\n<li>Perform the following steps for each AD FS and WAP server.\n<ol class=\"wp-block-list\">\n<li>Delete the certificate (from the AD FS \/ WAP server).<\/li>\n\n\n\n<li>Open an elevated PowerShell command prompt.<\/li>\n\n\n\n<li>Import the PFX file on each AD FS and WAP server using the following syntax, specifying the&nbsp;<code>AT_KEYEXCHANGE<\/code>&nbsp;value (which works for all AD FS certificate purposes):\n<ol class=\"wp-block-list\">\n<li><code>certutil \u2013importpfx certfile.pfx AT_KEYEXCHANGE<\/code>\n<ul class=\"wp-block-list\">\n<li><code>AT_KEYEXCHANGE<\/code>\u00a0(which has a value of 1)<\/li>\n\n\n\n<li><code>AT_SIGNATURE<\/code>\u00a0(value of 2)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Enter PFX password.<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>After the above process completes, do the following:\n<ol class=\"wp-block-list\">\n<li>Check the private key permissions.<\/li>\n\n\n\n<li>Restart the AD FS or WAP service.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p>If CertUtil: -importPFX command FAILED 0x80090029 (-2146893783 NTE_NOT_SUPPORTED)<\/p>\n\n\n\n<p>The cause for this issue was that there was addidional permission on the folder: C:\\ProgramData\\Microsoft\\Crypto\\RSA\\MachineKeys.<\/p>\n\n\n\n<p>Should be like this <br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2025\/02\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"390\" height=\"172\" src=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2025\/02\/image-3.png\" alt=\"\" class=\"wp-image-9065 img-responsive\" srcset=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2025\/02\/image-3.png 390w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2025\/02\/image-3-300x132.png 300w\" sizes=\"auto, (max-width: 390px) 100vw, 390px\" \/><\/a><\/figure>\n\n\n\n<p><br><br><a href=\"https:\/\/anotherexchangeblog.wordpress.com\/2015\/11\/25\/cannot-import-certificate-with-certutil-the-requested-operation-is-not-supported\/#comments\">https:\/\/anotherexchangeblog.wordpress.com\/2015\/11\/25\/cannot-import-certificate-with-certutil-the-requested-operation-is-not-supported\/#comments<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We had added private key permissions &#8212; which is the usual issue with SSLs and CRM &#8212; so that was not the problem. The reason is that [&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":[],"class_list":["post-8565","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8565","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=8565"}],"version-history":[{"count":4,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8565\/revisions"}],"predecessor-version":[{"id":9305,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8565\/revisions\/9305"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=8565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=8565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=8565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}