aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2013-10-18 08:24:32 +0000
committerWerner Koch <[email protected]>2013-10-18 08:24:32 +0000
commit0bdf121d1dcf98d7df28af67272caaac07f6f581 (patch)
treeb0a4d73093cb96ac056c8f881e23dc3a4cb082b0
parentmpi: Fix syntax error for mips64 and gcc < 4.4 (diff)
downloadgnupg-0bdf121d1dcf98d7df28af67272caaac07f6f581.tar.gz
gnupg-0bdf121d1dcf98d7df28af67272caaac07f6f581.zip
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 <[email protected]>
-rw-r--r--g10/parse-packet.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index b22c63ffd..dcda8ef59 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -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;