Azure ad b2c 间歇性Azure AD B2C异常:IDX10614:AsymmetricSecurityKey.GetSignatureFormat()引发异常

Azure ad b2c 间歇性Azure AD B2C异常:IDX10614:AsymmetricSecurityKey.GetSignatureFormat()引发异常,azure-ad-b2c,azure-ad-b2c-custom-policy,Azure Ad B2c,Azure Ad B2c Custom Policy,我们使用AAD B2C和自定义策略已经有一段时间了,一切都正常运行,但突然我们开始在登录策略上出现异常。更糟糕的是,有时它确实有效,但5次中有4次我们会遇到异常 我们通过将策略链接到应用程序洞察,成功地挖掘了错误,下面是我们得到的: "Kind": "FatalException", "Content": { "Time": "9:05 PM", "Exc

我们使用AAD B2C和自定义策略已经有一段时间了,一切都正常运行,但突然我们开始在登录策略上出现异常。更糟糕的是,有时它确实有效,但5次中有4次我们会遇到异常

我们通过将策略链接到应用程序洞察,成功地挖掘了错误,下面是我们得到的:

"Kind": "FatalException",
    "Content": {
      "Time": "9:05 PM",
      "Exception": {
        "Kind": "Handled",
        "HResult": "80131509",
        "Message": "IDX10614: AsymmetricSecurityKey.GetSignatureFormater( 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' ) threw an exception.\nKey: 'System.IdentityModel.Tokens.X509AsymmetricSecurityKey'\nSignatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256', check to make sure the SignatureAlgorithm is supported.\nException:'System.Security.Cryptography.CryptographicException: Invalid provider type specified.\r\n\r\n   at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)\r\n   at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)\r\n   at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()\r\n   at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)\r\n   at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()\r\n   at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.get_PrivateKey()\r\n   at System.IdentityModel.Tokens.X509AsymmetricSecurityKey.GetSignatureFormatter(String algorithm)\r\n   at System.IdentityModel.Tokens.AsymmetricSignatureProvider..ctor(AsymmetricSecurityKey key, String algorithm, Boolean willCreateSignatures)'.\nIf you only need to verify signatures the parameter 'willBeUseForSigning' should be false if the private key is not be available.",
        "Data": {},
        "Exception": {
          "Kind": "Handled",
          "HResult": "80090014",
          "Message": "Invalid provider type specified.\r\n",
          "Data": {}
        }
      }
    }
我不知道发生了什么变化,也不知道这是怎么突然发生的。不管我们是否使用隐姓埋名模式

此外,微软方面也没有报告任何停机


任何线索都将不胜感激

通过以下信息解决:

因为我们也在使用,所以我使用了这里提到的
newselfsignedcertificate
命令

现在,我已使用此文件中的信息重新生成证书,并从上面的StackOverflow线程中附加
Provider
参数:

PS C:\WINDOWS\system32> New-SelfSignedCertificate `
>>     -KeyExportPolicy Exportable `
>>     -Subject "CN=***.onmicrosoft.com" `
>>     -KeyAlgorithm RSA `
>>     -KeyLength 2048 `
>>     -KeyUsage DigitalSignature `
>>     -NotAfter (Get-Date).AddMonths(24) `
>>     -CertStoreLocation "Cert:\CurrentUser\My" `
>>     -Provider "microsoft enhanced rsa and aes cryptographic provider"
虽然我不知道为什么这突然突然停止工作,我猜可能是微软在他们的终端更新了一些东西


不管怎么说,它现在似乎起作用了,我们拭目以待。

不再是间歇性的,它一直在发生。