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) tem‐
13 plates. 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 infer‐
22 ence 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
32 Parse JWK(Set) template from JSON
33
34 -i FILE, --input=FILE
35 Read JWK(Set) template from FILE
36
37 -i -, --input=-
38 Read JWK(Set) template from standard input
39
40 -o FILE, --output=FILE
41 Write JWK(Set) to FILE
42
43 -o -, --output=-
44 Write JWK(Set) to standard input
45
46 -s, --set
47 Always output a JWKSet
48
50 Generate three keys, each targeting a different algorithm:
51
52
53
54 $ jose jwk gen -i ´{"alg":"HS256"}´ -o oct.jwk
55 $ jose jwk gen -i ´{"alg":"RS256"}´ -o rsa.jwk
56 $ jose jwk gen -i ´{"alg":"ES256"}´ -o ec.jwk
57
58
59
60 Generate three keys using key parameters rather than algorithms:
61
62
63
64 $ jose jwk gen -i ´{"kty":"oct","bytes":32}´ -o oct.jwk
65 $ jose jwk gen -i ´{"kty":"RSA","bits":4096}´ -o rsa.jwk
66 $ jose jwk gen -i ´{"kty":"EC","crv":"P-256"}´ -o ec.jwk
67
68
69
70 Create multiple keys at once using a JWKSet template:
71
72
73
74 $ jose jwk gen \
75 -i ´{"keys":[{"alg":"HS256"},{"alg":"ES256"}]}´ \
76 -o keys.jwkset
77
78
79
80 Create multiple keys at once using multiple JWK templates:
81
82
83
84 $ jose jwk gen \
85 -i ´{"alg":"HS256"}´ \
86 -i ´{"alg":"ES256"}´ \
87 -o keys.jwkset
88
89
90
92 Nathaniel McCallum <npmccallum@redhat.com>
93
95 jose-alg(1), jose-jwe-dec(1), jose-jwe-enc(1), jose-jwk-exc(1),
96 jose-jwk-pub(1), jose-jwk-thp(1), jose-jwk-use(1), jose-jws-sig(1),
97 jose-jws-ver(1),
98
99
100
101 June 2017 JOSE-JWK-GEN(1)