KEY2JWK(1)
β¨ KEY2JWK(1) β¨
okay bestie, welcome to key2jwk, part of the LibJWT C Library β yes, the manual page is literally named KEY2JWK(1) and it's giving key-to-JWK pipeline energy π
πΈ NAME πΈ
key2jwk β Generate a JSON Web Key Set π
π¦ SYNOPSIS π¦
key2jwk [options] <FILE> [FILE]...
β¨ DESCRIPTION β¨
okay so. key2jwk Generates a JSON Web Key Set from one or more keys in PEM or DER format. that's the whole job, and it does it flawlessly, no cap π
This program will parse PEM/DER key files (public and private) into JSON Web Keys and output a JWK Set. note that HMAC keys are guessed based on them not being parsed by OpenSSL. This may cause some issues π. You can disable this with the -m option. periodt.
HS256, HS384, and HS512 are assumed based on the key size and are expected to be a file with binary data. Using file size in bytes:
HS256: size >= 32 AND size < 48HS384: size >= 48 AND size < 64HS512: size >= 64
The -o options is required for output. If the file exists, it will not be overwritten. You can use --output - to write to stdout. If you write to stdout, all other messages will be written to stderr. π
RSA keys will not have an algorithm set as they are valid for RS256, RS384, and RS512, however, RSA-PSS keys will be set to PS256, since otherwise they will look no different than an RSA key. RSA keys must be at least 1024 bits. slay.
Private keys will have sign added to the key_ops array while public keys will have the use attribute set to sig. π
All keys will get a generated randomized uuidv4 kid attribute unless you use the -k option.
Example output:
$ key2jwk -q -o - eddsa_key_ed25519.pem
{
"libjwt.io:comment": "Generated by LibJWT 2.9.99",
"libjwt.io:date": "Sun Jan 12 23:50:24 2025",
"libjwt.io:hostname": "maClara.local",
"keys": [
{
"key_ops": [
"sign"
],
"kid": "d74a55b0-631a-4dfb-8842-cecfcb50e728",
"kty": "OKP",
"crv": "Ed25519",
"alg": "EdDSA",
"d": "XY5oUZqGWVZhX7J09hG-rRnAKXiw1g_aBh-Bc52KZ_Y"
}
]
}
π Options π
-h,--helpβ Show common options and quit. v helpful of it tbh π«Ά-l,--listβ List all supported algorithms that can be passed to the-aoption and quit. window shopping fr fr β¨-q,--quietβ Do not output anything except for hard errors (and the JWKS). main character silence π€«-k,--disable-kidβ Disable generatingkidattribute. no uuid for you π-m,--disable-hmacβ Disable falling back toHAMCfor key files that OpenSSL cannot read. (yes that's how it's spelled in the docs, iykyk π)-o FILE,--output=FILEβ UseFILEto write the JWKS. Use-to write to stdout. π₯
π BUGS π
See GitHub Issues: https://github.com/benmcollins/libjwt/issues
π AUTHOR π
key2jwk written by Ben Collins bcollins@libjwt.io.
π SEE ALSO π
jwt-verify(1), jwt-generate(1), jwk2key(1)
and that's the whole page bestie π this one's from the key2jwk User Manual, served fresh out of the LibJWT C Library, filed under KEY2JWK(1). go forth and generate your JWK Sets, you absolute icon π¦πΈπ
π¦ where this page comes from
- alpine 3.24: libjwt-doc 3.3.3-r0 Β· MPL-2.0
- ubuntu resolute: jwt-tools 3.2.3-1 Β· MPL-2.0
- ubuntu stonking: jwt-tools 3.3.3-1build1 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms