From: Daniel Kahn Gillmor Date: Tue, 12 Jun 2018 06:41:30 +0000 (-0400) Subject: gpg: Print revocation certificate details when showing with-colons. X-Git-Tag: archive/raspbian/2.2.10-1+rpi1~1^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=414f1ea72a57293a69580fe118cd60d6642d783d;p=gnupg2.git gpg: Print revocation certificate details when showing with-colons. * g10/import.c (import_revoke_cert): add options argument, and print colon-delimited output for revocation certificate as requested. -- I looked into trying to make this work with one of the functions in g10/keylist.c, but i saw nothing that will accept a revocation certificate on its own, so i'm replicating the functionality directly in g10/import.c. This is a bit unfortunate because the code for describing a revocation cert now exists in two separate places, but refactoring both list_keyblock_print() and list_keyblock_colon() in g10/keylist.c seems like a much heavier lift. GnuPG-Bug-id: 4018 Signed-off-by: Daniel Kahn Gillmor Gbp-Pq: Topic show-revocation-cert Gbp-Pq: Name gpg-Print-revocation-certificate-details-when-showing-wit.patch --- diff --git a/g10/import.c b/g10/import.c index 6dad8ee..5236263 100644 --- a/g10/import.c +++ b/g10/import.c @@ -2890,6 +2890,24 @@ import_revoke_cert (ctrl_t ctrl, kbnode_t node, unsigned int options, keyid[0] = node->pkt->pkt.signature->keyid[0]; keyid[1] = node->pkt->pkt.signature->keyid[1]; + if ((options & IMPORT_SHOW) && + (opt.with_colons)) + { + PKT_signature *sig = node->pkt->pkt.signature; + char *issuer_fpr = issuer_fpr = issuer_fpr_string (sig); + + es_fprintf (es_stdout, "rvs::%d:%08lX%08lX:%s:%s:::::::%s:::%d:\n", + sig->pubkey_algo, + (ulong) sig->keyid[0], (ulong) sig->keyid[1], + colon_datestr_from_sig (sig), + colon_expirestr_from_sig (sig), + issuer_fpr ? issuer_fpr : "", + sig->digest_algo); + + xfree (issuer_fpr); + es_fflush (es_stdout); + } + pk = xmalloc_clear( sizeof *pk ); rc = get_pubkey (ctrl, pk, keyid ); if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY )