【发布时间】:2017-06-11 17:08:28
【问题描述】:
对于基于令牌的身份验证,Microsoft.IdentityModel.Tokens 提供了可用于创建 SigningCredentials 的安全算法列表:
string secretKey = "MySuperSecretKey";
byte[] keybytes = Encoding.ASCII.GetBytes(secretKey);
SecurityKey securityKey = new SymmetricSecurityKey(keybytes);
SigningCredentials signingCredentials =
new SigningCredentials(securityKey,
SecurityAlgorithms.HmacSha256);
SigningCredentials signingCredentials =
new SigningCredentials(securityKey,
SecurityAlgorithms.HmacSha256Signature);
HmacSha256 和 HmacSha256Signature 有什么区别?您什么时候会使用签名一号而不是非签名一号?**
还有其他“非签名”和“签名”算法。例如,RsaSha256 和 RsaSha256Signature
【问题讨论】:
标签: c# encryption cryptography jwt