A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. It's a standardized way to describe public or private keys (symmetric or asymmetric) in a web-friendly format.
JWKs are fundamental to the JSON Web Token (JWT) ecosystem and are defined in RFC 7517.
A JWK is a JSON object with several members (key-value pairs) that describe the cryptographic key. Common parameters include:
kty (Key Type): REQUIRED. Identifies the cryptographic algorithm family used with the key. Common values include:
RSA for RSA keysEC for Elliptic Curve keysoct for Octet (symmetric) keysuse (Public Key Use): OPTIONAL. Indicates the intended use of the public key.
sig for signature verificationenc for encryptionkey_ops (Key Operations): OPTIONAL. Identifies the operation(s) for which the key is intended to be used. This is an array of strings (e.g., ["verify", "encrypt"]). This parameter is usually mutually exclusive with use for public keys.
alg (Algorithm): OPTIONAL. Identifies the specific cryptographic algorithm used with the key (e.g., RS256, ES256, A128GCM).
kid (Key ID): OPTIONAL, but highly RECOMMENDED. A unique identifier for the key. This is critical for key rotation, as the kid in a JWT header allows the verifying party to select the correct public key from a JWKS.
Key Type Specific Parameters: Depending on the kty value, additional parameters are present:
kty: "RSA"):n (modulus): Base64url-encoded modulus value for the RSA public key.e (exponent): Base64url-encoded exponent value for the RSA public key.kty: "EC"):crv (Curve): The elliptic curve name (e.g., P-256, P-384, P-521).x (X Coordinate): Base64url-encoded X coordinate for the Elliptic Curve public key.y (Y Coordinate): Base64url-encoded Y coordinate for the Elliptic Curve public key.kty: "oct"):k (Key Value): Base64url-encoded symmetric key value.x5c (X.509 Certificate Chain): OPTIONAL. An array of Base64-encoded X.509 certificates that can be used to verify the public key.
{
"kty": "RSA",
"kid": "my-rsa-signing-key-2025-06-27",
"use": "sig",
"alg": "RS256",
"n": "qL3U2eB1f_k-qJ2w...",
"e": "AQAB"
}
.well-known/jwks.jsonThe use of .well-known/jwks.json as an endpoint for JSON Web Key Sets (JWKS) is indeed a strong and widely adopted convention, specified by RFC 8615, "Well-Known Uniform Resource Identifiers (URIs)".
Here's why this convention exists and why it's generally preferred over a simple /jwks endpoint:
.well-known?The /.well-known/ URI prefix is a standardized way to designate a location on a web server for publishing server-specific information that clients can discover in a predictable manner. It's defined by RFC 8615.
The idea is that if a client (e.g., an application, a library, or even a human) needs to find a specific piece of information about a server (like its public keys, or a security policy), they know to look under the /.well-known/ path.
/.well-known/jwks.json is the ConventionStandardization and Discoverability:
/keys, /api/v1/jwks, /myAuthServer/publicKeys), forcing clients to be individually configured for each server, leading to significant complexity and integration headaches.Interoperability:
/.well-known/openid-configuration. This further solidifies /.well-known/jwks.json as the standard for key discovery in federated identity systems.Security Considerations:
/.well-known/ prefix clearly signals that the content served from this path is for machine-readable, widely discoverable metadata, often security-related./jwks?While technically https://your-auth-server.com/jwks would work, it misses the benefits of the /.well-known/ convention:
/.well-known/ would make your implementation non-compliant and hinder interoperability with standard OIDC clients.In essence, /.well-known/ is akin to a globally recognized address book entry for important server information. Using it for JWKS means your authorization server is immediately intelligible to any system that adheres to web standards for key discovery, making your application part of a much larger, more secure, and more interoperable ecosystem.