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

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