我已经使用ssh-keygen创建了公钥和私钥
$ ssh-keygen -t rsa -b 4096 -f jwtRS256.key
$ openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
尝试使用它:
//payload
var payload = new Dictionary<string, object>()
{
{ "sub", "mr.x@contoso.com" },
{ "exp", 1300819380 }
};
var key = File.ReadAllBytes(@"C:\Users\ravimodi\jwtRS256.key");
string token11 = Jose.JWT.Encode(payload, key, JweAlgorithm.RSA_OAEP, JweEncryption.A256GCM);
并得到错误:
RsaKeyManagement alg期望密钥为RSACryptoServiceProvider类型