1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Print the keyid for key packets with --list-packets.

* g10/parse-packet.c (parse_key): Add keyid printing.
--

This is backport from GnuPG-2.  Note that the --list-packets command
is for debugging only and not part iof the stable API.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2013-10-18 10:24:32 +02:00
parent 9d89564a42
commit 0bdf121d1d

View File

@ -1621,6 +1621,7 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
int npkey, nskey;
int is_v4=0;
int rc=0;
u32 keyid[2];
version = iobuf_get_noeof(inp); pktlen--;
if( pkttype == PKT_PUBLIC_SUBKEY && version == '#' ) {
@ -1718,7 +1719,6 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
unknown_pubkey_warning( algorithm );
}
if( pkttype == PKT_SECRET_KEY || pkttype == PKT_SECRET_SUBKEY ) {
PKT_secret_key *sk = pkt->pkt.secret_key;
byte temp[16];
@ -1743,6 +1743,9 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
}
if (rc) /* one of the MPIs were bad */
goto leave;
if (list_mode && npkey)
keyid_from_sk (sk, keyid);
sk->protect.algo = iobuf_get_noeof(inp); pktlen--;
sk->protect.sha1chk = 0;
if( sk->protect.algo ) {
@ -1973,8 +1976,15 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
}
if (rc)
goto leave;
if (list_mode)
keyid_from_pk (pk, keyid);
}
if (list_mode && npkey)
fprintf (listfp, "\tkeyid: %08lX%08lX\n",
(ulong) keyid[0], (ulong) keyid[1]);
leave:
iobuf_skip_rest(inp, pktlen, 0);
return rc;