Blame SOURCES/gnupg-2.2.18-tests-add-test-cases-for-import-without-uid.patch

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