aboutsummaryrefslogtreecommitdiffstats
path: root/g10/trustdb.c
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <[email protected]>2020-02-26 17:53:22 +0000
committerDaniel Kahn Gillmor <[email protected]>2020-02-26 18:09:46 +0000
commitad55de70930543c1681b11e4bd624be074122b23 (patch)
treef8d585ad1d0da71820936f5c5bfc7a88ab498eb0 /g10/trustdb.c
parentSpelling cleanup. (diff)
downloadgnupg-dkg/fix-4855.tar.gz
gnupg-dkg/fix-4855.zip
gpg: Update --trusted-key to accept fingerprint as well as long key id.dkg/fix-4855
* g10/trustdb.c (tdb_register_trusted_key): accept fingerprint as well as long key ID. * doc/gpg.texi: document that --trusted-key can accept a fingerprint. -- GnuPG-bug-id: 4855 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
Diffstat (limited to '')
-rw-r--r--g10/trustdb.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/g10/trustdb.c b/g10/trustdb.c
index 64e6ec349..2c096357c 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -210,15 +210,20 @@ tdb_register_trusted_key( const char *string )
{
gpg_error_t err;
KEYDB_SEARCH_DESC desc;
+ u32 kid[2];
err = classify_user_id (string, &desc, 1);
- if (err || desc.mode != KEYDB_SEARCH_MODE_LONG_KID )
+ if (!err)
{
- log_error(_("'%s' is not a valid long keyID\n"), string );
- return;
+ if (desc.mode == KEYDB_SEARCH_MODE_LONG_KID)
+ return register_trusted_keyid(desc.u.kid);
+ if (desc.mode == KEYDB_SEARCH_MODE_FPR && desc.fprlen == 20) {
+ kid[0] = buf32_to_u32 (desc.u.fpr+12);
+ kid[1] = buf32_to_u32 (desc.u.fpr+16);
+ return register_trusted_keyid(kid);
+ }
}
-
- register_trusted_keyid(desc.u.kid);
+ log_error(_("'%s' is not a valid long keyID or fingerprint\n"), string );
}
/*