diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-02-20 22:24:23 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-03-04 09:37:56 +0100 |
commit | ca35341243dc2ba13cd703d25becea5da293bc35 (patch) | |
tree | 839e016dfc09c2f9dee9a383396f818383163c8b /tests | |
parent | cab8a5ba7e8d5461aa2fc36459044e1c751e8b39 (diff) | |
download | gnutls-ca35341243dc2ba13cd703d25becea5da293bc35.tar.gz |
tests: added checks for invalid X.509 certificate signatures
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cert-tests/Makefile.am | 6 | ||||
-rwxr-xr-x | tests/cert-tests/invalid-sig | 52 | ||||
-rw-r--r-- | tests/cert-tests/invalid-sig2.pem | 37 | ||||
-rw-r--r-- | tests/cert-tests/invalid-sig3.pem | 38 |
4 files changed, 130 insertions, 3 deletions
diff --git a/tests/cert-tests/Makefile.am b/tests/cert-tests/Makefile.am index 33d7e32cf5..c4fe11039e 100644 --- a/tests/cert-tests/Makefile.am +++ b/tests/cert-tests/Makefile.am @@ -27,11 +27,11 @@ EXTRA_DIST = ca-no-pathlen.pem no-ca-or-pathlen.pem aki-cert.pem \ template-overflow.tmpl template-overflow2.pem template-overflow2.tmpl \ template-date.tmpl template-date.pem template-dn-err.tmpl \ template-nc.tmpl template-nc.pem xmpp-othername.pem \ - suppressions.valgrind csr-invalid.der + suppressions.valgrind csr-invalid.der invalid-sig2.pem invalid-sig3.pem -dist_check_SCRIPTS = pathlen aki template-test pem-decoding dane crq certtool +dist_check_SCRIPTS = pathlen aki template-test pem-decoding dane crq certtool invalid-sig -TESTS = pathlen aki pem-decoding certtool +TESTS = pathlen aki pem-decoding certtool invalid-sig if ENABLE_NON_SUITEB_CURVES TESTS += crq diff --git a/tests/cert-tests/invalid-sig b/tests/cert-tests/invalid-sig new file mode 100755 index 0000000000..bf2e0540b9 --- /dev/null +++ b/tests/cert-tests/invalid-sig @@ -0,0 +1,52 @@ +#!/bin/sh + +# Copyright (C) 2015 Nikos Mavrogiannopoulos +# +# Author: Nikos Mavrogiannopoulos +# +# 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} +if ! test -z "${VALGRIND}";then +VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}" +fi + +#check whether a different tbsCertificate than the outer signature algorithm is tolerated +$VALGRIND $CERTTOOL -e --infile $srcdir/invalid-sig2.pem +rc=$? + +# We're done. +if test "$rc" = "0"; then + echo "Verification of invalid signature (2) failed" + exit $rc +fi + +#check whether a different tbsCertificate than the outer signature algorithm is tolerated +$VALGRIND $CERTTOOL -e --infile $srcdir/invalid-sig3.pem +rc=$? + +# We're done. +if test "$rc" = "0"; then + echo "Verification of invalid signature (3) failed" + exit $rc +fi + +exit 0 diff --git a/tests/cert-tests/invalid-sig2.pem b/tests/cert-tests/invalid-sig2.pem new file mode 100644 index 0000000000..69163e2590 --- /dev/null +++ b/tests/cert-tests/invalid-sig2.pem @@ -0,0 +1,37 @@ +-----BEGIN CERTIFICATE----- +MIICwzCCAXugAwIBAgIIVOei+gI+zMYwDQYJKoZIhvcNAQELBQAwGTEXMBUGA1UE +AxMOR251VExTIFRlc3QgQ0EwIhgPMjAxNTAyMjAyMTExMjJaGA85OTk5MTIzMTIz +NTk1OVowFzEVMBMGA1UEAxMMV3Jvbmcgc2lnYWxnMIGfMA0G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L +dKY2cobGs/ojYtOjcs0KnlPYdmtjEh6WEhuJU95v4TQdC4OLMiE56eIGq252hZAb +HoTL84Q14DxQWGuzQK830iml7fbw2WcIcRQ8vFGs8SzfXw63+MI6Fq6iMAQIqP08 +WzGmRRzL5wvCiPhCVkrPmwbXoABub6AAsYwWPJB91M9/lx5gFH5k9/iPfi3s2Kg3 +F8MOcppqFYjxDSnsfiz6eMh1+bYVIAo367vGVYHigXMEZC2FezlwIHaZzpEoFlY3 +a7LFJ00yrjQ910r8UE+CEMTYzE40D0olCMo7FA9RCjeO3bUIoYaIdVTUGWEGHWSe +oxGei9Gkm6u+ASj8f+i0jxdD2qXsewIDAQABo0MwQTAPBgNVHRMBAf8EBTADAQH/ +MA8GA1UdDwEB/wQFAwMHBgAwHQYDVR0OBBYEFE1Wt2oAWPFnkvSmdVUbjlMBA+/P +MA0GCSqGSIb3DQEBCwUAA4IBMQAesOgjGFi1zOYpA/N3gkUVRcBHDxmN7g2yOcqH +VfhFc+e4zhOehR11WCt2RgzNlnYVmV5zBmQBdTAt8Po/MVhLCDW1BULHlLvL0DFc +4sB1RlcGeQcCKQa4b+Q9VWf4f6TfuEWZQC5j5stiXjVgOqrOMrzKZ2eKWA4JsL9s +V+7ANSZE+hOt1X1mA8moyqe95U2Ecih+nFJSWSBd1WFiEzVnXv4FVWPXbH9HERDK +VbasjofWWmQO1YlQPishLgm1IbwqOkOk4sDgoLuUZ4GgP0DDeN6EmRDOzByrv+9u +f45Bl9IQf4IJNPLU9lEqjyMOydqT6kBi7fjV5ICuQZ4EeVJsOGuX7PqNyoDzJHLv +ferRfNLr6eQSHSxBhS0cVyDjb5gCawK6u7xTU+b7xikEie9k +-----END CERTIFICATE----- diff --git a/tests/cert-tests/invalid-sig3.pem b/tests/cert-tests/invalid-sig3.pem new file mode 100644 index 0000000000..40c610fe93 --- /dev/null +++ b/tests/cert-tests/invalid-sig3.pem @@ -0,0 +1,38 @@ +-----BEGIN CERTIFICATE----- +MIIC1DCCAYygA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