← All 187 books jwt, one field per page
One field per page

jwt, one field per page

Twenty-eight lessons on the fields of a JSON Web Token: the shape fields typ, cty, b64 and crit, which say what the object is and what a reader must understand; alg, kid, jku and jwk, the signing math and the routes to the key; x5u, x5c, x5t and epk, the certificate roads and the one-time key; enc, zip, apu and apv, the fields of the sealed side; exp, nbf, iat and auth_time, the clocks of the pass; iss, sub, aud and jti, who issued it, whose it is, who may read it and which copy this is; and nonce, azp, at_hash and scope, the relying-party fields, with every claim traced to the RFC text, the registries or a real check run on this machine, one field per page and one honest hour.


Steve Hodgkiss 7 lessons

One field, one page, one honest check. That is the shape of this book.

jwt, one field per page

Twenty-eight lessons on the fields of a JSON Web Token: the shape fields typ, cty, b64 and crit, which say what the object is and what a reader must understand; alg, kid, jku and jwk, the signing math and the routes to the key; x5u, x5c, x5t and epk, the certificate roads and the one-time key; enc, zip, apu and apv, the fields of the sealed side; exp, nbf, iat and auth_time, the clocks of the pass; iss, sub, aud and jti, who issued it, whose it is, who may read it and which copy this is; and nonce, azp, at_hash and scope, the relying-party fields, with every claim traced to the RFC text, the registries or a real check run on this machine, one field per page and one honest hour.


Set in Space Grotesk, Inter and JetBrains Mono (SIL Open Font License).

An honest book about its demos: Python 3.14.9 signed and verified an HS256 token with hmac on the machine that built this book, and rejected a tampered payload, an alg=none token and an expired token; OpenSSL 3.0.13 cross-checked the same HMAC digest (they matched) and later signed and verified the same header and payload as an RS256 token with throwaway 2048-bit RSA keys and a throwaway self-signed certificate. Every quoted token, command and verdict was captured in /root/.hermes/cache/web/slot187park/jwt_demo_log1.txt through jwt_demo_log4.txt and is quoted verbatim from those files; nothing outside the scratch and cache dirs was written, and no output was invented. The demo secret is a throwaway label: no real secret, key or production token appears anywhere, and no server, browser or encrypted token was involved. This book teaches verification and hygiene, not production security advice. Every other fact traces to the cached RFC texts (7514-7520, 8725, 9068, 6749), the IANA JOSE header parameter and JSON Web Token Claims registries, the OpenID Connect Core 1.0 spec and the cached Wikipedia articles; no facts from Reddit, Stack Overflow, vendor blogs or commercial sites. Every practice exercise carries 'this book's plan'. Independent, not affiliated with the Internet Engineering Task Force, the OpenID Foundation or the Wikimedia Foundation.

Your purchase is for personal use only. You do not have redistribution rights: please do not share, resell, or republish this book or its pages.

© 2026 Steve Hodgkiss. All rights reserved. Personal use only; no redistribution rights.

Edition 1.0 · stevehodgkiss.net

Contents

Contents


Part 1 · Saying what it is
crit4
Part 2 · Choosing the math, finding the key
jku5
Part 3 · Certificates and one-time keys
epk6
Part 4 · The sealed side
apv7
Part 5 · The clocks
auth_time8
Part 6 · Who the token speaks for
sub9
Part 7 · The relying-party fields
scope10

Per the RFC 7515 specification, The "crit" (critical) Header Parameter indicates that extensions to this specification and/or [JWA] are being used that MUST be understood and processed; Its value is an array listing the Header Parameter names present in the JOSE Header that use those extensions; If any of the listed extension Header Parameters are not understood and supported by the recipient, then the JWS is invalid; Producers MUST NOT use the empty list "[]" as the "crit" value; Unless listed as a critical Header Parameter, per Section 4.1.11, all Header Parameters not defined by this specification MUST be ignored when not understood; {"alg":"ES256","crit":["exp"],"exp":1363284000}. Per the IANA JOSE header parameter registry, crit | Critical | JWS | IESG | RFC 7515, Section 4.1.11.

