JSON Web Key (JWK): understand key types and usage fields
Learn what one JWK represents, how to read its main fields, and how to use a key only when its source and purpose are trusted.
JSON Web Key (JWK): understand key types and usage fields
A JSON Web Key (JWK) is a JSON representation of a cryptographic key. It does not create or validate a key; it carries key material and fields that describe its type and intended use. When configuring JWT signature verification, understand fields such as kty, use, key_ops, alg, and kid, but do not trust a key merely because its metadata looks plausible.
Key material and descriptive fields
Every JWK must include kty, the key type, such as RSA or EC. Required mathematical parameters depend on the type. For example, a public elliptic-curve key can include a curve name and public coordinates. A JWK can also represent symmetric or private key material, so a JWK is not necessarily public.
| Field | Meaning | Caution |
|---|---|---|
kty | Key family | Required; parameters vary by family. |
use | Intended public-key use | Optional; for example, sig or enc. |
key_ops | Permitted operations | Optional array, such as verify, sign, encrypt, or decrypt. |
alg | Intended algorithm | Optional; do not blindly follow a token header’s alg. |
kid | Key identifier | Helps select among keys; it is not proof of trust. |
RFC 7517 generally advises against using use and key_ops together; if both appear, they must be consistent. A kid is a lookup hint. Establish which key set to trust through a trusted authorization server, its metadata, or another independently verified distribution channel.
Using a JWK to verify a signature
For an OAuth JWT access token, a resource server can obtain jwks_uri from metadata for an already trusted issuer, then fetch its JWK Set. Select a public key whose kid, type, usage, and permitted algorithm fit the server’s policy. Verify the signature, then separately check issuer, audience, expiry, token type, and required permissions.
{
"kty": "EC", "crv": "P-256",
"x": "<public coordinate X>", "y": "<public coordinate Y>",
"use": "sig", "kid": "signing-key-2026-01"
}The values are placeholders, not usable key material. Use keys officially published by the issuer. A public key set should not expose private parameters such as d, p, or q, or a symmetric key value k. Protect private and symmetric key material from logs, public endpoints, repositories, and support requests.
Handle keys safely
Authenticate the key source. Do not fetch keys from an arbitrary URL supplied by a token or its `jku` header. Use trusted issuer metadata or another verified channel.
Match key and purpose. Follow the server’s algorithm allowlist; metadata and token headers must not override it.
Validate required structure and parameters according to the library and token profile, including handling of unsupported types or duplicate identifiers.
Keep public information separate from secrets. Protect private and symmetric material against unintended access.
Plan rotation. Publish replacement public keys and refresh verifier caches before removing old keys, accounting for existing token lifetimes and cache duration. Keep issuer validation in place.
JWK, JWKS, JWT, and JWS
A JWK represents one key. A JWK Set (JWKS) is a JSON object with a keys array. A JWT carries claims; JWS is a format for digitally signed or MAC-protected content. These formats have different roles and are not interchangeable.
References
[RFC 7517 — JSON Web Key (JWK)](https://www.rfc-editor.org/rfc/rfc7517.html)
[RFC 8414 §2 — OAuth Authorization Server Metadata](https://www.rfc-editor.org/rfc/rfc8414.html#section-2)
[RFC 9068 §4 — JWT Access Token Validation](https://www.rfc-editor.org/rfc/rfc9068.html#section-4)
[RFC 7515 — JSON Web Signature (JWS)](https://www.rfc-editor.org/rfc/rfc7515.html)