Je tente de sécuriser l'API Web asp.net à l'aide de la bibliothèque IdentityServer3.IdentityServer3 Type de fournisseur non valide spécifié lors de l'utilisation du certificat auto-signé
J'ai créé un certificat auto-signé pour la signature de la sécurité tokes comme suit:
Puis je me suis l'exception suivante quand je l'appelle mon serveur d'autorisation
http://localhost:53180/connect/token
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "Invalid provider type specified.\r\n",
"ExceptionType": "System.Security.Cryptography.CryptographicException",
"StackTrace": " 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) in c:\\workspace\\WilsonForDotNet45Release\\src\\System.IdentityModel.Tokens.Jwt\\AsymmetricSignatureProvider.cs:line 147"
Il semble y avoir un problème avec la clé privée du certificat:
J'ai rencontré le même problème avec IdentityServer4. –