Any way to create a JWT token with key size 512? and changing default minimum size requirement of AsymmetricSignatureProvider

后端 未结 1 499
不思量自难忘°
不思量自难忘° 2021-01-25 21:38

I am currently getting following error:

IDX10630: The \'Microsoft.IdentityModel.Tokens.RsaSecurityKey, KeyId: \'...\', InternalId: \'5a946596-9fe6-4c91-8c

相关标签:
1条回答
  • 2021-01-25 22:21

    Following is the solution i have used

    var mainclass = typeof(AsymmetricSignatureProvider)
                           .GetField(nameof(AsymmetricSignatureProvider.DefaultMinimumAsymmetricKeySizeInBitsForSigningMap), BindingFlags.Public | BindingFlags.Static);
                    var field = mainclass.GetValue(null) as Dictionary<string, int>;
                    if (field != null)
                    {
                        field["RS256"] = 512;
    
                    }
    
                    var mainclass2 = typeof(AsymmetricSignatureProvider).GetField(nameof(AsymmetricSignatureProvider.DefaultMinimumAsymmetricKeySizeInBitsForVerifyingMap), BindingFlags.Public | BindingFlags.Static);
                    var field2 = mainclass2.GetValue(null) as Dictionary<string, int>;
                    if (field2 != null)
                    {
                        field2["RS256"] = 512;
                    }
    
    0 讨论(0)
提交回复
热议问题