これを使おうとしているクラスcoreclr プロジェクトで SHA256Managed の正しいパッケージが見つからないようです。System.Security.Cryptography.Algorithms": "4.0.0-beta-23409" を使用しようとしましたが、SHA2565Managed の実装が含まれていません。coreclr でハッシュ値を計算するための他の方法はありますか?
ベストアンサー1
SHA256.Create()
名前空間から使用できますSystem.Security.Cryptography
(組み立て:System.Security.Cryptography.Algorithms
)
using (var algorithm = SHA256.Create())
{
// Create the at_hash using the access token returned by CreateAccessTokenAsync.
var hash = algorithm.ComputeHash(Encoding.ASCII.GetBytes(response.AccessToken));
// Note: only the left-most half of the hash of the octets is used.
// See http://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken
identity.AddClaim(JwtRegisteredClaimNames.AtHash, Base64UrlEncoder.Encode(hash, 0, hash.Length / 2));
}