jose-jwk-pub 782 B

123456789101112131415
  1. #!/bin/bash -ex
  2. ioct='{"kty":"oct","k":"","a":"foo","key_ops":["encrypt","decrypt"]}'
  3. irsa='{"kty":"RSA","p":"","d":"","q":"","dp":"","dq":"","qi":"","oth":"","a":"bar","key_ops":["encrypt","decrypt"]}'
  4. iec='{"kty":"EC","d":"","a":"baz","key_ops":["encrypt","decrypt"]}'
  5. ijwkset="{\"keys\":[$ioct,$irsa,$iec]}"
  6. ooct='{"a":"foo","key_ops":[],"kty":"oct"}'
  7. orsa='{"a":"bar","key_ops":["encrypt"],"kty":"RSA"}'
  8. oec='{"a":"baz","key_ops":["encrypt"],"kty":"EC"}'
  9. ojwkset="{\"keys\":[$ooct,$orsa,$oec]}"
  10. test "`echo $ioct | jose jwk pub -i-`" == "$ooct"
  11. test "`echo $irsa | jose jwk pub -i-`" == "$orsa"
  12. test "`echo $iec | jose jwk pub -i-`" == "$oec"
  13. test "`echo $ijwkset | jose jwk pub -i-`" == "$ojwkset"
  14. test "`echo $iec | jose jwk pub -i- -s`" == "{\"keys\":[$oec]}"