我正在使用c#.NET創建JWT令牌。我有我自己的私鑰作爲XML。我需要將它作爲函數signingCredentials的參數之一傳遞。我的代碼如下所示:智威湯遜 - 如何將PrivateKey傳遞給「SigningCredentials」來構建SecurityTokenDescriptior?
var securityTokenDescriptor = new SecurityTokenDescriptor()
{
Subject = new ClaimsIdentity(List),
Audience = "Audi",
Issuer = "Issr",
Expires = 5,
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Key), Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature),
};
想知道如何將私鑰傳遞給SigningCredentials。
我有我自己的私鑰作爲標籤RSAKeyValue之間的xml文件。
謝謝。
我沒有任何證書。我只有私鑰。 – Sudhan