gpg: Set a limit of 5 to the number of keys imported from the WKD.
authorWerner Koch <wk@gnupg.org>
Thu, 11 Apr 2019 07:43:33 +0000 (09:43 +0200)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Fri, 1 Jul 2022 16:06:43 +0000 (17:06 +0100)
commit0ce5dbb44302377985f5fc0e097be2c790c53645
treee1ae109e12747fe6ad8da541906118de72ff9491
parent9510c18293a16d9b7b0b4a8a83256cb41aad50e6
gpg: Set a limit of 5 to the number of keys imported from the WKD.

* g10/import.c (import): Limit the number of considered keys to 5.
(import_one): Return the first fingerprint in case of WKD.
--

The Web Key Directory should carry only one key.  However, some
providers like to put old or expired keys also into the WKD.  I don't
thunk that this is a good idea but I heard claims that this is needed
for them to migrate existing key data bases.

This patch puts a limit on 5 on it (we had none right now) and also
fixes the issue that gpg could not work immediately with the requested
key because the code uses the fingerprint of the key to use the
imported key.  Now the first key is used.  On a second try (w/o
accessing the WKD) the regular key selection mechanism would be in
effect.  I think this is the most conservative approach.  Let's see
whether it helps.

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

Gbp-Pq: Topic from-2.2.16
Gbp-Pq: Name gpg-Set-a-limit-of-5-to-the-number-of-keys-imported-from-.patch
g10/import.c