diff options
author | Werner Koch <[email protected]> | 2025-06-20 13:52:54 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2025-06-20 13:52:54 +0000 |
commit | ce5e903beccf756ae23d9206bf91d17e9a6e4588 (patch) | |
tree | 92c6a5cd28c65453a8292bd9e99139024414367d | |
parent | gpg: Show revocation reason with a standard -k listing. (diff) | |
download | gnupg-ce5e903beccf756ae23d9206bf91d17e9a6e4588.tar.gz gnupg-ce5e903beccf756ae23d9206bf91d17e9a6e4588.zip |
gpg: Print the revocation reasons as comment in the pub record.
* g10/keylist.c (list_keyblock_colon): Print the revocation reasons in
the pub record's comment field.
--
GnuPG-bug-id: 7083
-rw-r--r-- | doc/DETAILS | 9 | ||||
-rw-r--r-- | g10/keylist.c | 20 |
2 files changed, 26 insertions, 3 deletions
diff --git a/doc/DETAILS b/doc/DETAILS index e9270479a..0504c80bb 100644 --- a/doc/DETAILS +++ b/doc/DETAILS @@ -296,9 +296,12 @@ described here. *** Field 21 - Comment - This is currently only used in "rev" and "rvs" records to carry - the the comment field of the revocation reason. The value is - quoted in C style. + This is currently only used in "rev", "rvs", ans "pub" records to + carry the comment field of the revocation reason. The value is + quoted in C style. For a "pub" record the comment is preceeded by + a human readable recovation reason followed by a LF; this allows + to show the import entire key revocation (class 0x20) reason + without running a --with-sigs listing. ** Special fields diff --git a/g10/keylist.c b/g10/keylist.c index 8b679987b..7bd25de74 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -2078,6 +2078,26 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock, es_write_sanitized (es_stdout, pk->updateurl, strlen (pk->updateurl), ":", NULL); es_putc (':', es_stdout); /* End of field 20 (origin). */ + if (pk->flags.revoked && pk->revoked.got_reason + && (pk->revoked.reason_code || pk->revoked.reason_comment)) + { + char *freeme; + const char *s; + size_t n; + + s = revocation_reason_code_to_str (pk->revoked.reason_code, &freeme); + n = strlen (s); + es_write_sanitized (es_stdout, s, n, ":", NULL); + if (n && s[n-1] != '.') + es_putc ('.', es_stdout); + es_putc ('\\', es_stdout); /* C-style escaped colon. */ + es_putc ('n', es_stdout); + es_write_sanitized (es_stdout, pk->revoked.reason_comment, + pk->revoked.reason_comment_len, + ":", NULL); + xfree (freeme); + es_putc (':', es_stdout); /* End of field 21 (comment). */ + } es_putc ('\n', es_stdout); print_revokers (es_stdout, 1, pk); |