jose-jwk-gen 948 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash -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": "AQE" }'
  18. jose jwk gen -i '{ "kty": "oct", "bytes": 32 }'
  19. ##
  20. ### Test the key types we can't generate
  21. ##
  22. ! jose jwk gen -i '{"alg": "dir"}'
  23. ##
  24. ### Test the set output option
  25. ##
  26. jose jwk gen -s -i '{ "kty": "EC", "crv": "P-256" }' \
  27. | jose fmt -j- -Og keys -A \
  28. -l -j 1 -EUU \
  29. -g 0 -O \
  30. -g kty -q EC -EUU \
  31. -g crv -q P-256 -EUU