aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSahana Prasad <sahana@redhat.com>2020-05-14 16:30:29 +0200
committerSahana Prasad <sahana@redhat.com>2020-05-20 12:49:29 +0200
commitd3f7b64579a2b3d357900a10e5329f2d3bb30985 (patch)
tree5725cd0015a5bab9360bcd334f7a7aa4d28fefc4 /tests
parent7de9722d23c43c631439aed79ab6dbb49736e4a8 (diff)
downloadlibssh-d3f7b64579a2b3d357900a10e5329f2d3bb30985.tar.gz
libssh-d3f7b64579a2b3d357900a10e5329f2d3bb30985.tar.xz
libssh-d3f7b64579a2b3d357900a10e5329f2d3bb30985.zip
tests/pkcs11/setup-softhsm-tokens.sh: updates the script to handle LOADPUBLIC parameter.
Signed-off-by: Sahana Prasad <sahana@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/pkcs11/setup-softhsm-tokens.sh22
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/pkcs11/setup-softhsm-tokens.sh b/tests/pkcs11/setup-softhsm-tokens.sh
index 4aca191c..532c86a7 100755
--- a/tests/pkcs11/setup-softhsm-tokens.sh
+++ b/tests/pkcs11/setup-softhsm-tokens.sh
@@ -5,7 +5,8 @@
TESTDIR=$1
PRIVKEY=$2
OBJNAME=$3
-shift 3
+LOADPUBLIC=$4
+shift 4
PUBKEY="$PRIVKEY.pub"
@@ -13,6 +14,7 @@ echo "TESTDIR: $TESTDIR"
echo "PRIVKEY: $PRIVKEY"
echo "PUBKEY: $PUBKEY"
echo "OBJNAME: $OBJNAME"
+echo "LOADPUBLIC: $LOADPUBLIC"
# Create temporary directory for tokens
install -d -m 0755 $TESTDIR/db
@@ -54,15 +56,17 @@ cat $PUBKEY
ls -l $TESTDIR
+if [ $LOADPUBLIC -ne 0 ]; then
#load public key
-cmd='p11tool --provider /usr/lib64/pkcs11/libsofthsm2.so --write --load-pubkey "$PUBKEY" --label "$OBJNAME" --login --set-pin=1234 "pkcs11:token="$OBJNAME""'
-eval echo "$cmd"
-out=$(eval $cmd)
-ret=$?
-if [ $ret -ne 0 ]; then
- echo "Loading pubkey failed"
- echo "$out"
- exit 1
+ cmd='p11tool --provider /usr/lib64/pkcs11/libsofthsm2.so --write --load-pubkey "$PUBKEY" --label "$OBJNAME" --login --set-pin=1234 "pkcs11:token="$OBJNAME""'
+ eval echo "$cmd"
+ out=$(eval $cmd)
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "Loading pubkey failed"
+ echo "$out"
+ exit 1
+ fi
fi
cmd='p11tool --list-all --login "pkcs11:token="$OBJNAME"" --set-pin=1234'