Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何创建使用RSASPSSHA256签名的JWT_C#_Jwt_Rsa Sha256 - Fatal编程技术网

C# 如何创建使用RSASPSSHA256签名的JWT

C# 如何创建使用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

我正试图使用rsassapssha256和从密钥库读取的自签名X509certificate2对JWToken进行签名

使用.NET4.61

  • 尝试使用Microsoft提供的System.IdentityModel.Tokens.Jwt系统
  • 并得到以下错误:

    "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."