summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2005-12-08 15:24:50 +0000
committerSimon Josefsson <simon@josefsson.org>2005-12-08 15:24:50 +0000
commit54b8b8c033fa3950bc179406c3d147a18d3255dd (patch)
treefb47afca2cb4eb524a8ca5b153a64ab4430be37c
parent7f163e07dd7762b799e91d1974a6a0542b5cd866 (diff)
downloadgnutls-54b8b8c033fa3950bc179406c3d147a18d3255dd.tar.gz
Add PKCS#8 self test.
-rw-r--r--tests/Makefile.am4
-rwxr-xr-xtests/pkcs843
2 files changed, 45 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e30e91a530..565304a226 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,9 +31,9 @@ EXTRA_DIST = client.p12 noclient.p12 unclient.p12
openssl_LDADD = $(LDADD) ../libextra/libgnutls-openssl.la
ctests = simple anonself pskself openssl gc dhepskself set_pkcs12_cred
-TESTS = pkcs12_neon $(ctests)
+TESTS = pkcs12_neon pkcs8 $(ctests)
check_PROGRAMS = $(ctests)
-dist_check_SCRIPTS = pkcs12_neon
+dist_check_SCRIPTS = pkcs12_neon pkcs8
TESTS_ENVIRONMENT = \
PKCS12FILE=$(srcdir)/client.p12 \
diff --git a/tests/pkcs8 b/tests/pkcs8
new file mode 100755
index 0000000000..430e0f1814
--- /dev/null
+++ b/tests/pkcs8
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# Copyright (C) 2004, 2005 Free Software Foundation
+#
+# 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 2 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.
+
+CERTTOOL=../src/certtool
+
+ret=0
+for p8 in 'encpkcs8.pem foobar' unencpkcs8.pem; do
+ set -- $p8
+ file=$1
+ passwd=$2
+ $CERTTOOL --key-info --pkcs8 --password "$passwd" \
+ --infile $srcdir/$file > out 2>&1
+ rc=$?
+ if test $rc != 0; then
+ echo "PKCS8 FATAL $p8"
+ ret=1
+ else
+ echo "PKCS8 OK $p8"
+ fi
+done
+rm -f out
+
+echo "PKCS8 DONE (rc $ret)"
+exit $ret