相关疑难解决方法(0)

带有 BouncyCastle-PCL 的 C# PCL HMACSHAX

我想在可移植的 C# 类中实现这个逻辑:

static JsonWebToken()
        {
            HashAlgorithms = new Dictionary<JwtHashAlgorithm, Func<byte[], byte[], byte[]>>
            {
                { JwtHashAlgorithm.HS256, (key, value) => { using (var sha = new HMACSHA256(key)) { return sha.ComputeHash(value); } } },
                { JwtHashAlgorithm.HS384, (key, value) => { using (var sha = new HMACSHA384(key)) { return sha.ComputeHash(value); } } },
                { JwtHashAlgorithm.HS512, (key, value) => { using (var sha = new HMACSHA512(key)) { return sha.ComputeHash(value); } } }
            };
        }
Run Code Online (Sandbox Code Playgroud)

但是HMACSHA256HMACSHA384并且HMACSHA512在便携式库中不存在。

首先我尝试使用https://github.com/AArnott/PCLCrypto 但我总是得到: …

c# bouncycastle portable-class-library

2
推荐指数
1
解决办法
2084
查看次数

标签 统计

bouncycastle ×1

c# ×1

portable-class-library ×1