Has*_*san 2 rsa jwt asp.net-core identityserver4 asp.net-core-2.2
我已经从v2.1将我的项目升级到asp.net core v2.2,并且所有东西都用得很好.在下面显示的代码中,我试图用IdentityServer4(v2.3.2)初始化RSA密钥试图获取令牌我得到以下错误.
try
{
var rsaProvider = new RSACryptoServiceProvider(2048);
var rsaParametersPrivate =
RsaExtensions.RsaParametersFromXmlFile(Configuration.GetSection("JwtSettings:rsaPrivateKeyXml")
.Value);
rsaProvider.ImportParameters(rsaParametersPrivate);
var securityKey = new RsaSecurityKey(rsaProvider);
_signingCredentials = new SigningCredentials(securityKey, SecurityAlgorithms.RsaSha256);
_logger.LogInformation("InitializeRsaKey() successfully executed.");
}
catch (Exception ex)
{
var exception = new Exception("Identity Server RSA Key initialization failed. " + ex);
_logger.LogError(exception, "InitializeRsaKey() method failed.");
throw exception;
}
Run Code Online (Sandbox Code Playgroud)
'CspKeyContainerInfo'需要Windows Cryptographic API(CAPI),这在此平台上不可用.错误.
此外,我的项目在CentOS机器上运行,同时我在Windows 10上开发我的项目.因此,我知道在Linux上缺少Windows中存在的东西.为了解决这个问题,我们非常感谢任何帮助和建议.
| 归档时间: |
|
| 查看次数: |
362 次 |
| 最近记录: |