jose-jwk-gen.1.adoc 2.7 KB

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