mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2024-09-20 03:10:09 +00:00
Add store binary data tests.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
3057aba041
commit
2ecfff0ebb
@ -28,3 +28,10 @@ test $? -eq 0 || {
|
||||
echo -e "\t${FAIL}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "==== Test binary storage ===="
|
||||
./tests/scripts/store_binary.sh
|
||||
test $? -eq 0 || {
|
||||
echo -e "\t${FAIL}"
|
||||
exit 1
|
||||
}
|
||||
|
28
tests/scripts/store_binary.sh
Executable file
28
tests/scripts/store_binary.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./tests/scripts/func.sh
|
||||
reset
|
||||
test $? -eq 0 || exit $?
|
||||
|
||||
TEST_DATA="Pico HSM is awesome!"
|
||||
|
||||
echo 'Pico HSM is awesome!' > data
|
||||
|
||||
echo -n " Test public binary storage..."
|
||||
pkcs11-tool --pin 648219 --write-object test --type data --id 1 --label 'test1' > /dev/null 2>&1
|
||||
test $? -eq 0 && echo -n "." || exit $?
|
||||
e=$(pkcs11-tool --read-object --type data --label 'test1' 2>&1)
|
||||
test $? -eq 0 && echo -n "." || exit $?
|
||||
grep -q "${TEST_DATA}" <<< $e && echo -e ".\t${OK}" || exit $?
|
||||
pkcs11-tool --pin 648219 --delete-object --type data --label 'test1' > /dev/null 2>&1
|
||||
|
||||
echo -n " Test private binary storage..."
|
||||
pkcs11-tool --pin 648219 --write-object test --type data --id 1 --label 'test1' --private > /dev/null 2>&1
|
||||
test $? -eq 0 && echo -n "." || exit $?
|
||||
e=$(pkcs11-tool --read-object --type data --label 'test1' --pin 648219 2>&1)
|
||||
test $? -eq 0 && echo -n "." || exit $?
|
||||
grep -q "${TEST_DATA}" <<< $e && echo -n "." || exit $?
|
||||
e=$(pkcs11-tool --read-object --type data --label 'test1' 2>&1)
|
||||
test $? -eq 1 && echo -n "." || exit $?
|
||||
grep -q "error: object not found" <<< $e && echo -e ".\t${OK}" || exit $?
|
||||
pkcs11-tool --pin 648219 --delete-object --type data --label 'test1' > /dev/null 2>&1
|
Loading…
Reference in New Issue
Block a user