| .\" Automatically generated by Pandoc 3.1.11.1 | |
| .\" | |
| .TH "JWK2KEY" "1" "" "jwk2key User Manual" "LibJWT C Library" | |
| .SH NAME | |
| \f[B]jwk2key\f[R] \- Export JSON Web Keys to PKCS8 | |
| .SH SYNOPSIS | |
| .PP | |
| \f[B]jwk2key\f[R] \f[B][options]\f[R] <FILE> [FILE]\&... | |
| .SH DESCRIPTION | |
| \f[B]jwk2key\f[R] Takes JSON Web Key files and exports each key to a | |
| PKCS8 PEM file | |
| .PP | |
| This program will parse a JSON Web Key or Set and write out the | |
| individual files to DIR (by default `\f[B].\f[R]'). | |
| Output directory must exist. | |
| You should make sure the permissions on the output directory are such | |
| that they cannot be accessed by others. | |
| .PP | |
| JWK files must be listed after any options. | |
| A \f[B]\-\f[R] will be interpreted as \f[I]stdin\f[R]. | |
| .PP | |
| All \f[I]RSA\f[R] key types will be written as plain \f[I]RSA\f[R] keys, | |
| including \f[I]RSASSA\-PSS\f[R] keys, unless it has a \f[I]PS256\f[R], | |
| \f[I]PS384\f[R], or \f[I]PS512\f[R] \f[B]alg\f[R] attribute. | |
| .PP | |
| All keys are written in PKCS8 PEM format, except key type \f[I]OCT\f[R], | |
| which is written as a binary file (.bin extension). | |
| .PP | |
| By default, existing files will not be overwritten. | |
| If you use the \f[B]\-\-retry\f[R] option, an attempt will be made to | |
| add \-1 to the file name, up to \-9, in an attempt to create the file. | |
| .PP | |
| Output file naming is based on (hopefully) unique characteristics, | |
| including: | |
| .IP \[bu] 2 | |
| \f[B]Key type\f[R] E.g. | |
| \f[B]rsa\f[R], \f[B]ec\f[R], etc. | |
| .IP \[bu] 2 | |
| \f[B]Bits\f[R] in the key. | |
| E.g. | |
| 2048 for an \f[I]RSA\f[R] key, or 384 for an \f[I]EC\f[R] key. | |
| .IP \[bu] 2 | |
| \f[B]Private\f[R] vs \f[B]Public\f[R]. | |
| Public keys will have \f[B]_pub\f[R] added to the end of the filename | |
| (before the extension). | |
| .IP \[bu] 2 | |
| Most importantly, a stable per\-key identifier: the \f[B]kid\f[R] attribute | |
| if the key has one, otherwise its RFC 7638 JWK thumbprint. | |
| This keeps multiple keys of the same type that carry no \f[B]kid\f[R] from | |
| colliding on one file name. | |
| .SS Options | |
| .TP | |
| \f[B]\-h\f[R], \f[B]\-\-help\f[R] | |
| Show common options and quit. | |
| .TP | |
| \f[B]\-r\f[R], \f[B]\-\-retry\f[R] | |
| Retry if output file exists. | |
| .TP | |
| \f[B]\-d\f[R] \f[I]DIR\f[R], \f[B]\-\-dir\f[R]=\f[I]DIR\f[R] | |
| Directory to write key files to (default is `\f[B].\f[R]'). | |
| .SH EXIT STATUS | |
| .TP | |
| \f[B]0\f[R] | |
| Every key in every input file was written. | |
| .TP | |
| \f[B]1\f[R] | |
| An input file could not be read or parsed, or held no keys; or a key was | |
| skipped, did not load, or its file could not be created or fully | |
| written. | |
| The keys that do convert are still written. | |
| .PP | |
| Each key that is not written is reported on \f[B]stderr\f[R], naming the | |
| input file and the key (by index, and by \f[B]kid\f[R] when it has one) | |
| and the reason. | |
| The output \f[B]\-d\f[R] directory must already exist, be a directory, | |
| and be writable; this is checked before any input is read. | |
| .SH BUGS | |
| See GitHub Issues: \c | |
| .UR https://github.com/benmcollins/libjwt/issues | |
| .UE \c | |
| .SH AUTHOR | |
| \f[B]jwk2key\f[R] written by Ben Collins \c | |
| .MT bcollins@libjwt.io | |
| .ME \c | |
| \&. | |
| .SH SEE ALSO | |
| \f[B]jwt\-verify(1)\f[R], \f[B]jwt\-generate(1)\f[R], | |
| \f[B]key2jwk(1)\f[R] |