|
|
@@ -25,7 +25,7 @@ public class CredentialManager
|
|
|
_fido2 = fido2;
|
|
|
_optionsCache = optionsCache;
|
|
|
_jwtConfig = jwtOptions.Value;
|
|
|
- _rsa = ToRsa(_jwtConfig.Key!);
|
|
|
+ _rsa = KeyConverter.JwkToRsa(_jwtConfig.Key!);
|
|
|
|
|
|
_jsonOptions = new JsonSerializerOptions()
|
|
|
{
|
|
|
@@ -192,31 +192,5 @@ public class CredentialManager
|
|
|
return token;
|
|
|
}
|
|
|
|
|
|
- private RSA ToRsa(JsonWebKey key)
|
|
|
- {
|
|
|
- var rsaParameters = new RSAParameters
|
|
|
- {
|
|
|
- // PUBLIC KEY PARAMETERS
|
|
|
- // n parameter - public modulus
|
|
|
- Modulus = Base64UrlEncoder.DecodeBytes(key.N),
|
|
|
- // e parameter - public exponent
|
|
|
- Exponent = Base64UrlEncoder.DecodeBytes(key.E),
|
|
|
|
|
|
- // PRIVATE KEY PARAMETERS (optional)
|
|
|
- // d parameter - the private exponent value for the RSA key
|
|
|
- D = Base64UrlEncoder.DecodeBytes(key.D),
|
|
|
- // dp parameter - CRT exponent of the first factor
|
|
|
- DP = Base64UrlEncoder.DecodeBytes(key.DP),
|
|
|
- // dq parameter - CRT exponent of the second factor
|
|
|
- DQ = Base64UrlEncoder.DecodeBytes(key.DQ),
|
|
|
- // p parameter - first prime factor
|
|
|
- P = Base64UrlEncoder.DecodeBytes(key.P),
|
|
|
- // q parameter - second prime factor
|
|
|
- Q = Base64UrlEncoder.DecodeBytes(key.Q),
|
|
|
- // qi parameter - CRT coefficient of the second factor
|
|
|
- InverseQ = Base64UrlEncoder.DecodeBytes(key.QI)
|
|
|
- };
|
|
|
-
|
|
|
- return RSA.Create(rsaParameters);
|
|
|
- }
|
|
|
}
|