Skip to content

JWT signature verifier

Check a JWT’s signature against a shared secret, a PEM public key or certificate, a JWK, or a whole JWKS such as a Keycloak realm’s certs endpoint.

Runs in your browser. Nothing you paste is sent to us.

Token

A sample RS256 token for the made-up realm acme is filled in, with its key set.

RS256kid sample-acme-rs256

Key

For a Keycloak realm, paste the JSON from https://<host>/realms/<realm>/protocol/openid-connect/certs.

A valid signature is only the first check. Also check exp, nbf, iss and aud with the claims validator.

How to use it

  1. Paste the token.
  2. Paste the key: a secret, a PEM key or certificate, one JWK, or a JWKS.
  3. With a JWKS, the tool picks the key whose kid and type fit the token.
  4. Read the result: verified, or invalid with the key that was tried.

What to know

The signature proves that the holder of the key issued the token and that nobody changed it since. The tool supports HS, RS, PS and ES algorithms with SHA-256, 384 and 512, and EdDSA where your browser supports Ed25519.

A Keycloak realm publishes its public keys at https://<host>/realms/<realm>/protocol/openid-connect/certs. The kid in a token’s header names the key that signed it.

Tokens with alg none are refused outright: an unsigned token proves nothing.

What verifying a signature proves

A signed JWT carries a signature over its header and payload. Checking that signature with the right key proves two things: the token was created by someone who holds the signing key, and nobody changed a single byte of the header or payload since.

It proves nothing else. A token with a valid signature can still be expired, meant for another API, or issued by a realm you do not trust. Signature first, then claims: that is the order every resource server should follow.

How signature verification works

The verifier rebuilds the signing input, which is the first two parts of the token joined by a dot, exactly as received. It decodes the third part from Base64url into the signature bytes. Then it runs the algorithm named in the header with the key.

FamilyKey to verify withHow it checks
HS256/384/512The same shared secretComputes the HMAC and compares
RS256/384/512RSA public keyRSASSA-PKCS1-v1_5 verify
PS256/384/512RSA public keyRSASSA-PSS verify, salt length equal to the hash size
ES256/384/512EC public key on P-256, P-384, P-521ECDSA verify of the raw r and s values
EdDSAEd25519 public keyEd25519 verify

With asymmetric algorithms, only the private key can sign but anyone with the public key can verify. That is why identity providers publish their public keys and keep the private ones.

A detail about ECDSA

JWS stores ECDSA signatures as the two numbers r and s back to back, each padded to the curve size (RFC 7518, section 3.4). Some libraries produce DER-encoded signatures instead. A DER signature pasted into a JWT fails verification even when the key is right.

What this verifier accepts

  • A shared secret, written as text, Base64, Base64url or hex.
  • A PEM public key: BEGIN PUBLIC KEY or BEGIN RSA PUBLIC KEY.
  • A PEM certificate, from which it takes the public key.
  • A PEM private key, from which it uses only the public half.
  • A single JWK, or a whole JWKS such as a realm’s certs endpoint. With a set, it picks keys by kid, type, curve, alg and use.

Tokens that say alg: none are refused before any key is touched. All checks run with your browser’s Web Crypto. Nothing is sent to us.

How to verify a token

  1. Paste the token. The header badges show its alg and kid.
  2. Paste the key material. For a Keycloak realm, open https://<host>/realms/<realm>/protocol/openid-connect/certs in a browser and copy the whole JSON.
  3. Leave the key type on Detect, or choose it if detection guesses wrong.
  4. For a shared secret, choose the format it is written in.
  5. Read the result, then check the claims with the claims validator.

Verifying Keycloak tokens

Each Keycloak realm signs tokens with its active signing key, RS256 by default. The realm’s public keys are listed at the certs endpoint as a JWKS, and the realm’s discovery document at /realms/<realm>/.well-known/openid-configuration points to it as jwks_uri.

The kid in a token’s header matches the kid of one key in that set. You can see the same key ids in the admin console under Realm settings, Keys.

Other signature algorithms

A realm can sign with other algorithms. Add a key provider for them under Realm settings, Keys, Providers (for example an ECDSA provider for ES256), then choose the algorithm for the realm under Realm settings, Tokens, or per client in the client’s advanced settings. The certs endpoint then lists the new key too.

Refresh tokens

Keycloak signs refresh tokens with a realm HMAC key it never publishes. You cannot verify them here or in your own code, and you do not need to: only Keycloak reads them.

Use cases

Debugging “invalid signature” errors

