summaryrefslogtreecommitdiff
path: root/tests/cert-tests/template-test
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-11-12 12:04:04 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-09-05 14:06:39 +0200
commit9d611a25515d92311576ac3e5a911859ed6e82de (patch)
tree1adaec2a9e9e42093522a8cb665698cb074f13bd /tests/cert-tests/template-test
parent1c256f4034b5ce305494aefa47d54035a41887a4 (diff)
downloadgnutls-9d611a25515d92311576ac3e5a911859ed6e82de.tar.gz
tests: verify that unique IDs are generated as expectedgnutls_3_3_x-unique-id
Diffstat (limited to 'tests/cert-tests/template-test')
-rwxr-xr-xtests/cert-tests/template-test28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/cert-tests/template-test b/tests/cert-tests/template-test
index 8bbc9115a0..873f7d0c98 100755
--- a/tests/cert-tests/template-test
+++ b/tests/cert-tests/template-test
@@ -22,6 +22,7 @@
srcdir=${srcdir:-.}
CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
+DIFF="${DIFF:-diff}"
export TZ="UTC"
@@ -226,6 +227,7 @@ fi
rm -f tmp-tt.pem
+
# Test the GeneralizedTime support
if test "$(getconf LONG_BIT)" = "64"; then
@@ -257,4 +259,30 @@ rm -f tmp-tt.pem
fi
+# Test unique ID field generation
+
+rc=1
+counter=1
+
+while [ "${rc}" != "0" -a $counter -le 3 ]; do
+ datefudge "2007-04-22" \
+ "${CERTTOOL}" --generate-self-signed \
+ --load-privkey "${srcdir}/template-test.key" \
+ --template "${srcdir}/template-unique.tmpl" \
+ --outfile tmp-tt.pem 2>/dev/null
+
+ ${DIFF} "${srcdir}/template-unique.pem" tmp-tt.pem >/dev/null 2>&1
+ rc=$?
+ test ${rc} != 0 && sleep 3
+ counter=`expr $counter + 1`
+done
+
+# We're done.
+if test "${rc}" != "0"; then
+ echo "Test 9 (unique ID) failed"
+ exit ${rc}
+fi
+
+rm -f tmp-tt.pem
+
exit 0