fapi-testing-template_ecc.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. set -e
  2. source helpers.sh
  3. start_up
  4. CRYPTO_PROFILE="ECC"
  5. setup_fapi $CRYPTO_PROFILE
  6. function cleanup {
  7. # If this test is successful, no keys are created. Thus, command below will
  8. # always fail
  9. tss2 delete --path=/ || true
  10. shut_down
  11. }
  12. trap cleanup EXIT
  13. PW=abc
  14. PLAIN_TEXT=$TEMP_DIR/plaintext.file
  15. KEY_PATH="HS/SRK/myRSACrypt"
  16. ENCRYPTED_FILE=$TEMP_DIR/encrypted.file
  17. VERSION_FILE=$TEMP_DIR/version.file
  18. echo -n "Secret Text!" > $PLAIN_TEXT
  19. expect <<EOF
  20. # Try with wrong help argument
  21. spawn tss2 provision -h abc
  22. set ret [wait]
  23. if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
  24. Command has not failed as expected\n"
  25. exit 1
  26. }
  27. EOF
  28. tss2 provision -h man
  29. tss2 provision -h no-man
  30. tss2 provision -v
  31. expect <<EOF
  32. # Try with wrong option
  33. spawn tss2 provision -abcdef
  34. set ret [wait]
  35. if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
  36. Command has not failed as expected\n"
  37. exit 1
  38. }
  39. EOF
  40. tss2 getrandom -v > $VERSION_FILE
  41. VERSION=$(cat $VERSION_FILE | cut -d'=' -f 4)
  42. size=${#VERSION}
  43. if [ $size -ge 129 ]; then
  44. echo "Error: Version length greater than 128 characters" ; exit 1
  45. fi
  46. exit 0