diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2017-08-26 17:16:26 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-08-28 08:31:50 +0200 |
commit | 3f820afa67c0702a893c4fefa6f21483e99db45c (patch) | |
tree | ca61313f0ed56628791b943d19060d155d3529a1 | |
parent | 1e6c88455500353592d5430ab38d7da51277265b (diff) | |
download | gnutls-3f820afa67c0702a893c4fefa6f21483e99db45c.tar.gz |
tests: added unit test of p11tool with --set-pin
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rwxr-xr-x | tests/suite/testpkcs11.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/suite/testpkcs11.sh b/tests/suite/testpkcs11.sh index 8692756644..289564c44e 100755 --- a/tests/suite/testpkcs11.sh +++ b/tests/suite/testpkcs11.sh @@ -716,6 +716,24 @@ test_sign () { echo ok } +# This tests the signing operation as well as the usage of --set-pin +test_sign_set_pin () { + pin="$2" + token="$1" + + unset GNUTLS_PIN + + echo -n "* Testing signatures using the private key and --set-pin... " + ${P11TOOL} ${ADDITIONAL_PARAM} --login --set-pin ${pin} --test-sign "${token};object=serv-key" >>"${TMPFILE}" 2>&1 + if test $? != 0; then + echo "failed. Cannot test signatures." + exit_error + fi + echo ok + + export GNUTLS_PIN=${pin} +} + # $1: token # $2: PIN # $3: certfile @@ -838,6 +856,8 @@ write_certificate_id_test_rsa "${TOKEN}" "${GNUTLS_PIN}" "${srcdir}/pkcs11-certs write_certificate_id_test_rsa2 "${TOKEN}" "${GNUTLS_PIN}" "${srcdir}/pkcs11-certs/ca.key" "${srcdir}/pkcs11-certs/ca.crt" write_certificate_id_test_ecdsa "${TOKEN}" "${GNUTLS_PIN}" "${srcdir}/pkcs11-certs/ca.key" "${srcdir}/pkcs11-certs/ca.crt" +test_sign_set_pin "${TOKEN}" "${GNUTLS_PIN}" + if test ${RETCODE} = 0; then echo "* All smart cards tests succeeded" fi |