summaryrefslogtreecommitdiff
path: root/tests/openpgp-certs
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-01-12 18:34:39 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-01-12 18:49:39 +0100
commit3275e1c09bc9c74946ebdaa87c71b71371aeccc4 (patch)
tree2a7e9ec01578197be39ee3bb532a66ecb0967568 /tests/openpgp-certs
parenta20d9828ae55f032752addcad4228c624f9094fa (diff)
downloadgnutls-3275e1c09bc9c74946ebdaa87c71b71371aeccc4.tar.gz
When checking self signature also check the signatures of all subkeys.
Ilari Liusvaara noticed and reported the issue and provided test vectors as well. certtool --pgp-certificate-info will check self signatures. Added self tests for self-sigs.
Diffstat (limited to 'tests/openpgp-certs')
-rw-r--r--tests/openpgp-certs/Makefile.am10
-rw-r--r--tests/openpgp-certs/selfsigs/alice-mallory-badsig18.pubbin0 -> 1118 bytes
-rw-r--r--tests/openpgp-certs/selfsigs/alice-mallory-irrelevantsig.pubbin0 -> 1071 bytes
-rw-r--r--tests/openpgp-certs/selfsigs/alice-mallory-nosig18.pubbin0 -> 971 bytes
-rw-r--r--tests/openpgp-certs/selfsigs/alice.pubbin0 -> 1118 bytes
-rwxr-xr-xtests/openpgp-certs/testselfsigs24
6 files changed, 30 insertions, 4 deletions
diff --git a/tests/openpgp-certs/Makefile.am b/tests/openpgp-certs/Makefile.am
index d437dc51be..76fbf3a82b 100644
--- a/tests/openpgp-certs/Makefile.am
+++ b/tests/openpgp-certs/Makefile.am
@@ -21,13 +21,15 @@ if ENABLE_OPENPGP
EXTRA_DIST = ca-public.gpg srv-public-all-signed.gpg srv-secret.gpg \
ca-secret.gpg srv-public.gpg srv-public-127.0.0.1-signed.gpg \
- srv-public-localhost-signed.gpg
+ srv-public-localhost-signed.gpg selfsigs/alice-mallory-badsig18.pub \
+ selfsigs/alice-mallory-irrelevantsig.pub selfsigs/alice-mallory-nosig18.pub \
+ selfsigs/alice.pub
# The selftest is disabled until we can make it work under Wine and
# under Debian buildds (problem with 127.0.0.2?). Just extra-dist it
# for now.
-EXTRA_DIST += testcerts
-#dist_check_SCRIPTS = testcerts
-#TESTS = testcerts
+EXTRA_DIST += testcerts testselfsigs
+dist_check_SCRIPTS = testselfsigs #testcerts
+TESTS = testselfsigs #testcerts
endif
diff --git a/tests/openpgp-certs/selfsigs/alice-mallory-badsig18.pub b/tests/openpgp-certs/selfsigs/alice-mallory-badsig18.pub
new file mode 100644
index 0000000000..dd4dab1156
--- /dev/null
+++ b/tests/openpgp-certs/selfsigs/alice-mallory-badsig18.pub
Binary files differ
diff --git a/tests/openpgp-certs/selfsigs/alice-mallory-irrelevantsig.pub b/tests/openpgp-certs/selfsigs/alice-mallory-irrelevantsig.pub
new file mode 100644
index 0000000000..03caa9d122
--- /dev/null
+++ b/tests/openpgp-certs/selfsigs/alice-mallory-irrelevantsig.pub
Binary files differ
diff --git a/tests/openpgp-certs/selfsigs/alice-mallory-nosig18.pub b/tests/openpgp-certs/selfsigs/alice-mallory-nosig18.pub
new file mode 100644
index 0000000000..59f077afcb
--- /dev/null
+++ b/tests/openpgp-certs/selfsigs/alice-mallory-nosig18.pub
Binary files differ
diff --git a/tests/openpgp-certs/selfsigs/alice.pub b/tests/openpgp-certs/selfsigs/alice.pub
new file mode 100644
index 0000000000..399a0ba4ec
--- /dev/null
+++ b/tests/openpgp-certs/selfsigs/alice.pub
Binary files differ
diff --git a/tests/openpgp-certs/testselfsigs b/tests/openpgp-certs/testselfsigs
new file mode 100755
index 0000000000..51acd86ef4
--- /dev/null
+++ b/tests/openpgp-certs/testselfsigs
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+srcdir="${srcdir:-.}"
+CERTTOOL="${certtool:-../../src/certtool} -q"
+unset RETCODE
+
+fail() {
+ echo "Failure: $1" >&2
+ RETCODE=${RETCODE:-${2:-1}}
+}
+
+echo "Checking OpenPGP certificate self verification"
+
+( $CERTTOOL --pgp-certificate-info <$srcdir/selfsigs/alice.pub | grep -e "^Self Signature verification: ok" ) >/dev/null ||
+ fail "Self sig Verification should have succeeded!"
+
+( $CERTTOOL --pgp-certificate-info <$srcdir/selfsigs/alice-mallory-badsig18.pub | grep -e "^Self Signature verification: failed" ) >/dev/null ||
+ fail "Self sig Verification should have failed!"
+( $CERTTOOL --pgp-certificate-info <$srcdir/selfsigs/alice-mallory-irrelevantsig.pub | grep -e "^Self Signature verification: failed" ) >/dev/null ||
+ fail "Self sig Verification should have failed!"
+( $CERTTOOL --pgp-certificate-info <$srcdir/selfsigs/alice-mallory-nosig18.pub | grep -e "^Self Signature verification: failed" ) >/dev/null ||
+ fail "Self sig Verification should have failed!"
+
+exit ${RETCODE:-0}