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