Compare commits

...

2 Commits

Author SHA1 Message Date
Daniel Kahn Gillmor
c4cf527ea2 gpg: Send --with-keygrip when listing keys
* src/engine-gpg.c (gpg_keylist_build_options): Always pass
--with-keygrip when listing keys.

--

Some older versions of GnuPG (at least gpg in version
2.2.12-1+deb10u1) appear to unilaterally emit the keygrip, and it's
certainly useful to know that programmatically it will always be
present in the output needed.

However, as of GnuPG 2.2.19-1, the following command does not emit the
keygrip for non-secret keys:

   gpg --with-colons --with-secret --list-keys

This change fixes tests/json/t-json by making the output comply with
tests/json/t-keylist-secret.out.json correctly.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
GnuPG-Bug-Id: 4820
2020-01-23 17:57:54 -05:00
Daniel Kahn Gillmor
f2aeb2563b tests/json: Bravo key does not have secret key material
* tests/json/t-keylist-secret.out.json: indicate correctly that the
"Bravo" test key does not have secret key material.

--

Some older versions of GnuPG are buggy, and will claim "secret: true"
for this key, even though the keyring in question has no secret key
material for it.

The underlying call to gpg looks something like:

    gpg --with-colons --with-secret --list-keys -- \
        alpha@example.net bravo@example.net

You can see the change in field 15 of the "pub" and "sub" output.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
GnuPG-Bug-Id: 4820
2020-01-23 17:57:20 -05:00
2 changed files with 2 additions and 1 deletions

View File

@ -2961,6 +2961,7 @@ gpg_keylist_build_options (engine_gpg_t gpg, int secret_only,
gpg_error_t err; gpg_error_t err;
err = add_arg (gpg, "--with-colons"); err = add_arg (gpg, "--with-colons");
err = add_arg (gpg, "--with-keygrip");
/* Since gpg 2.1.15 fingerprints are always printed, thus there is /* Since gpg 2.1.15 fingerprints are always printed, thus there is
* no more need to explicitly request them. */ * no more need to explicitly request them. */

View File

@ -91,7 +91,7 @@
"can_sign": true, "can_sign": true,
"can_certify": true, "can_certify": true,
"can_authenticate": true, "can_authenticate": true,
"secret": true, "secret": false,
"is_qualified": false, "is_qualified": false,
"protocol": "OpenPGP", "protocol": "OpenPGP",
"fingerprint": "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "fingerprint": "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2",