summaryrefslogtreecommitdiffstats
path: root/g10/keylist.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-05-07 12:01:12 +0200
committerWerner Koch <wk@gnupg.org>2015-05-07 12:12:41 +0200
commit874ef16e70ab750db7b153f17a7e859a0db6a2f1 (patch)
tree6dd9d2fba7ba5be68ee547a6ae5699ae9e4e941f /g10/keylist.c
parentgpg: Fix regression not displaying the card serial number (diff)
downloadgnupg2-874ef16e70ab750db7b153f17a7e859a0db6a2f1.tar.xz
gnupg2-874ef16e70ab750db7b153f17a7e859a0db6a2f1.zip
gpg: Improve 'General key info' line of --card-status.
* g10/keylist.c (print_pubkey_info): Print either "pub" or "sub". * g10/getkey.c (get_pubkey_byfprint): Add optional arg R_KEYBLOCK. * g10/keyid.c (keyid_from_fingerprint): Adjust for change. * g10/revoke.c (gen_desig_revoke): Adjust for change. * g10/card-util.c (card_status): Simplify by using new arg. Align card-no string. * g10/card-util.c (card_status): Remove not used GnuPG-1 code. -- This now prints "sub" if the first used card key is actually a subkey. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/keylist.c')
-rw-r--r--g10/keylist.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/g10/keylist.c b/g10/keylist.c
index d62bc2006..2cd988d41 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -170,7 +170,7 @@ print_seckey_info (PKT_public_key *pk)
the tty output interface is used, otherwise output is directted to
the given stream. */
void
-print_pubkey_info (estream_t fp, PKT_public_key * pk)
+print_pubkey_info (estream_t fp, PKT_public_key *pk)
{
u32 keyid[2];
char *p;
@@ -187,7 +187,8 @@ print_pubkey_info (estream_t fp, PKT_public_key * pk)
if (fp)
tty_printf ("\n");
- tty_fprintf (fp, "pub %s/%s %s %s\n",
+ tty_fprintf (fp, "%s %s/%s %s %s\n",
+ pk->flags.primary? "pub":"sub",
pubkey_string (pk, pkstrbuf, sizeof pkstrbuf),
keystr (keyid), datestr_from_pk (pk), p);
xfree (p);
@@ -205,6 +206,7 @@ print_card_key_info (estream_t fp, kbnode_t keyblock)
char *serialno;
int s2k_char;
char pkstrbuf[PUBKEY_STRING_SIZE];
+ int indent;
for (node = keyblock; node; node = node->next)
{
@@ -226,18 +228,18 @@ print_card_key_info (estream_t fp, kbnode_t keyblock)
else
s2k_char = '#'; /* Key not found. */
- tty_fprintf (fp, "%s%c %s/%s ",
+ tty_fprintf (fp, "%s%c %s/%s %n",
node->pkt->pkttype == PKT_PUBLIC_KEY ? "sec" : "ssb",
s2k_char,
pubkey_string (pk, pkstrbuf, sizeof pkstrbuf),
- keystr_from_pk (pk));
+ keystr_from_pk (pk),
+ &indent);
tty_fprintf (fp, _("created: %s"), datestr_from_pk (pk));
tty_fprintf (fp, " ");
tty_fprintf (fp, _("expires: %s"), expirestr_from_pk (pk));
if (serialno)
{
- tty_fprintf (fp, "\n ");
- tty_fprintf (fp, _("card-no: "));
+ tty_fprintf (fp, "\n%*s%s", indent, "", _("card-no: "));
if (strlen (serialno) == 32
&& !strncmp (serialno, "D27600012401", 12))
{