C# 如何创建使用RSASPSSHA256签名的JWT
我正试图使用rsassapssha256和从密钥库读取的自签名X509certificate2对JWToken进行签名 使用.NET4.61C# 如何创建使用RSASPSSHA256签名的JWT,c#,jwt,rsa-sha256,C#,Jwt,Rsa Sha256,我正试图使用rsassapssha256和从密钥库读取的自签名X509certificate2对JWToken进行签名 使用.NET4.61 尝试使用Microsoft提供的System.IdentityModel.Tokens.Jwt系统 并得到以下错误: "IDX10634: Unable to create the SignatureProvider.\nAlgorithm: 'PS256', SecurityKey: 'Microsoft.IdentityModel.Tokens.X50
"IDX10634: Unable to create the SignatureProvider.\nAlgorithm: 'PS256', SecurityKey: 'Microsoft.IdentityModel.Tokens.X509SecurityKey, KeyId: 'xxxxxxxxxxxxxxxxxxxxxxxxxx', InternalId: 'xxxxx-xxxxxx-xxxx-xxxxxx'.'\n is not supported. The list of supported algorithms is available here: https://aka.ms/IdentityModel/supported-algorithms"
不用说,SecurityAlgorithms.rsasa256正在按预期工作。
2.试图使用Jose JWT模块,但出现以下错误:
"RsaUsingSha with PSS padding alg expects key to be of CngKey type."
这里缺少什么?在使用RSASSAPSSHA256时需要从.NET 4.60升级到4.61时,我删除了System.IdentityModel.Tokens.Jwt包并重新安装了它们(即使它是相同的dll文件)。 现在一切都按预期进行
"RsaUsingSha with PSS padding alg expects key to be of CngKey type."