diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-03-31 17:24:37 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-03-31 17:24:39 +0200 |
commit | 3cb04539e733ba7c212401781a177e0ee93f336d (patch) | |
tree | 490a7e823d85040a0301c561b19b8c060ca00b25 /tests/cert-tests/md5-test | |
parent | f6c92f8a6d974066a6f66f5358ecf815b7747a5e (diff) | |
download | gnutls-3cb04539e733ba7c212401781a177e0ee93f336d.tar.gz |
tests: added check of verification using MD5 with and without --verify-allow-broken
This tests certtool and whether it fails verification of MD5 chains
with no --verify-allow-broken, or whether it succeeds if given.
Diffstat (limited to 'tests/cert-tests/md5-test')
-rwxr-xr-x | tests/cert-tests/md5-test | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/cert-tests/md5-test b/tests/cert-tests/md5-test new file mode 100755 index 0000000000..a904b2911e --- /dev/null +++ b/tests/cert-tests/md5-test @@ -0,0 +1,58 @@ +#!/bin/sh + +# Copyright (C) 2006-2016 Free Software Foundation, Inc. +# Copyright (C) 2016 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}" +TMPFILE=md5.$$.tmp +export TZ="UTC" + +# Check for datefudge +TSTAMP=`datefudge "2006-09-23" date -u +%s || true` +if test "$TSTAMP" != "1158969600"; then + echo $TSTAMP + echo "You need datefudge to run this test" + exit 77 +fi + +# Test MD5 signatures + +datefudge -s "2016-04-15" \ + "${CERTTOOL}" --verify-chain --infile "${srcdir}/chain-md5.pem" >/dev/null 2>&1 +rc=$? +if test "${rc}" != "1"; then + echo "Test 1 (verification of RSA-MD5) failed" + exit ${rc} +fi + +datefudge -s "2016-04-15" \ + "${CERTTOOL}" --verify-allow-broken --verify-chain --infile "${srcdir}/chain-md5.pem" >/dev/null 2>&1 +rc=$? +if test "${rc}" != "0"; then + echo "Test 2 (verification of RSA-MD5 with allow-broken) failed" + exit ${rc} +fi + +rm -f "${TMPFILE}" + +exit 0 |