summaryrefslogtreecommitdiff
path: root/tests/cert-tests
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2015-06-02 09:05:27 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2015-06-02 09:05:43 +0200
commit245ef6a7b1fa66ebd2f4dd787888c6b4f333ddc0 (patch)
treebb13a24e936f17a3f36ee81fd570a21a55d72fbc /tests/cert-tests
parenta612cc974ad9961fa31d8df3262f705467fe54be (diff)
downloadgnutls-245ef6a7b1fa66ebd2f4dd787888c6b4f333ddc0.tar.gz
tests: added checks with PKCS #7 detached data
Diffstat (limited to 'tests/cert-tests')
-rw-r--r--tests/cert-tests/Makefile.am3
-rw-r--r--tests/cert-tests/detached.p7bbin0 -> 2579 bytes
-rwxr-xr-xtests/cert-tests/pkcs720
-rw-r--r--tests/cert-tests/pkcs7-detached.txt1
4 files changed, 23 insertions, 1 deletions
diff --git a/tests/cert-tests/Makefile.am b/tests/cert-tests/Makefile.am
index 569022b822..5f21bd7295 100644
--- a/tests/cert-tests/Makefile.am
+++ b/tests/cert-tests/Makefile.am
@@ -30,7 +30,8 @@ EXTRA_DIST = ca-no-pathlen.pem no-ca-or-pathlen.pem aki-cert.pem \
suppressions.valgrind csr-invalid.der invalid-sig2.pem invalid-sig3.pem \
invalid-sig.pem email-certs/chain.exclude.test.example.com email-certs/chain.test.example.com \
email-certs/chain.invalid.example.com email-certs/chain.test.example.com-2 \
- single-ca.p7b single-ca.p7b.out full.p7b full.p7b.out
+ single-ca.p7b single-ca.p7b.out full.p7b full.p7b.out detached.p7b \
+ pkcs7-detached.txt
dist_check_SCRIPTS = pathlen aki template-test pem-decoding dane crq certtool invalid-sig email \
pkcs7
diff --git a/tests/cert-tests/detached.p7b b/tests/cert-tests/detached.p7b
new file mode 100644
index 0000000000..d2a5602dcd
--- /dev/null
+++ b/tests/cert-tests/detached.p7b
Binary files differ
diff --git a/tests/cert-tests/pkcs7 b/tests/cert-tests/pkcs7
index a10e18697f..6f3f9e166c 100755
--- a/tests/cert-tests/pkcs7
+++ b/tests/cert-tests/pkcs7
@@ -74,6 +74,26 @@ fi
done
+# check signature with detached data
+
+FILE=detached.p7b
+$VALGRIND $CERTTOOL --inder --p7-verify --load-ca-certificate $srcdir/../../doc/credentials/x509/ca.pem --infile $srcdir/$FILE
+rc=$?
+
+if test "$rc" = "0"; then
+ echo "$FILE: PKCS7 verification succeeded without providing detached data"
+ exit 2
+fi
+
+$VALGRIND $CERTTOOL --inder --p7-verify --load-data pkcs7-detached.txt --load-ca-certificate $srcdir/../../doc/credentials/x509/ca.pem --infile $srcdir/$FILE
+rc=$?
+
+if test "$rc" != "0"; then
+ echo "$FILE: PKCS7 verification failed"
+ exit $rc
+fi
+
+
rm -f $OUTFILE
exit 0
diff --git a/tests/cert-tests/pkcs7-detached.txt b/tests/cert-tests/pkcs7-detached.txt
new file mode 100644
index 0000000000..54fb2b85da
--- /dev/null
+++ b/tests/cert-tests/pkcs7-detached.txt
@@ -0,0 +1 @@
+Hello there. How are you?