Guide
What JWT signature verification proves
By Logappradeep · ServiceNow developer
A JWT's signature is what makes its claims trustworthy. Verification recomputes or checks the signature over the token's header and payload using the right key, then compares it with the signature attached to the token. If it matches, two things are proven: the header and payload have not been modified since signing, and the token was created by someone who holds the signing key.
Symmetric and asymmetric verification
- HMAC (HS256, HS384, HS512): the verifier computes an HMAC over the first two segments, exactly as they appear in the token, using the shared secret, and compares it with the third segment. The comparison is done in constant time.
- RSA and ECDSA (RS256/384/512, PS256/384/512, ES256/384/512): the issuer signs with a private key, and anyone can verify with the matching public key. Paste the public key as a PEM block (
-----BEGIN PUBLIC KEY-----) or as a JWK object, such as one entry from your identity provider's JWKS endpoint.
The algorithm is read from the token header, and the key field changes to a secret or public key accordingly. Because verification works on the encoded text, even a change in whitespace inside the payload would produce a different signature.
What a valid signature does not prove
A green result answers only the integrity question. Before trusting a token, a server must also validate its claims:
expandnbf: an expired token still has a perfectly valid signature. This tool shows readable times and flags expired or not-yet-valid tokens.aud: the token must be intended for this service, not merely issued by a trusted party.iss: the issuer must be the one you expect, especially when several tenants share infrastructure.- Revocation: signatures cannot express that a user logged out or was disabled. That needs short lifetimes, a deny list, or session checks.
Verification pitfalls that cause real vulnerabilities
- The
alg: nonetrick. RFC 7519 permits unsecured tokens with an empty signature, and libraries that trusted the header'salgvalue have accepted forged tokens this way. This tool refuses to treat such tokens as verified; your server should explicitly configure which algorithms it accepts. - Algorithm confusion. If a service expecting RS256 lets the token choose HS256, an attacker can sign a token using the server's public key as the HMAC secret. Pin the algorithm per key.
- Non-constant-time comparison. Comparing HMAC signatures with ordinary string equality in server code can leak timing information. Use your crypto library's comparison function.
- Decoding instead of verifying. Some codebases call a decode function and never verify at all. Search for that pattern during code review.
Troubleshooting a failed check
For HMAC tokens, check whether the issuer uses a Base64-encoded secret (tick the Base64 option), and whether the secret picked up trailing spaces or a newline when copied. For RSA and EC tokens, make sure you pasted the public key that matches the token's kid, in SPKI PEM or JWK form; PKCS#1 RSA PUBLIC KEY blocks and certificates must be converted first.
Tokens and keys are processed with the browser's Web Crypto API and are never transmitted.