|
|
748c79 |
From: Vincent Breitmoser <look@my.amazin.horse>
|
|
|
748c79 |
Date: Thu, 13 Jun 2019 21:27:41 +0200
|
|
|
748c79 |
Subject: tests: add test cases for import without uid
|
|
|
748c79 |
|
|
|
748c79 |
This commit adds a test case that does the following, in order:
|
|
|
748c79 |
- Import of a primary key plus user id
|
|
|
748c79 |
- Check that import of a subkey works, without a user id present in the
|
|
|
748c79 |
imported key
|
|
|
748c79 |
- Check that import of a subkey revocation works, without a user id or
|
|
|
748c79 |
subkey binding signature present in the imported key
|
|
|
748c79 |
- Check that import of a primary key revocation works, without a user id
|
|
|
748c79 |
present in the imported key
|
|
|
748c79 |
|
|
|
748c79 |
--
|
|
|
748c79 |
|
|
|
748c79 |
Note that this test currently fails. The following changesets will
|
|
|
748c79 |
fix gpg so that the tests pass.
|
|
|
748c79 |
|
|
|
748c79 |
GnuPG-Bug-id: 4393
|
|
|
748c79 |
Signed-Off-By: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
|
|
|
748c79 |
---
|
|
|
748c79 |
tests/openpgp/Makefile.am | 1 +
|
|
|
748c79 |
tests/openpgp/import-incomplete.scm | 68 ++++++++++++++++++++++
|
|
|
748c79 |
.../import-incomplete/primary+revocation.asc | 9 +++
|
|
|
748c79 |
.../primary+subkey+sub-revocation.asc | 10 ++++
|
|
|
748c79 |
.../import-incomplete/primary+subkey+sub-sig.asc | 10 ++++
|
|
|
748c79 |
.../openpgp/import-incomplete/primary+uid-sig.asc | 10 ++++
|
|
|
748c79 |
tests/openpgp/import-incomplete/primary+uid.asc | 10 ++++
|
|
|
748c79 |
7 files changed, 118 insertions(+)
|
|
|
748c79 |
create mode 100755 tests/openpgp/import-incomplete.scm
|
|
|
748c79 |
create mode 100644 tests/openpgp/import-incomplete/primary+revocation.asc
|
|
|
748c79 |
create mode 100644 tests/openpgp/import-incomplete/primary+subkey+sub-revocation.asc
|
|
|
748c79 |
create mode 100644 tests/openpgp/import-incomplete/primary+subkey+sub-sig.asc
|
|
|
748c79 |
create mode 100644 tests/openpgp/import-incomplete/primary+uid-sig.asc
|
|
|
748c79 |
create mode 100644 tests/openpgp/import-incomplete/primary+uid.asc
|
|
|
748c79 |
|
|
|
748c79 |
diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
|
|
|
748c79 |
index f6014c9..6423da1 100644
|
|
|
748c79 |
--- a/tests/openpgp/Makefile.am
|
|
|
748c79 |
+++ b/tests/openpgp/Makefile.am
|
|
|
748c79 |
@@ -78,6 +78,7 @@ XTESTS = \
|
|
|
748c79 |
gpgv-forged-keyring.scm \
|
|
|
748c79 |
armor.scm \
|
|
|
748c79 |
import.scm \
|
|
|
748c79 |
+ import-incomplete.scm \
|
|
|
748c79 |
import-revocation-certificate.scm \
|
|
|
748c79 |
ecc.scm \
|
|
|
748c79 |
4gb-packet.scm \
|
|
|
748c79 |
diff --git a/tests/openpgp/import-incomplete.scm b/tests/openpgp/import-incomplete.scm
|
|
|
748c79 |
new file mode 100755
|
|
|
748c79 |
index 0000000..727a027
|
|
|
748c79 |
--- /dev/null
|
|
|
748c79 |
+++ b/tests/openpgp/import-incomplete.scm
|
|
|
748c79 |
@@ -0,0 +1,68 @@
|
|
|
748c79 |
+#!/usr/bin/env gpgscm
|
|
|
748c79 |
+
|
|
|
748c79 |
+;; Copyright (C) 2016 g10 Code GmbH
|
|
|
748c79 |
+;;
|
|
|
748c79 |
+;; This file is part of GnuPG.
|
|
|
748c79 |
+;;
|
|
|
748c79 |
+;; GnuPG is free software; you can redistribute it and/or modify
|
|
|
748c79 |
+;; it under the terms of the GNU General Public License as published by
|
|
|
748c79 |
+;; the Free Software Foundation; either version 3 of the License, or
|
|
|
748c79 |
+;; (at your option) any later version.
|
|
|
748c79 |
+;;
|
|
|
748c79 |
+;; GnuPG is distributed in the hope that it will be useful,
|
|
|
748c79 |
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
748c79 |
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
748c79 |
+;; GNU General Public License for more details.
|
|
|
748c79 |
+;;
|
|
|
748c79 |
+;; You should have received a copy of the GNU General Public License
|
|
|
748c79 |
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
748c79 |
+
|
|
|
748c79 |
+(load (in-srcdir "tests" "openpgp" "defs.scm"))
|
|
|
748c79 |
+(setup-environment)
|
|
|
748c79 |
+
|
|
|
748c79 |
+(call-check `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "import-incomplete" "primary+uid.asc")))
|
|
|
748c79 |
+
|
|
|
748c79 |
+(info "Test import of new subkey, from a certificate without uid")
|
|
|
748c79 |
+(define keyid "573EA710367356BB")
|
|
|
748c79 |
+(call-check `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "import-incomplete" "primary+subkey+sub-sig.asc")))
|
|
|
748c79 |
+(tr:do
|
|
|
748c79 |
+ (tr:pipe-do
|
|
|
748c79 |
+ (pipe:gpg `(--list-keys --with-colons ,keyid)))
|
|
|
748c79 |
+ (tr:call-with-content
|
|
|
748c79 |
+ (lambda (c)
|
|
|
748c79 |
+ ;; XXX we do not have a regexp library
|
|
|
748c79 |
+ (unless (any (lambda (line)
|
|
|
748c79 |
+ (and (string-prefix? line "sub:")
|
|
|
748c79 |
+ (string-contains? line "573EA710367356BB")))
|
|
|
748c79 |
+ (string-split-newlines c))
|
|
|
748c79 |
+ (exit 1)))))
|
|
|
748c79 |
+
|
|
|
748c79 |
+(info "Test import of a subkey revocation, from a certificate without uid")
|
|
|
748c79 |
+(define keyid "573EA710367356BB")
|
|
|
748c79 |
+(call-check `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "import-incomplete" "primary+subkey+sub-revocation.asc")))
|
|
|
748c79 |
+(tr:do
|
|
|
748c79 |
+ (tr:pipe-do
|
|
|
748c79 |
+ (pipe:gpg `(--list-keys --with-colons ,keyid)))
|
|
|
748c79 |
+ (tr:call-with-content
|
|
|
748c79 |
+ (lambda (c)
|
|
|
748c79 |
+ ;; XXX we do not have a regexp library
|
|
|
748c79 |
+ (unless (any (lambda (line)
|
|
|
748c79 |
+ (and (string-prefix? line "sub:r:")
|
|
|
748c79 |
+ (string-contains? line "573EA710367356BB")))
|
|
|
748c79 |
+ (string-split-newlines c))
|
|
|
748c79 |
+ (exit 1)))))
|
|
|
748c79 |
+
|
|
|
748c79 |
+(info "Test import of revocation, from a certificate without uid")
|
|
|
748c79 |
+(call-check `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "import-incomplete" "primary+revocation.asc")))
|
|
|
748c79 |
+(tr:do
|
|
|
748c79 |
+ (tr:pipe-do
|
|
|
748c79 |
+ (pipe:gpg `(--list-keys --with-colons ,keyid)))
|
|
|
748c79 |
+ (tr:call-with-content
|
|
|
748c79 |
+ (lambda (c)
|
|
|
748c79 |
+ ;; XXX we do not have a regexp library
|
|
|
748c79 |
+ (unless (any (lambda (line)
|
|
|
748c79 |
+ (and (string-prefix? line "pub:r:")
|
|
|
748c79 |
+ (string-contains? line "0843DA969AA8DAFB")))
|
|
|
748c79 |
+ (string-split-newlines c))
|
|
|
748c79 |
+ (exit 1)))))
|
|
|
748c79 |
+
|
|
|
748c79 |
diff --git a/tests/openpgp/import-incomplete/primary+revocation.asc b/tests/openpgp/import-incomplete/primary+revocation.asc
|
|
|
748c79 |
new file mode 100644
|
|
|
748c79 |
index 0000000..6b7b608
|
|
|
748c79 |
--- /dev/null
|
|
|
748c79 |
+++ b/tests/openpgp/import-incomplete/primary+revocation.asc
|
|
|
748c79 |
@@ -0,0 +1,9 @@
|
|
|
748c79 |
+-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
+Comment: [E] primary key, revocation signature over primary (no user ID)
|
|
|
748c79 |
+
|
|
|
748c79 |
+mDMEXNmUGRYJKwYBBAHaRw8BAQdA75R8VlchvmEd2Iz/8l07RoKUaUPDB71Ao1zZ
|
|
|
748c79 |
+631VAN2IeAQgFggAIBYhBLRpj5W82H/gSMzKKQhD2paaqNr7BQJc2ZQZAh0AAAoJ
|
|
|
748c79 |
+EAhD2paaqNr7qAwA/2jBUpnN0BxwRO/4CrxvrLIsL+C9aSXJUOTv8XkP4lvtAQD3
|
|
|
748c79 |
+XsDFfFNgEueiTfF7HtOGt5LPmRqVvUpQSMVgJJW6CQ==
|
|
|
748c79 |
+=tM90
|
|
|
748c79 |
+-----END PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
diff --git a/tests/openpgp/import-incomplete/primary+subkey+sub-revocation.asc b/tests/openpgp/import-incomplete/primary+subkey+sub-revocation.asc
|
|
|
748c79 |
new file mode 100644
|
|
|
748c79 |
index 0000000..83a51a5
|
|
|
748c79 |
--- /dev/null
|
|
|
748c79 |
+++ b/tests/openpgp/import-incomplete/primary+subkey+sub-revocation.asc
|
|
|
748c79 |
@@ -0,0 +1,10 @@
|
|
|
748c79 |
+-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
+Comment: [D] primary key, subkey, subkey revocation (no user ID)
|
|
|
748c79 |
+
|
|
|
748c79 |
+mDMEXNmUGRYJKwYBBAHaRw8BAQdA75R8VlchvmEd2Iz/8l07RoKUaUPDB71Ao1zZ
|
|
|
748c79 |
+631VAN24OARc2ZQhEgorBgEEAZdVAQUBAQdABsd5ha0AWXdXcSmfeiWIfrNcGqQK
|
|
|
748c79 |
+j++lwwWDAOlkVicDAQgHiHgEKBYIACAWIQS0aY+VvNh/4EjMyikIQ9qWmqja+wUC
|
|
|
748c79 |
+XNmnkAIdAgAKCRAIQ9qWmqja+ylaAQDmIKf86BJEq4OpDqU+V9D+wn2cyuxbyWVQ
|
|
|
748c79 |
+3r9LiL9qNwD/QAjyrhSN8L3Mfq+wdTHo5i0yB9ZCCpHLXSbhCqfWZwQ=
|
|
|
748c79 |
+=dwx2
|
|
|
748c79 |
+-----END PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
diff --git a/tests/openpgp/import-incomplete/primary+subkey+sub-sig.asc b/tests/openpgp/import-incomplete/primary+subkey+sub-sig.asc
|
|
|
748c79 |
new file mode 100644
|
|
|
748c79 |
index 0000000..dc47a02
|
|
|
748c79 |
--- /dev/null
|
|
|
748c79 |
+++ b/tests/openpgp/import-incomplete/primary+subkey+sub-sig.asc
|
|
|
748c79 |
@@ -0,0 +1,10 @@
|
|
|
748c79 |
+-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
+Comment: [B] primary key, subkey, subkey binding sig (no user ID)
|
|
|
748c79 |
+
|
|
|
748c79 |
+mDMEXNmUGRYJKwYBBAHaRw8BAQdA75R8VlchvmEd2Iz/8l07RoKUaUPDB71Ao1zZ
|
|
|
748c79 |
+631VAN24OARc2ZQhEgorBgEEAZdVAQUBAQdABsd5ha0AWXdXcSmfeiWIfrNcGqQK
|
|
|
748c79 |
+j++lwwWDAOlkVicDAQgHiHgEGBYIACAWIQS0aY+VvNh/4EjMyikIQ9qWmqja+wUC
|
|
|
748c79 |
+XNmUIQIbDAAKCRAIQ9qWmqja++vFAP98G1L+1/rWTGbsnxOAV2RocBYIroAvsbkR
|
|
|
748c79 |
+Ly6FdP8YNwEA7jOgT05CoKIe37MstpOz23mM80AK369Ca3JMmKKCQgg=
|
|
|
748c79 |
+=xuDu
|
|
|
748c79 |
+-----END PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
diff --git a/tests/openpgp/import-incomplete/primary+uid-sig.asc b/tests/openpgp/import-incomplete/primary+uid-sig.asc
|
|
|
748c79 |
new file mode 100644
|
|
|
748c79 |
index 0000000..134607d
|
|
|
748c79 |
--- /dev/null
|
|
|
748c79 |
+++ b/tests/openpgp/import-incomplete/primary+uid-sig.asc
|
|
|
748c79 |
@@ -0,0 +1,10 @@
|
|
|
748c79 |
+-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
+Comment: [C] primary key and self-sig expiring in 2024 (no user ID)
|
|
|
748c79 |
+
|
|
|
748c79 |
+mDMEXNmUGRYJKwYBBAHaRw8BAQdA75R8VlchvmEd2Iz/8l07RoKUaUPDB71Ao1zZ
|
|
|
748c79 |
+631VAN2IlgQTFggAPgIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgBYhBLRpj5W8
|
|
|
748c79 |
+2H/gSMzKKQhD2paaqNr7BQJc2ZR1BQkJZgHcAAoJEAhD2paaqNr79soA/0lWkUsu
|
|
|
748c79 |
+3NLwgbni6EzJxnTzgeNMpljqNpipHAwfix9hAP93AVtFdC8g7hdUZxawobl9lnSN
|
|
|
748c79 |
+9ohXOEBWvdJgVv2YAg==
|
|
|
748c79 |
+=KWIK
|
|
|
748c79 |
+-----END PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
diff --git a/tests/openpgp/import-incomplete/primary+uid.asc b/tests/openpgp/import-incomplete/primary+uid.asc
|
|
|
748c79 |
new file mode 100644
|
|
|
748c79 |
index 0000000..055f300
|
|
|
748c79 |
--- /dev/null
|
|
|
748c79 |
+++ b/tests/openpgp/import-incomplete/primary+uid.asc
|
|
|
748c79 |
@@ -0,0 +1,10 @@
|
|
|
748c79 |
+-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
|
748c79 |
+Comment: [A] primary key, user ID, and self-sig expiring in 2021
|
|
|
748c79 |
+
|
|
|
748c79 |
+mDMEXNmUGRYJKwYBBAHaRw8BAQdA75R8VlchvmEd2Iz/8l07RoKUaUPDB71Ao1zZ
|
|
|
748c79 |
+631VAN20CHRlc3Qga2V5iJYEExYIAD4WIQS0aY+VvNh/4EjMyikIQ9qWmqja+wUC
|
|
|
748c79 |
+XNmUGQIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRAIQ9qWmqja
|
|
|
748c79 |
++0G1AQDdQiwhXxjXLMqoth+D4SigVHTJK8ORwifzsy3UE7mPGwD/aZ67XbAF/lgI
|
|
|
748c79 |
+kv2O1Jo0u9BL9RNNF+L0DM7rAFbfMAs=
|
|
|
748c79 |
+=1eII
|
|
|
748c79 |
+-----END PGP PUBLIC KEY BLOCK-----
|