diff options
author | Werner Koch <[email protected]> | 2024-04-23 18:12:57 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2024-04-23 18:12:57 +0000 |
commit | ab703eacf73e5e1ae16d13558b32ac22a29f8536 (patch) | |
tree | c1ee460190fa6be8697f8289ab62ad47c65621ef /g10/keylist.c | |
parent | gpg: Support Kyber with Brainpool512r1. (diff) | |
download | gnupg-ab703eacf73e5e1ae16d13558b32ac22a29f8536.tar.gz gnupg-ab703eacf73e5e1ae16d13558b32ac22a29f8536.zip |
gpg: Split keygrip in a standard key listing.
* g10/keylist.c (print_keygrip): New.
(list_keyblock_print): Use new function to print the keygrip.
Diffstat (limited to 'g10/keylist.c')
-rw-r--r-- | g10/keylist.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/g10/keylist.c b/g10/keylist.c index 7717ca563..c6667936d 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -1171,6 +1171,19 @@ dump_attribs (const PKT_user_id *uid, PKT_public_key *pk) } +static void +print_keygrip (const char *keygrip) +{ + const char *s; + + s = strchr (keygrip, ','); + if (s) + es_fprintf (es_stdout, " Keygrip = %.*s,\n%*s%s\n", + (int)(s-keygrip), keygrip, 16, "", s+1); + else + es_fprintf (es_stdout, " Keygrip = %s\n", keygrip); +} + /* If PK is given the output is written to a new file instead of * stdout. */ @@ -1513,7 +1526,7 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr, print_fingerprint (ctrl, NULL, pk, 0); if (opt.with_keygrip && hexgrip) - es_fprintf (es_stdout, " Keygrip = %s\n", hexgrip); + print_keygrip (hexgrip); if (serialno) print_card_serialno (serialno); @@ -1670,7 +1683,7 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr, print_card_serialno (serialno); } if (opt.with_keygrip && hexgrip) - es_fprintf (es_stdout, " Keygrip = %s\n", hexgrip); + print_keygrip (hexgrip); if (opt.with_key_data) print_key_data (pk2); if (opt.with_key_screening) |