/// <summary> /// Converts the JWKs to a list of <see cref="RSACryptoServiceProvider"/>. /// The JWKs are being downloaded directly from the link provided in /// the OIDC Discovery Document. /// </summary> /// <returns>List of RSACryptoServiceProviders</returns> private static List <RSACryptoServiceProvider> GetRSACryptoServiceProvider() { JsonWebKeyIndex jsonWebKeyIndex = WebClientUtility.GetJsonWebKeyIndex(); List <RSACryptoServiceProvider> providers = new List <RSACryptoServiceProvider>(); jsonWebKeyIndex.Keys.ForEach(jsonWebToken => { RSACryptoServiceProvider provider = new RSACryptoServiceProvider(); provider.ImportParameters(new RSAParameters { Exponent = ConversionUtility.Base64UrlDecode(jsonWebToken.Exponent), Modulus = ConversionUtility.Base64UrlDecode(jsonWebToken.Modulus) }); providers.Add(provider); }); return(providers); }