1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

gpg: Show revocation reason with a standard -k listing.

* g10/packet.h (struct revoke_info): Extend to carry the recocation
reason.
* g10/getkey.c (sig_to_revoke_info): Extend to strore the reason.
(merge_selfsigs): Extend to also store the reason in the public key.
* g10/keylist.c (list_signature_print): Factor some code out to ...
(print_revocation_reason_comment): new function.
(print_revocation_reason): New.
(print_key_line): Call new function to print the reason.
* g10/import.c (get_revocation_reason): Use
print_revocation_reason_comment and factor some code out to ...
(revocation_reason_code_to_str): new function.

* g10/gpgv.c (revocation_reason_code_to_str): Add stub.
* g10/test-stubs.c (revocation_reason_code_to_str): Ditto.
--

With this change the revocation reason of a revoked key (but not for a
revoked uid or subkey) is now displayed in "gpg -k" listing right
below the primary key fingerprint.  Before that "gpg --checks-sigs"
was required to do show this info.

GnuPG-bug-id: 7083
This commit is contained in:
Werner Koch 2025-06-20 15:17:19 +02:00
parent 22fc07640a
commit 3f825b044b
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
8 changed files with 188 additions and 74 deletions

View file

@ -161,6 +161,11 @@ release_public_key_parts (PKT_public_key *pk)
xfree (pk->updateurl);
pk->updateurl = NULL;
}
if (pk->revoked.reason_comment)
{
xfree (pk->revoked.reason_comment);
pk->revoked.reason_comment = NULL;
}
}
@ -231,6 +236,10 @@ copy_public_key_basics (PKT_public_key *d, PKT_public_key *s)
d->seckey_info = NULL;
d->user_id = NULL;
d->prefs = NULL;
d->revoked.got_reason = 0;
d->revoked.reason_code = 0;
d->revoked.reason_comment = NULL;
d->revoked.reason_comment_len = 0;
n = pubkey_get_npkey (s->pubkey_algo);
i = 0;
@ -274,6 +283,18 @@ copy_public_key (PKT_public_key *d, PKT_public_key *s)
d->serialno = xstrdup (s->serialno);
if (s->updateurl)
d->updateurl = xstrdup (s->updateurl);
if (s->revoked.got_reason)
{
d->revoked.got_reason = s->revoked.got_reason;
d->revoked.reason_code = s->revoked.reason_code;
if (s->revoked.reason_comment_len)
{
d->revoked.reason_comment = xmalloc (s->revoked.reason_comment_len);
memcpy (d->revoked.reason_comment, s->revoked.reason_comment,
s->revoked.reason_comment_len);
d->revoked.reason_comment_len = s->revoked.reason_comment_len;
}
}
return d;
}