2
0

test_ucert.t 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. check that ucert is producing expected results:
  2. $ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
  3. $ export TEST_INPUTS="$TESTDIR/inputs"
  4. $ alias ucert='valgrind --quiet --leak-check=full ucert'
  5. $ ucert
  6. Usage: ucert <command> <options>
  7. Commands:
  8. -A:\t\t\tappend signature (needs -c and -x) (esc)
  9. -D:\t\t\tdump (needs -c) (esc)
  10. -I:\t\t\tissue cert and revoker (needs -c and -p and -s) (esc)
  11. -R:\t\t\tprocess revoker certificate (needs -c and -P) (esc)
  12. -V:\t\t\tverify (needs -c and -p|-P, may have -m) (esc)
  13. Options:
  14. -c <file>:\t\tcertificate file (esc)
  15. -m <file>:\t\tmessage file (verify only) (esc)
  16. -p <file>:\t\tpublic key file (esc)
  17. -P <path>:\t\tpublic key directory (verify only) (esc)
  18. -q:\t\t\tquiet (do not print verification result, use return code only) (esc)
  19. -s <file>:\t\tsecret key file (issue only) (esc)
  20. -x <file>:\t\tsignature file (append only) (esc)
  21. [1]
  22. $ ucert -D -c $TEST_INPUTS/key-build.ucert
  23. === CHAIN ELEMENT 01 ===
  24. signature:
  25. ---
  26. untrusted comment: signed by key 84bfc88a17166577
  27. RWSEv8iKFxZld+bQ+NTqCdDlHOuVYNw5Qw7Q8shjfMgFJcTqrzaqO0bysjIQhTadmcwvWiWvHlyMcwAXSix2BYdfghz/zhDjvgU=
  28. ---
  29. payload:
  30. ---
  31. "ucert": {
  32. \t"certtype": 1, (esc)
  33. \t"validfrom": 1546188410, (esc)
  34. \t"expiresat": 1577724410, (esc)
  35. \t"pubkey": "untrusted comment: Local build key\\nRWSEv8iKFxZld6vicE1icWhYNfEV9PM7C9MKUKl+YNEKB+PdAWGDF5Z9\\n" (esc)
  36. }
  37. ---
  38. $ ucert-san -D -c $TEST_INPUTS/key-build.ucert
  39. === CHAIN ELEMENT 01 ===
  40. signature:
  41. ---
  42. untrusted comment: signed by key 84bfc88a17166577
  43. RWSEv8iKFxZld+bQ+NTqCdDlHOuVYNw5Qw7Q8shjfMgFJcTqrzaqO0bysjIQhTadmcwvWiWvHlyMcwAXSix2BYdfghz/zhDjvgU=
  44. ---
  45. payload:
  46. ---
  47. "ucert": {
  48. \t"certtype": 1, (esc)
  49. \t"validfrom": 1546188410, (esc)
  50. \t"expiresat": 1577724410, (esc)
  51. \t"pubkey": "untrusted comment: Local build key\\nRWSEv8iKFxZld6vicE1icWhYNfEV9PM7C9MKUKl+YNEKB+PdAWGDF5Z9\\n" (esc)
  52. }
  53. ---
  54. $ ucert -D -c $TEST_INPUTS/invalid.ucert
  55. cert_dump(406): cannot parse cert
  56. [1]
  57. $ ucert-san -D -c $TEST_INPUTS/invalid.ucert
  58. cert_dump(406): cannot parse cert
  59. [1]