Asp.Net Core JWTの検証にX509SecurityKeyを使用するにはどうしたらいいですか?Asp.Net Core JWTの検証にX509SecurityKeyを使用するにはどうすればよいですか?
私の現在のコードは、おおよそ次のとおりです。
のsignatureAlgorithm: 'HS256'、SecurityKeyこれは、例外が発生し
new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256)
署名資格情報の後に
X509SecurityKey signingKey = null;
using (X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine))
{
store.Open(OpenFlags.ReadOnly);
var v = store.Certificates.Find(X509FindType.FindByTimeValid, DateTime.Now, true);
var v1 = v.Find(X509FindType.FindBySubjectDistinguishedName, strCertName, true);
signingKey = new X509SecurityKey(v1[0]);
}
と... : 'Microsoft.IdentityModel.Tokens.X509SecurityKey' はサポートされていません。 Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateProviderで Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateForSigningで(SecurityKeyキー、文字列アルゴリズム、ブールwillCreateSignatures) (SecurityKeyキー、文字列アルゴリズム)
私はいくつかのアルゴリズムを試してみましたが、それは彼らのいずれかと動作するようには思われません?
類似の問題を参照してください。https://github.com/IdentityServer/IdentityServer4/issues/61問題は署名アルゴリズムに関するものです。 –