summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-11-29 08:34:33 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-11-29 16:27:41 +0100
commitd1c558dc81c9da53dc47f284b81aa4fa22aa3877 (patch)
tree8e0f9cd317c09b4e4bc1cdddff5fb0ffcd496e96
parent6f4bb1cdbe7b4ad0c2f0a80af56ea96ebcd2060d (diff)
downloadgnutls-d1c558dc81c9da53dc47f284b81aa4fa22aa3877.tar.gz
tests: check whether PKCS #11 ID set on copy/generation is correct
-rwxr-xr-xtests/suite/testpkcs1112
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/suite/testpkcs11 b/tests/suite/testpkcs11
index 83c77740fa..5d0520a7ef 100755
--- a/tests/suite/testpkcs11
+++ b/tests/suite/testpkcs11
@@ -119,7 +119,7 @@ generate_rsa_privkey () {
bits=$3
echo -n "* Generating RSA private key ($bits)... "
- $P11TOOL $ADDITIONAL_PARAM --login --label gnutls-client --generate-rsa --bits $bits "$token" --outfile tmp-client.pub >>$TMPFILE 2>&1
+ $P11TOOL $ADDITIONAL_PARAM --login --id 000102030405 --label gnutls-client --generate-rsa --bits $bits "$token" --outfile tmp-client.pub >>$TMPFILE 2>&1
if test $? = 0;then
echo ok
else
@@ -238,7 +238,7 @@ write_certificate_test () {
fi
echo -n "* Writing client certificate... "
- $P11TOOL $ADDITIONAL_PARAM --login --write --label gnutls-client --load-certificate tmp-client.crt "$token" >>$TMPFILE 2>&1
+ $P11TOOL $ADDITIONAL_PARAM --login --write --id "01a1b103" --label gnutls-client --load-certificate tmp-client.crt "$token" >>$TMPFILE 2>&1
if test $? = 0;then
echo ok
else
@@ -246,6 +246,14 @@ write_certificate_test () {
exit_error
fi
+ echo -n "* Checking whether ID was correctly set... "
+ $P11TOOL $ADDITIONAL_PARAM --login --list-certs "$token;object=gnutls-client;object-type=private;id=%01%a1%b1%03" 2>&1 | grep 'ID: 01:a1:b1:03' >>$TMPFILE 2>&1
+ if test $? != 0;then
+ echo "ID was not set on copy"
+ exit_error
+ fi
+ echo ok
+
echo -n "* Writing certificate of client's CA... "
$P11TOOL $ADDITIONAL_PARAM --login --ca --write --trusted --label gnutls-ca --load-certificate "$cacert" "$token" >>$TMPFILE 2>&1
ret=$?