aboutsummaryrefslogtreecommitdiffstats
path: root/g10/card-util.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-01-20 17:21:40 +0000
committerWerner Koch <[email protected]>2005-01-20 17:21:40 +0000
commitb2b2786be1047e921fe50263915a565252a802ed (patch)
treeed076a7824239cba29acb3e4d3cda91a8a3d9d41 /g10/card-util.c
parentMinor changes (diff)
downloadgnupg-b2b2786be1047e921fe50263915a565252a802ed.tar.gz
gnupg-b2b2786be1047e921fe50263915a565252a802ed.zip
* gpgv.c (tty_fprintf): New stub.
* card-util.c (card_status): Create asecret key stub on the fly and print more information about a card key. * import.c (pub_to_sec_keyblock, auto_create_card_key_stub): New. * getkey.c (get_seckeyblock_byfprint): New. * keylist.c (print_card_key_info): New.
Diffstat (limited to '')
-rw-r--r--g10/card-util.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/g10/card-util.c b/g10/card-util.c
index 8d38fb416..3b67400a4 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -1,5 +1,5 @@
/* card-util.c - Utility functions for the OpenPGP card.
- * Copyright (C) 2003 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -270,6 +270,7 @@ card_status (FILE *fp, char *serialno, size_t serialnobuflen)
PKT_public_key *pk = xcalloc (1, sizeof *pk);
int rc;
unsigned int uval;
+ const unsigned char *thefpr;
if (serialno && serialnobuflen)
*serialno = 0;
@@ -425,8 +426,34 @@ card_status (FILE *fp, char *serialno, size_t serialnobuflen)
tty_fprintf (fp, " created ....: %s\n",
asctimestamp (info.fpr3time));
tty_fprintf (fp, "General key info..: ");
- if (info.fpr1valid && !get_pubkey_byfprint (pk, info.fpr1, 20))
- print_pubkey_info (fp, pk);
+
+ thefpr = (info.fpr1valid? info.fpr1 : info.fpr2valid? info.fpr2 :
+ info.fpr3valid? info.fpr3 : NULL);
+ if ( thefpr && !get_pubkey_byfprint (pk, thefpr, 20))
+ {
+ KBNODE keyblock = NULL;
+
+ print_pubkey_info (fp, pk);
+
+ if ( !get_seckeyblock_byfprint (&keyblock, thefpr, 20) )
+ print_card_key_info (fp, keyblock);
+ else if ( !get_keyblock_byfprint (&keyblock, thefpr, 20) )
+ {
+ release_kbnode (keyblock);
+ keyblock = NULL;
+
+ if (!auto_create_card_key_stub (info.serialno,
+ info.fpr1valid? info.fpr1:NULL,
+ info.fpr2valid? info.fpr2:NULL,
+ info.fpr3valid? info.fpr3:NULL))
+ {
+ if ( !get_seckeyblock_byfprint (&keyblock, thefpr, 20) )
+ print_card_key_info (fp, keyblock);
+ }
+ }
+
+ release_kbnode (keyblock);
+ }
else
tty_fprintf (fp, "[none]\n");
}
@@ -1037,7 +1064,7 @@ generate_card_keys (const char *serialno)
}
-/* This fucntion is used by the key edit menu to generate an arbitrary
+/* This function is used by the key edit menu to generate an arbitrary
subkey. */
int
card_generate_subkey (KBNODE pub_keyblock, KBNODE sec_keyblock)