Skip to content
OddsockLocal
Local
Source text

Formatting

1 wordsRuns in this browser. Nothing is uploaded.

How to use

  1. Choose Signing algorithm. HS256 is the start.
  2. Paste the HMAC secret, or a PKCS#8 private PEM for RS256, PS256, ES256 or EdDSA.
  3. Paste a JSON object as the payload. Add exp yourself if you need one.
  4. Copy the token. Check it on the decoder with the same HMAC secret.

What is JWT signer?

The signer builds a JWT from a JSON object and a key. Algorithm defaults to HS256. Payload {"sub":"alice","name":"Ada"} and HMAC secret some secret produce eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhbGljZSIsIm5hbWUiOiJBZGEifQ.Nqb6ie-8gcMIXEPIIKNgKXLK5E11SoIbasJHr4o0J3g. The header is typ JWT and alg HS256. Additional header JSON is merged in, and alg is set from the algorithm control so a conflicting alg in that object does not win.

Read more

RS256, PS256, ES256 and EdDSA want a PKCS#8 private PEM in the same secret field, not a passphrase. The public key is not written next to the token. Verification of those algorithms is not offered on the decoder; only HMAC tokens can be checked there. An empty secret fails. The payload has to be a JSON object, so a bare array or a plain string is rejected.

The secret does not leave the tab. A signed token is still only as private as the places you paste it. Header extensions crit and b64 false are rejected. exp is not added for you. If the token should expire, put a numeric exp in the payload yourself.

Use cases

  • A test wants an HS256 token for sub alice that the decoder will mark valid under the secret some secret.
  • You need to see the three segments before a unit test hard-codes the wrong shape.
  • An EdDSA or ES256 test has a PKCS#8 private key and needs a compact JWT, not a certificate.
  • A payload must include exp because the signer will not invent an expiry.

HS256 for alice

Algorithm HS256. Secret some secret. Payload {"sub":"alice","name":"Ada"}. Additional header JSON {}.

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhbGljZSIsIm5hbWUiOiJBZGEifQ.Nqb6ie-8gcMIXEPIIKNgKXLK5E11SoIbasJHr4o0J3g

Why use Oddsock

alg comes from the algorithm control. A header object that tries to claim a different algorithm does not get to re-label the signature.

Related tools

Using this tool

The payload you type is the payload that is signed. {"sub":"alice","name":"Ada"} has no exp, so the decoder reports expired null. Add exp as a numeric Unix time if the token should expire.