summaryrefslogtreecommitdiff
path: root/tests/cert-tests/cert-time
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-04-07 14:42:10 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-04-07 14:42:10 +0200
commite6d2e4309e02a610c50d97147f8659f00a0eb346 (patch)
tree533c23c3549008cca21629311989f021985654f1 /tests/cert-tests/cert-time
parent54dc00cbd2d28239a345a948269b277a4f4aab13 (diff)
downloadgnutls-tmp-increase-tests.tar.gz
tests: added checks with certificates that contain invalid time fieldtmp-increase-tests
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests/cert-tests/cert-time')
-rwxr-xr-xtests/cert-tests/cert-time46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/cert-tests/cert-time b/tests/cert-tests/cert-time
new file mode 100755
index 0000000000..6ee2a226e6
--- /dev/null
+++ b/tests/cert-tests/cert-time
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Copyright (C) 2017 Red Hat, Inc.
+#
+# This file is part of GnuTLS.
+#
+# GnuTLS is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# GnuTLS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GnuTLS; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+#set -e
+
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
+DIFF="${DIFF:-diff -b -B}"
+
+if ! test -x "${CERTTOOL}"; then
+ exit 77
+fi
+
+if ! test -z "${VALGRIND}"; then
+ VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
+fi
+
+# Check whether certificates with invalid time fields are accepted
+for file in invalid-date-hour.der invalid-date-mins.der invalid-date-secs.der invalid-date-month.der invalid-date-day.der;do
+ ${VALGRIND} "${CERTTOOL}" --inder -i --infile "${srcdir}/data/$file"
+ rc=$?
+
+ if test "${rc}" = "0";then
+ echo "file $file was accepted"
+ exit 1
+ fi
+done
+
+exit 0