jwt companion · No. 01
the critical list

crit

the fields a reader must not shrug off

crit: extension fields the reader is not allowed to shrug atJOSE Header"crit":["exp"]unlisted field: ignoredlisted field: must be knownthe gate has teeth:not understood, not acceptedan empty crit list is illegal{"alg":"ES256","crit":["exp"],"exp":1363284000}the spec's own example: one extension, named in the listsilence means ignore; crit means understand or refuse

Unknown header fields get the shrug: all Header Parameters not defined by this specification MUST be ignored when not understood. crit cancels it: it means extensions to this specification and/or [JWA] are being used that MUST be understood.

Its value is an array listing the Header Parameter names in the header that use those extensions; if one is not understood, then the JWS is invalid - and never empty.

The spec's example names one extension, exp at 1363284000: understand it, or refuse the token.

ONE HONEST CHECK

Which of your custom fields would be dangerous if a reader ignored it?

Per the RFC 7515 specification, The "jku" (JWK Set URL) Header Parameter is a URI [RFC3986] that refers to a resource for a set of JSON-encoded public keys, one of which corresponds to the key used to digitally sign the JWS; The protocol used to acquire the resource MUST provide integrity protection; the identity of the server MUST be validated, as per Section 6 of RFC 6125 [RFC6125]; Use of this Header Parameter is OPTIONAL. Per the RFC 8725 specification, blindly following a "jku" (JWK set URL) or "x5u" (X.509 URL) header, which may contain an arbitrary URL, could result in server-side request forgery (SSRF) attacks; Applications SHOULD protect against such attacks, e.g., by matching the URL to a whitelist of allowed locations and ensuring no cookies are sent in the GET request. Per the IANA JOSE header parameter registry, jku | JWK Set URL | JWS | IESG | RFC 7515, Section 4.1.2; jku | JWK Set URL | JWE | IESG | RFC 7516, Section 4.1.4. Per this book's plan, the demo never followed a jku, and this book gives no production advice beyond quoting the spec's rules and the BCP's warning.

jwt companion · No. 02
the key-set URL

jku

a URL pointing at the signer's keys

jku: the header says where the key set lives, and how to fetch itjkuTLSa JWK Set,one key matchesany host theattacker picksblind follow: SSRFidentity validated per RFC 6125; fetchwithout cookies; a whitelist of hostsjku | JWK Set URL | JWSOPTIONAL to send, dangerous to obey unthinkinglythe URL arrives inside the signature, but points outside it

Per RFC 7515, jku is a URI [RFC3986] that refers to a resource for a set of JSON-encoded public keys, one of which signed this token.

The fetch is locked down: The protocol used to acquire the resource MUST provide integrity protection, and the identity of the server MUST be validated. RFC 8725 is blunter: blindly following a "jku" header could result in server-side request forgery (SSRF) attacks.

Per this book's plan, the demo never followed one: rules quoted, nothing run.

ONE HONEST CHECK

If your verifier fetched keys, whose allowlist would decide the URL?

Per the RFC 7518 specification, The "epk" (ephemeral public key) value created by the originator for the use in key agreement algorithms; This key is represented as a JSON Web Key [JWK] public key value; It MUST contain only public key parameters and SHOULD contain only the minimum JWK parameters necessary to represent the key; This Header Parameter MUST be present and MUST be understood and processed by implementations when these algorithms are used. Per the RFC 8725 specification, Elliptic Curve Diffie-Hellman Ephemeral Static (ECDH-ES) ephemeral public key (epk) inputs should be validated according to the recipient's chosen elliptic curve. Per the IANA JOSE header parameter registry, epk | Ephemeral Public Key | JWE | IESG | RFC 7518, Section 4.6.1.1. Per the RFC 7515 specification, JWSs and JWEs share a common Header Parameter space; when a parameter is used by both specifications, its usage must be compatible between the specifications. Per this book's plan, this book ran no ECDH key agreement, so the epk page quotes the specifications and shows no run line.

