C# 在Monodevelop中写入JSON web令牌时出现异常IDX10632
下面的代码是在Windows中使用VS编写的,它似乎在Windows中运行良好C# 在Monodevelop中写入JSON web令牌时出现异常IDX10632,c#,.net,jwt,monodevelop,C#,.net,Jwt,Monodevelop,下面的代码是在Windows中使用VS编写的,它似乎在Windows中运行良好 List<Claim> claimsList; InMemorySymmetricSecurityKey key; // fill claims and key with data var token = new JwtSecurityToken ( claims: claimsList, signingCredentials: new SigningCredentials(key,
List<Claim> claimsList;
InMemorySymmetricSecurityKey key;
// fill claims and key with data
var token = new JwtSecurityToken
(
claims: claimsList,
signingCredentials: new SigningCredentials(key, SecurityAlgorithms.HmacSha256Signature, SecurityAlgorithms.Sha256Digest)
);
var tokenHandler = new JwtSecurityTokenHandler();
string tokenStr = tokenHandler.WriteToken(token);
我在Google或StackOverflow上没有找到太多关于这方面的信息,也没有想到还有多少其他的方法可以尝试。它是否依赖于需要安装的某些外部资源或包?我已经确保安装了OpenSSL
似乎是相关的,但我没有使用Katana或OpenID,这不是对称与非对称的问题。这一点。早在2015年就有报告,但不幸的是,截至目前(2017年9月),该问题仍未得到解决。。早在2015年就有报道,但不幸的是,截至目前(2017年9月),它还没有被修复。可以通过自己应用补丁来修复。谢谢。你可以自己使用补丁来修复。谢谢
System.InvalidOperationException : IDX10632: SymmetricSecurityKey.GetKeyedHashAlgorithm( 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' ) threw an exception.
SymmetricSecurityKey: 'System.IdentityModel.Tokens.InMemorySymmetricSecurityKey'
SignatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256', check to make sure the SignatureAlgorithm is supported.
Exception: 'System.NotSupportedException: Specified method is not supported.
at System.IdentityModel.Tokens.InMemorySymmetricSecurityKey.GetKeyedHashAlgorithm (System.String algorithm) <0x40200b40 + 0x0008b> in <filename unknown>:0
at System.IdentityModel.Tokens.SymmetricSignatureProvider..ctor (System.IdentityModel.Tokens.SymmetricSecurityKey key, System.String algorithm) <0x40200350 + 0x000c7> in <filename unknown>:0 '.
----> System.NotSupportedException : Specified method is not supported.