gpg: Do not bail out on v5 keys in the local keyring.
authorWerner Koch <wk@gnupg.org>
Mon, 18 Mar 2019 13:10:16 +0000 (14:10 +0100)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Fri, 1 Jul 2022 16:06:43 +0000 (17:06 +0100)
commit9b99245755253d1a493123bc690a8ccb32a27290
tree5a67a8ac97e6592e8506323385591b82a1ec4ec1
parenta577b75c461488f316e3f4ef8847f02643ccf197
gpg: Do not bail out on v5 keys in the local keyring.

* g10/parse-packet.c (parse_key): Return GPG_ERR_UNKNOWN_VERSION
instead of invalid packet.
* g10/keydb.c (parse_keyblock_image): Do not map the unknown version
error to invalid keyring.
(keydb_search): Skip unknown version errors simlar to legacy keys.
* g10/keyring.c (keyring_rebuild_cache): Skip keys with unknown
versions.
* g10/import.c (read_block): Handle unknown version.
--

When using gpg 2.3 the local keyring may contain v5 keys.  This patch
allows the use of such a keyring also with a 2.2 version which does
not support v5 keys.  We will probably need some more tweaking here
but this covers the most common cases of listing keys and also
importing v5 keys.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit de70a2f377c1647417fb8a2b6476c3744a901296)

Gbp-Pq: Topic from-2.2.14
Gbp-Pq: Name gpg-Do-not-bail-out-on-v5-keys-in-the-local-keyring.patch
g10/import.c
g10/keydb.c
g10/keylist.c
g10/keyring.c
g10/parse-packet.c