【发布时间】:2019-06-08 08:41:20
【问题描述】:
我已将我的项目从 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;
}
“CspKeyContainerInfo”需要 Windows 加密 API (CAPI),此平台上不可用。错误。
另外,我的项目在 CentOS 机器上运行,同时我在 Windows 10 上开发我的项目。所以,我知道 Windows 中存在的东西在 Linux 上丢失了。为了解决这个问题,任何帮助和建议表示赞赏。
【问题讨论】:
标签: asp.net-core jwt rsa identityserver4 asp.net-core-2.2