LanguageEnglish
Build →

Learn · QuorumAuth

What is a JWKS?

A JWKS, or JSON Web Key Set, is a JSON document listing the public keys a relying party uses to verify an issuer's signed tokens.

Updated

Checking a token with a JWKS

  1. Token header names kid → Look up kid in cache
  2. Look up kid in cache → Key type fits alg?found
  3. Look up kid in cache ↔ Refetch set oncemissing / retry
  4. Key type fits alg? → Verify signature, then claims

A token header names its key ID. The verifier looks the kid up in its cached JWKS. If the kid is missing, it refetches the set once. It then checks that the key type and algorithm fit the token, and verifies the signature followed by the iss, aud, exp and nbf claims.

The verifier picks the key by its kid and refetches the set only once when it meets an unknown kid.

When an API receives a signed JWT, it needs the issuer’s public key to check the signature. Hard-coding that key works until the issuer rotates it. A JSON Web Key Set solves the distribution problem: the issuer publishes its current public keys at a well-known URL in a standard format, and verifiers fetch and cache them, picking the right key by its identifier.

How a JWKS works

The format is defined in RFC 7517, JSON Web Key. A JWKS is a JSON object with a keys array. Each entry is a JWK describing one key.

{
  "keys": [
    {
      "kty": "RSA",
      "kid": "2026-10-a",
      "use": "sig",
      "alg": "RS256",
      "n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbf...",
      "e": "AQAB"
    },
    {
      "kty": "OKP",
      "crv": "Ed25519",
      "kid": "2026-10-b",
      "use": "sig",
      "x": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"
    }
  ]
}

The common members:

Member Meaning
kty Key type: RSA, EC, or OKP (for Ed25519, defined in RFC 8037)
kid Key ID; the verifier matches it against the token header
use Intended use: sig for signatures, enc for encryption
alg Algorithm the key is meant for, such as RS256 or ES256
n, e RSA modulus and exponent, base64url-encoded
crv, x, y Curve and coordinates for EC; crv and x for OKP

Verification step by step

  1. Read the token header, for example {"alg":"RS256","kid":"2026-10-a"}.
  2. Look up kid in the cached JWKS.
  3. If it is missing, refetch the JWKS once and look again.
  4. Check that the key’s type and alg fit the token’s alg.
  5. Verify the signature, then the claims: iss, aud, exp, nbf.

Where the JWKS lives

Issuers advertise the URL as jwks_uri in their OIDC discovery document or RFC 8414 metadata. Clients that authenticate with a JWT client assertion can also publish their own JWKS for the authorization server to fetch. SPIFFE trust bundles for JWT-based identities use the same shape.

Key rotation with a JWKS

A JWKS makes rotation routine:

  1. Publish the new key alongside the old one.
  2. Wait for verifier caches to pick it up.
  3. Start signing with the new key.
  4. Retire the old key after the last token it signed has expired.

During the overlap both keys verify. A verifier that refetches on an unknown kid picks up the new key on first sight. That routine is what auditors ask regulated teams to show: see rotatable signing keys for fintech teams.

Rotating a signing key

  1. Publish new key beside old → Wait for caches
  2. Wait for caches → Sign with new key
  3. Sign with new key → Retire old key laterold tokens expired

Four steps in order. Publish the new key alongside the old one. Wait for verifier caches to pick it up. Start signing with the new key. Retire the old key after the last token it signed has expired.

During the overlap both keys verify, so no valid token fails while the new key takes over.

When you need a JWKS

You need one whenever more than one party verifies tokens you sign: OpenID Connect ID tokens, JWT access tokens checked by resource servers, or service tokens verified across a fleet. If only one service ever verifies, a shared configuration may suffice, but a JWKS still makes rotation easier.

Pitfalls

  • Ignoring kid. Trying every key in the set invites algorithm confusion and slows verification.
  • Trusting the token’s alg blindly. Decide which algorithms you accept; never accept none, and never let a token switch an RSA key to HMAC.
  • Refetching on every request. Cache the set. Refetch on an unknown kid, with a rate limit so forged tokens cannot make you hammer the issuer. If verification already fails, see fixing “kid not found”.
  • Fetching from an untrusted location. Take the jwks_uri from configuration or authenticated discovery, never from the token itself.
  • Private material in the set. A JWKS that includes d or other private members is a key leak.
  • Removing old keys too early. Tokens signed with them fail before they expire.

How QuorumAuth handles a JWKS

QuorumAuth publishes and consumes key sets for the tokens it signs. In its tested behaviour:

  • Publication. The signing-key API returns the active keys as a JWKS, and each published key answers to a key ID of its own. Key classes that are not meant to be published never reach it, even when rotated.
  • Per-organization OIDC keys. Each organization acting as an OpenID Provider advertises a jwks_uri holding exactly the keys it publishes.
  • Lazy fetch and cache. The SDK fetches keys on first verification and serves later verifications for the same organization from cache. A known key ID is answered without contacting the authority; an unrecognised one costs exactly one discovery round-trip.
  • Forged tokens stay cheap. A forged token is refused on the key it names, without fetching more.
  • Fail closed. Discovery refuses a key set carrying private key material, refuses a peer that is not the expected authority, and resolver construction fails when the discovery endpoint is unreachable.
  • Format. Ed25519 keys are published in the RFC 7517 OKP shape with the raw public key as unpadded base64url. During a rotation window old and new keys both resolve; afterwards only the new key does.

Each organization gets its own signing keys. See per-organization keys and what you own.

What is the difference between a JWK and a JWKS?

A JWK is one key as a JSON object. A JWKS is an object with a keys array holding one or more JWKs.

Where do I find an issuer's JWKS?

OpenID Providers advertise it as jwks_uri in their discovery document. OAuth servers publishing RFC 8414 metadata use the same field.

Should a JWKS ever contain private keys?

Never in a public set. Private JWKs exist in the format, but a published JWKS must hold public keys only.

How often should I refetch a JWKS?

Cache it, respect HTTP caching headers, and refetch when a token names a kid you do not hold, with a rate limit.

Talk to sales about QuorumAuth.

QuorumAuth is sold through our sales team. The Build page shows the drop-in sign-in on your origin and how to reach sales about your stack.

Go to Build and contact sales →