diff options
author | Werner Koch <[email protected]> | 2016-06-06 14:00:50 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-06-06 14:03:22 +0000 |
commit | b047388d57443f584f1c1d6333aac5218b685042 (patch) | |
tree | bf2248ac8941150098e9b1b3bf5a78f636842be3 /g10/keyid.c | |
parent | indent: Wrap strings in debug messages. (diff) | |
download | gnupg-b047388d57443f584f1c1d6333aac5218b685042.tar.gz gnupg-b047388d57443f584f1c1d6333aac5218b685042.zip |
gpg: Implement --keyid-format=none.
* g10/gpg.c (main): Add option "none" to --keyid-format.
* g10/options.h (KF_NONE): New.
* g10/keyid.c (format_keyid): Implement that.
(keystr): Use format "long" is KF_NONE is in use.
(keystr_with_sub): Ditto.
* g10/keylist.c (list_keyblock_print): Adjust indentaion for KF_NONE.
Factor some code out to ...
(print_key_line): new.
(print_fingerprint): Add mode 20.
* g10/mainproc.c (list_node): Use print_key_line. Replace MAINKEY by
flags.primary in the PK. Fix putting a " revoked..." string into the
colons format.
* g10/pkclist.c (do_edit_ownertrust): Use print_key_line. This
slightly changes the putput format.
* g10/revoke.c (gen_standard_revoke): Use print_key_line. This may
also put "expires: " into the output.
--
Due to user experience problems with the keyid and we better allow to
show the fingerprint instead. Note that we do not support v3 keys
anymore and thus there is no technical need for a user to know the
keyid.
GnuPG-bug-id: 2379
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/keyid.c')
-rw-r--r-- | g10/keyid.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/g10/keyid.c b/g10/keyid.c index bd808d21e..20efa01b7 100644 --- a/g10/keyid.c +++ b/g10/keyid.c @@ -337,6 +337,11 @@ format_keyid (u32 *keyid, int format, char *buffer, int len) switch (format) { + case KF_NONE: + if (len) + *buffer = 0; + break; + case KF_SHORT: snprintf (buffer, len, "%08lX", (ulong)keyid[1]); break; @@ -401,22 +406,32 @@ const char * keystr (u32 *keyid) { static char keyid_str[KEYID_STR_SIZE]; - return format_keyid (keyid, opt.keyid_format, keyid_str, sizeof (keyid_str)); -} + int format = opt.keyid_format; + if (format == KF_NONE) + format = KF_LONG; + return format_keyid (keyid, format, keyid_str, sizeof (keyid_str)); +} + +/* This function returns the key id of the main and possible the + * subkey as one string. It is used by error messages. */ const char * keystr_with_sub (u32 *main_kid, u32 *sub_kid) { static char buffer[KEYID_STR_SIZE+1+KEYID_STR_SIZE]; char *p; + int format = opt.keyid_format; + + if (format == KF_NONE) + format = KF_LONG; - mem2str (buffer, keystr (main_kid), KEYID_STR_SIZE); + format_keyid (main_kid, format, buffer, KEYID_STR_SIZE); if (sub_kid) { p = buffer + strlen (buffer); *p++ = '/'; - mem2str (p, keystr (sub_kid), KEYID_STR_SIZE); + format_keyid (sub_kid, format, p, KEYID_STR_SIZE); } return buffer; } |