When your API rejects tokens, verify one here against the realm’s certs JSON. If it passes here, your API is using the wrong keys, a stale cache, or the wrong algorithm. If it fails here too, the token came from somewhere else.

Checking a key rotation

After adding a new key in Keycloak, verify a fresh token against the certs endpoint. Then verify an older token. Both should pass while the old key is still listed.

Testing your own HMAC setup

Paste a test token and the test secret to confirm both sides agree on the secret format. Text and Base64 versions of the “same” secret are different bytes.

Common reasons verification fails

SymptomLikely cause
No key in the set fitsThe token’s kid is not in the set: another realm, another server, or a removed key
Invalid signature with the right kidThe token was changed, or truncated when copied
Needs a RSA key, but this key is ECThe key type does not match the token’s alg
Works with text secret, fails with Base64The secret format setting does not match how the secret is stored
Ed25519 key could not be loadedAn older browser without Ed25519 support in Web Crypto

A token copied from a terminal or a chat often picks up a line break or loses its last characters. If a genuine token fails, copy it again from the source.

Verifying in code

In production, a library does this on every request. The pattern is the same everywhere: point it at the issuer’s key set, pin the algorithm, and set the issuer and audience.

Verifying a token from the sample realm acme
// Node.js with the jose library
const jwks = createRemoteJWKSet(new URL(
  'https://auth.example.com/realms/acme/protocol/openid-connect/certs'));
const { payload } = await jwtVerify(token, jwks, {
  issuer: 'https://auth.example.com/realms/acme',
  audience: 'orders-api',
  algorithms: ['RS256'],
});

Use this tool to check single tokens by hand when the library’s error message is not enough.

If a token verifies here but not in your service, compare the service’s configured algorithm list and key source with what you pasted. The difference is almost always there.

Security notes

Two classic attacks target verifiers, not tokens. In the first, an attacker sends alg: none and hopes the verifier skips the check. In the second, an attacker signs with HS256 using the issuer’s public RSA key as the HMAC secret, hoping the verifier lets the token pick the algorithm.

Both fail when the verifier decides the algorithm from its own configuration and checks that the key type fits. This tool does both: it refuses none, and it refuses to use an RSA or EC key with an HMAC algorithm.

A public key or certificate is safe to paste. A shared secret is not public: use a test secret here.

Best practices for verifiers

  • Fetch keys from the issuer’s jwks_uri over HTTPS, cache them, and refresh the cache when a token arrives with an unknown kid.
  • Allow only the algorithms you expect, such as RS256.
  • Never use a key named by the token itself through jku, x5u or an embedded jwk.
  • After the signature, check exp, nbf, iss and aud every time.
  • Use a well-maintained library instead of writing the cryptography yourself.
Questions

Frequently asked questions

Where do I find the public key for a Keycloak realm?

At `https://<host>/realms/<realm>/protocol/openid-connect/certs`, which returns the realm’s JWKS. The admin console also shows each key under Realm settings, Keys, with buttons to copy the public key or certificate.

Why does verification fail with the right realm?

Common causes are a token from another realm or server, a key that was rotated out of the set, or a token changed or cut short after signing. Compare the token’s `kid` with the keys in the set.

Why can’t I verify a Keycloak refresh token?

Keycloak signs refresh tokens with a realm HMAC key that it does not publish. Only Keycloak can check them, and your app should treat them as opaque.

Is a verified signature enough to trust a token?

No. Also check that it has not expired (`exp`, `nbf`) and that `iss` and `aud` are what your app expects. A valid signature only proves who issued the token and that it is unchanged.

Can I verify with a certificate instead of a public key?

Yes. Paste the PEM certificate and the verifier uses the public key inside it. The certificate’s own expiry does not affect the signature check.

What is the difference between RS256 and PS256?

Both use RSA keys and SHA-256. RS256 uses PKCS #1 v1.5 padding, and PS256 uses PSS padding, which is randomized. A key pair can serve either, but the token’s `alg` must match how it was signed.

Is it safe to paste a key here?

Public keys and certificates are public by design. Shared secrets and private keys are not; the page never sends them anywhere, but use test material rather than production secrets.

Which algorithms are supported?

HS256, HS384, HS512, RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384, ES512, and EdDSA with Ed25519 in browsers that support it.

Why does an ES256 signature from my library fail here?

JWS needs the raw r and s values joined together, 64 bytes for ES256. Some libraries output a DER-encoded signature instead, which is longer and fails verification. Convert it, or use a JWT library that writes JWS format.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.