1JOSE-JWK-GEN(1) JOSE-JWK-GEN(1)
2
3
4
6 jose-jwk-gen - Creates a random JWK for each input JWK template
7
9 jose jwk gen -i JWK [-o JWK]
10
12 The jose jwk gen command generates a key from one or more JWK(Set)
13 templates. If a single template is given as input, a single JWK will be
14 output. However, if multiple templates are given as input, a single
15 JWKSet will be output containing all the keys.
16
17 The best way to generate a key is to specify the algorithm it will be
18 used with in the "alg" property of the JWK template. This method should
19 be preferred since, when generating from an algorithm, an appropriate
20 "key_ops" parameter will be emitted automatically. Further, having a
21 JWK with the algorithm already specified will assist algorithm
22 inference when encrypting or signing.
23
24 Alternatively, you can generate a key by specifying its key type
25 ("kty") JWK property, along with the required type-specific generation
26 parameter. See the examples below for how to do this for each key type.
27 If the type-specific generation parameter is non-standard (for example:
28 "bytes" and "bits"), it will be removed excluded from the output.
29
31 • -i JSON, --input=JSON : Parse JWK(Set) template from JSON
32
33 • -i FILE, --input=FILE : Read JWK(Set) template from FILE
34
35 • -i -, --input=- : Read JWK(Set) template from standard input
36
37 • -o FILE, --output=FILE : Write JWK(Set) to FILE
38
39 • -o -, --output=- : Write JWK(Set) to standard input
40
41 • -s, --set : Always output a JWKSet
42
44 Generate three keys, each targeting a different algorithm:
45
46 $ jose jwk gen -i '{"alg":"HS256"}' -o oct.jwk
47 $ jose jwk gen -i '{"alg":"RS256"}' -o rsa.jwk
48 $ jose jwk gen -i '{"alg":"ES256"}' -o ec.jwk
49
50 Generate three keys using key parameters rather than algorithms:
51
52 $ jose jwk gen -i '{"kty":"oct","bytes":32}' -o oct.jwk
53 $ jose jwk gen -i '{"kty":"RSA","bits":4096}' -o rsa.jwk
54 $ jose jwk gen -i '{"kty":"EC","crv":"P-256"}' -o ec.jwk
55
56 Create multiple keys at once using a JWKSet template:
57
58 $ jose jwk gen \
59 -i '{"keys":[{"alg":"HS256"},{"alg":"ES256"}]}' \
60 -o keys.jwkset
61
62 Create multiple keys at once using multiple JWK templates:
63
64 $ jose jwk gen \
65 -i '{"alg":"HS256"}' \
66 -i '{"alg":"ES256"}' \
67 -o keys.jwkset
68
70 Nathaniel McCallum <npmccallum@redhat.com>
71
73 jose-alg(1), jose-jwe-dec(1), jose-jwe-enc(1), jose-jwk-exc(1),
74 jose-jwk-pub(1), jose-jwk-thp(1), jose-jwk-use(1), jose-jws-sig(1),
75 jose-jws-ver(1),
76
77
78
79 01/20/2022 JOSE-JWK-GEN(1)