1
0

jose-jwk-gen 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh -ex
  2. ALGS=`jose alg -k sign -k wrap -k encr | grep -v '^dir$'`
  3. ##
  4. ### Generate a key for every supported algorithm
  5. ##
  6. for a in $ALGS; do
  7. jose jwk gen -i "{\"alg\": \"$a\"}"
  8. done
  9. ##
  10. ### Generate a key for each parameter
  11. ##
  12. jose jwk gen -i '{ "kty": "EC", "crv": "P-256" }'
  13. jose jwk gen -i '{ "kty": "EC", "crv": "P-384" }'
  14. jose jwk gen -i '{ "kty": "EC", "crv": "P-521" }'
  15. jose jwk gen -i '{ "kty": "RSA", "bits": 3072 }'
  16. ! jose jwk gen -i '{ "kty": "RSA", "bits": 3072, "e": 257 }'
  17. ! jose jwk gen -i '{ "kty": "RSA", "bits": 3072, "e": 65536 }'
  18. ! jose jwk gen -i '{ "kty": "RSA", "bits": 3072, "e": 65537 }'
  19. ! jose jwk gen -i '{ "kty": "RSA", "bits": 3072, "e": "AQE" }' # 257.
  20. jose jwk gen -i '{ "kty": "RSA", "bits": 3072, "e": "AQAB"}' # 65537.
  21. jose jwk gen -i '{ "kty": "oct", "bytes": 32 }'
  22. ##
  23. ### Test the key types we can't generate
  24. ##
  25. ! jose jwk gen -i '{"alg": "dir"}'
  26. ##
  27. ### Test the set output option
  28. ##
  29. jose jwk gen -s -i '{ "kty": "EC", "crv": "P-256" }' \
  30. | jose fmt -j- -Og keys -A \
  31. -l -j 1 -EUU \
  32. -g 0 -O \
  33. -g kty -q EC -EUU \
  34. -g crv -q P-256 -EUU