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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
set -e
source helpers.sh
start_up
CRYPTO_PROFILE="RSA"
setup_fapi $CRYPTO_PROFILE
function cleanup {
tss2 delete --path=/
shut_down
}
trap cleanup EXIT
KEY_PATH=HS/SRK/myRSACrypt
# DESCRIPTION_SET=$TEMP_DIR/set_description.file
DESCRIPTION_FILE=$TEMP_DIR/object_description.file
DESCRIPTION_SET="description data"
tss2 provision
tss2 createkey --path=$KEY_PATH --type="noDa, restricted, decrypt" \
--authValue=""
tss2 setdescription --path=$KEY_PATH --description="$(echo $DESCRIPTION_SET)"
tss2 getdescription --path=$KEY_PATH --description=$DESCRIPTION_FILE --force
if [ "$(< $DESCRIPTION_FILE)" != "$DESCRIPTION_SET" ]; then
echo "Descriptions not equal"
exit 1
fi
expect <<EOF
# Try with missing path
spawn tss2 setdescription --description=$DESCRIPTION_SET
set ret [wait]
if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
Command has not failed as expected\n"
exit 1
}
EOF
# Try with missing description, should set description to empty
tss2 setdescription --path=$KEY_PATH
tss2 getdescription --path=$KEY_PATH --description=$DESCRIPTION_FILE --force
if [ "$(< $DESCRIPTION_FILE)" != "" ]; then
echo "Description is not empty"
exit 1
fi
expect <<EOF
# Try with missing path
spawn tss2 getdescription --description=$DESCRIPTION_FILE
set ret [wait]
if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
Command has not failed as expected\n"
exit 1
}
EOF
expect <<EOF
# Try with missing description
spawn tss2 getdescription --path=$KEY_PATH
set ret [wait]
if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
Command has not failed as expected\n"
exit 1
}
EOF
exit 0
|