jwt companion · No. 03
the ephemeral key

epk

a fresh public key, minted for one token

epk: a key with a one-token lifespan, sent in the headerthe originator"epk"the protected headerpublic parametersonly, minimum onlythe receivercombines it withits own private halfthe point must lie on thechosen curve: check inputsephemeral: minted for thismessage, useful for hoursa fresh public key is a small key with no past

Per RFC 7518, epk is the ephemeral public key created by the originator for the use in key agreement algorithms, shipped as a JSON Web Key [JWK] public key value.

Where it applies, MUST be present and MUST be understood and processed; the registry row sits under JWE at RFC 7518, Section 4.6.1.1.

Attacker-visible, so RFC 8725 guards it: epk inputs should be validated according to the recipient's chosen elliptic curve.

ONE HONEST CHECK

Could a fresh one-time key replace your standing shared secret?

Per the RFC 7518 specification, The "apv" (agreement PartyVInfo) value for key agreement algorithms using it (such as "ECDH-ES"), represented as a base64url encoded string; When used, the PartyVInfo value contains information about the recipient; Use of this Header Parameter is OPTIONAL; This Header Parameter MUST be understood and processed by implementations when these algorithms are used. Per the IANA JOSE header parameter registry, apv | Agreement PartyVInfo | JWE | IESG | RFC 7518, Section 4.6.1.3. Per the RFC 7515 specification, JWSs and JWEs share a common Header Parameter space; when a parameter is used by both specifications, its usage must be compatible between the specifications. Per this book's plan, apu and apv are shown as a matched pair across the agreement, one naming each side, the pairing drawn from the two quoted definitions.

jwt companion · No. 04
party V info

apv

who asked for it, mixed into the key

apv: the other side of the same agreementthe producerthe recipient"apu""apv"one derivation,two party values inPartyU about the sender, PartyV about the receiver;both base64url, both optional, both load-bearingthe recipient half of the pair earns its V

Per RFC 7518, apv is the agreement PartyVInfo, likewise represented as a base64url encoded string; where apu names the sender, it carries information about the recipient. The V half of the pair.

Both halves ride in the header so both sides re-derive one key; alter either and the derivations diverge. Its use is OPTIONAL; its understanding is not.

Per this book's plan, the two fields are one handshake seen twice, and the registry names this row Agreement PartyVInfo.

ONE HONEST CHECK

Whose name belongs in a derived key: the sender's, the reader's, both?

Per the OpenID Connect Core 1.0 specification, auth_time: Time when the End-User authentication occurred; Its value is a JSON number representing the number of seconds from 1970-01-01T00:00:00Z as measured in UTC until the date/time; When a max_age request is made or when auth_time is requested as an Essential Claim, then this Claim is REQUIRED; otherwise, its inclusion is OPTIONAL; The auth_time Claim semantically corresponds to the OpenID 2.0 PAPE. Per the IANA JSON Web Token Claims registry, auth_time | Time when the authentication occurred | OpenID Foundation Artifact Binding Working Group | OpenID Connect Core 1.0, Section 2. Per a real run on the build machine captured at dispatch, payload keys : sub, name, iat, exp. Per this book's plan, the demo token was minted by a script, not by a person logging in, so no auth_time appears among its payload keys.

jwt companion · No. 05
the login time

auth_time

when the human actually signed in

auth_time: the login's clock, kept apart from the file'sauth_timethe loginiatthe mintingmax_age measures the gap"auth_time": 1311280969the spec's example ID tokencarries it as a JSON numberasked with max_age, or marked Essential,the claim is REQUIRED; otherwise OPTIONALa fresh file over a stale sign-instill says the old loginthe token knows when it was made; this knows when you showed up

Per OpenID Connect Core, auth_time is the Time when the End-User authentication occurred, counted exactly like iat: seconds from 1970-01-01T00:00:00Z as measured in UTC.

