0

I want to implement jwks key with Identityserver4 for jwks endpoint, I've already checked alot of articles but no one can solve my requirement Here's is my requirement.

RSA encryption key with a 3072-bit key

{
"kty": "RSA",
"use": "enc",
"kid": "enc-2021-01-15T12:09:06Z",
"e": "xxxxx",
"n": "xxxxx",
"alg": "RSA-OAEP-256"
}
DDNL
  • 1
  • 2

1 Answers1

0

I typically use OpenSSL to generate the keys and I use the script below to generate a private key and then together with a self signed certificate, place it in a PKCS12 file (.pfx).

Then import the .pfx file in .NET and use the Identityserver AddSigningCredential method to add it to the JWKS endpoint.

For example this code loads a cert into .NET Core:

    private static SecurityKey LoadRsaKey()
    {
        var rsaCert = new X509Certificate2("rs256.pfx", "edument");
        SecurityKey rsaPrivateKey = new RsaSecurityKey(rsaCert.GetRSAPrivateKey());
        return rsaPrivateKey;
    }
Tore Nestenius
  • 16,431
  • 5
  • 30
  • 40