diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-11-14 17:12:02 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-11-14 18:25:52 +0100 |
commit | e7785d07443a85ed85347c5413acd5194e026c9e (patch) | |
tree | bb078ee0996db4cc0850ce5600f0a27d47461abb /tests | |
parent | f93240cce1736ba1d9e7b7fef93cacd35956e1ec (diff) | |
download | gnutls-e7785d07443a85ed85347c5413acd5194e026c9e.tar.gz |
tests: added test suite with PKCS#8 files that have invalid encryptiontmp-pkcs7-fixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/key-tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/key-tests/data/pkcs8-invalid1.der | bin | 0 -> 735 bytes | |||
-rw-r--r-- | tests/key-tests/data/pkcs8-invalid2.der | bin | 0 -> 674 bytes | |||
-rw-r--r-- | tests/key-tests/data/pkcs8-invalid3.der | bin | 0 -> 674 bytes | |||
-rw-r--r-- | tests/key-tests/data/pkcs8-invalid4.der | bin | 0 -> 735 bytes | |||
-rw-r--r-- | tests/key-tests/data/pkcs8-invalid5.der | bin | 0 -> 674 bytes | |||
-rw-r--r-- | tests/key-tests/data/pkcs8-invalid6.der | bin | 0 -> 674 bytes | |||
-rw-r--r-- | tests/key-tests/data/pkcs8-invalid7.der | bin | 0 -> 735 bytes | |||
-rwxr-xr-x | tests/key-tests/pkcs8-invalid | 52 |
9 files changed, 53 insertions, 1 deletions
diff --git a/tests/key-tests/Makefile.am b/tests/key-tests/Makefile.am index acd44d6be6..7f66e1832f 100644 --- a/tests/key-tests/Makefile.am +++ b/tests/key-tests/Makefile.am @@ -33,7 +33,7 @@ EXTRA_DIST = data/key-ca.pem data/key-user.pem \ dist_check_SCRIPTS = key-id pkcs8 pkcs8-decode dsa ecdsa illegal-rsa -TESTS = key-id pkcs8 pkcs8-decode ecdsa +TESTS = key-id pkcs8 pkcs8-decode ecdsa pkcs8-invalid if !WITH_OLD_NETTLE TESTS += illegal-rsa diff --git a/tests/key-tests/data/pkcs8-invalid1.der b/tests/key-tests/data/pkcs8-invalid1.der Binary files differnew file mode 100644 index 0000000000..8d05984ddf --- /dev/null +++ b/tests/key-tests/data/pkcs8-invalid1.der diff --git a/tests/key-tests/data/pkcs8-invalid2.der b/tests/key-tests/data/pkcs8-invalid2.der Binary files differnew file mode 100644 index 0000000000..086a6613cb --- /dev/null +++ b/tests/key-tests/data/pkcs8-invalid2.der diff --git a/tests/key-tests/data/pkcs8-invalid3.der b/tests/key-tests/data/pkcs8-invalid3.der Binary files differnew file mode 100644 index 0000000000..39b821fe04 --- /dev/null +++ b/tests/key-tests/data/pkcs8-invalid3.der diff --git a/tests/key-tests/data/pkcs8-invalid4.der b/tests/key-tests/data/pkcs8-invalid4.der Binary files differnew file mode 100644 index 0000000000..c8591a0b7c --- /dev/null +++ b/tests/key-tests/data/pkcs8-invalid4.der diff --git a/tests/key-tests/data/pkcs8-invalid5.der b/tests/key-tests/data/pkcs8-invalid5.der Binary files differnew file mode 100644 index 0000000000..3f234599f2 --- /dev/null +++ b/tests/key-tests/data/pkcs8-invalid5.der diff --git a/tests/key-tests/data/pkcs8-invalid6.der b/tests/key-tests/data/pkcs8-invalid6.der Binary files differnew file mode 100644 index 0000000000..f1519feb84 --- /dev/null +++ b/tests/key-tests/data/pkcs8-invalid6.der diff --git a/tests/key-tests/data/pkcs8-invalid7.der b/tests/key-tests/data/pkcs8-invalid7.der Binary files differnew file mode 100644 index 0000000000..85e1357962 --- /dev/null +++ b/tests/key-tests/data/pkcs8-invalid7.der diff --git a/tests/key-tests/pkcs8-invalid b/tests/key-tests/pkcs8-invalid new file mode 100755 index 0000000000..bf2cb96a20 --- /dev/null +++ b/tests/key-tests/pkcs8-invalid @@ -0,0 +1,52 @@ +#!/bin/sh + +# Copyright (C) 2004-2006, 2010, 2012 Free Software Foundation, Inc. +# +# Author: Simon Josefsson +# +# 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. + +srcdir="${srcdir:-.}" +CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}" +DIFF="${DIFF:-diff -b -B}" +TMPFILE=pkcs8-invalid.$$.tmp + +if ! test -z "${VALGRIND}"; then + VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}" +fi + +ret=0 +for p8 in "pkcs8-invalid1.der 1234" "pkcs8-invalid2.der 1234" "pkcs8-invalid3.der 1234" "pkcs8-invalid4.der 1234" \ + "pkcs8-invalid5.der 1234" "pkcs8-invalid6.der 1234" "pkcs8-invalid7.der 1234";do + set -- ${p8} + file="$1" + passwd="$2" + ${VALGRIND} "${CERTTOOL}" --inder --key-info --pkcs8 --password "${passwd}" \ + --infile "${srcdir}/data/${file}" + rc=$? + if test ${rc} != 1; then + echo "PKCS8 FATAL ${p8} - errno ${rc}" + ret=1 + else + echo "PKCS8 OK ${p8} - errno ${rc}" + fi +done + +rm -f $TMPFILE + +echo "PKCS8 DONE (rc $ret)" +exit $ret |