Its duty is the login's freshness, not the file's: When a max_age request is made, auth_time is REQUIRED; otherwise, its inclusion is OPTIONAL. A token minted now from a session signed in hours ago says so here, not in iat.

Per this book's plan, a script minted the demo token, so its payload keys carry no auth_time to read.

ONE HONEST CHECK

For your longest-lived sessions, when did the person last really sign in?

Per the RFC 7519 specification, The "sub" (subject) claim identifies the principal that is the subject of the JWT; The claims in a JWT are normally statements about the subject; The subject value MUST either be scoped to be locally unique in the context of the issuer or be globally unique. Per the RFC 8725 specification, when the JWT contains a "sub" (subject) claim, the application MUST validate that the subject value corresponds to a valid subject and/or issuer-subject pair at the application. Per the Wikipedia JSON Web Token article, a server could generate a token that has the claim "logged in as administrator" and provide that to a client. Per the Wikipedia Claims-based identity article, A claim is a statement that one subject, such as a person or organization, makes about itself or another subject. Per the IANA JSON Web Token Claims registry, sub | Subject | IESG | RFC 7519, Section 4.1.2. Per a real run on the build machine captured at dispatch, verify valid token : VERIFIED sub=user-42; payload : {"sub":"user-42","name":"Demo User","iat":1795870594,"exp":1795874194}; payload keys : sub, name, iat, exp.

jwt companion · No. 06
the subject

sub

whose story the claims tell

sub: the row the other claims all speak about"sub":"user-42""name":"Demo User""iat""exp"validate the pairissuer + subjectVERIFIED sub=user-42payload keys : sub, name, iat, expscoped locally, or globally unique: the id must resolvesub is who the story is about; the rest of the payload agrees

Per RFC 7519, sub identifies the principal that is the subject of the JWT, and the other claims are normally statements about the subject.

That value MUST either be scoped to be locally unique in the context of the issuer or be globally unique. Wikipedia's example carries an admin-claim token; the demo said "sub":"user-42", and the verifier echoed VERIFIED sub=user-42.

RFC 8725 closes the loop: MUST validate that the subject value corresponds to a valid subject - the id, not just the claim.

ONE HONEST CHECK

What is the smallest value in your system that names a person uniquely?

Per the RFC 9068 specification, If an authorization request includes a scope parameter, the corresponding issued JWT access token SHOULD include a "scope" claim as defined in Section 4.2 of [RFC8693]; All the individual scope strings in the "scope" claim MUST have meaning for the resources indicated in the "aud" claim; "scope": "openid profile reademail". Per the IANA JSON Web Token Claims registry, scope | Scope Values | IESG | RFC 8693, Section 4.2; Created 2015-01-23; Last Updated 2026-10-28. Per the Wikipedia OAuth article, OAuth is a service that is complementary to and distinct from OpenID. Per the Wikipedia Access token article, an access token contains the security credentials for a login session and identifies the user, the user's groups, the user's privileges.

jwt companion · No. 07
the scope list

scope

what the bearer may actually ask for

scope: the ask of the authorization request, kept in the credentialthe request asked:openid profile reademail"scope": "openid profile reademail"the issued token records the answeropenidprofilereademailthe strings must MEAN somethingat the resources aud namesScope Values, IESG change control,the RFC 8693 definition the profile points atthe last field read: what you are allowed to do, spelled out

Per RFC 9068, when the request asks for scopes, the issued access token SHOULD include a "scope" claim, as defined in RFC 8693; the example is blunt: "scope": "openid profile reademail" - the ask, written into the credential.

Two pins hold the field: the registry row reads Scope Values under IESG control, and RFC 9068 ties it to the audience - each string MUST have meaning for the resources indicated in the "aud" claim.

Twenty-eight fields, one habit: check the signature, read what the token says it is for, then believe it.

ONE HONEST CHECK

List one token's scopes today; does each string mean something at its aud?

Index

Index


apv7
auth_time8
crit4
epk6
jku5
scope10
sub9