aboutsummaryrefslogtreecommitdiffstats
path: root/tools/card-tool.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-01-29 07:48:53 +0000
committerWerner Koch <[email protected]>2019-01-29 08:32:20 +0000
commit237880175f59d372011cd2e20bb49726eeccf058 (patch)
tree3f33ff4bf6d008ca0553ba0a913792970c9c73c3 /tools/card-tool.h
parentagent: Clear bogus pinentry cache, when it causes an error. (diff)
downloadgnupg-237880175f59d372011cd2e20bb49726eeccf058.tar.gz
gnupg-237880175f59d372011cd2e20bb49726eeccf058.zip
card: Make printing of key information more flexible.
* tools/card-tool-misc.c: New. * tools/card-tool.h: Rewored data structures for key infos. * tools/gpg-card-tool.c: Ditto. * tools/card-call-scd.c: Ditto. -- Note that this also changes the way the key information is printed. Formerly we printed it like: Signature key ....: <openpgp-fingerprint> created ....: <timestamp> keygrip ... : <keygrip> now we do: Signature key ....: <keygrip> fingerprint : <openpgp-fingerprint> created ....: <timestamp> This is because a keygrip is always available but a fingerprint and the creation date are properties of an OpenPGP card. A standard way of listing keys is better than one depending on the type of card. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tools/card-tool.h')
-rw-r--r--tools/card-tool.h37
1 files changed, 25 insertions, 12 deletions
diff --git a/tools/card-tool.h b/tools/card-tool.h
index d51698c76..0af618676 100644
--- a/tools/card-tool.h
+++ b/tools/card-tool.h
@@ -76,6 +76,26 @@ struct key_attr
};
};
+/* An object to store information pertaining to a key pair. This is
+ * commonly used as a linked list with all keys known for the current
+ * card. */
+struct key_info_s
+{
+ struct key_info_s *next;
+
+ unsigned char grip[20];/* The keygrip. */
+
+ unsigned char xflag; /* Temporary flag to help processing a list. */
+
+ /* The three next items are mostly useful for OpenPGP cards. */
+ unsigned char fprlen; /* Use length of the next item. */
+ unsigned char fpr[32]; /* The binary fingerprint of length FPRLEN. */
+ u32 created; /* The time the key was created. */
+
+ char keyref[1]; /* String with the keyref (e.g. OPENPGP.1). */
+};
+typedef struct key_info_s *key_info_t;
+
/*
* The object used to store information about a card.
@@ -100,18 +120,7 @@ struct card_info_s
char cafpr1[20];
char cafpr2[20];
char cafpr3[20];
- unsigned char fpr1len; /* Length of the fingerprint or 0 if invalid. */
- unsigned char fpr2len;
- unsigned char fpr3len;
- char fpr1[20];
- char fpr2[20];
- char fpr3[20];
- u32 fpr1time;
- u32 fpr2time;
- u32 fpr3time;
- char grp1[20]; /* The keygrip for OPENPGP.1 */
- char grp2[20]; /* The keygrip for OPENPGP.2 */
- char grp3[20]; /* The keygrip for OPENPGP.3 */
+ key_info_t kinfo; /* Linked list with all keypair related data. */
unsigned long sig_counter;
int chv1_cached; /* True if a PIN is not required for each
signing. Note that the gpg-agent might cache
@@ -133,6 +142,10 @@ struct card_info_s
typedef struct card_info_s *card_info_t;
+/*-- card-tool-misc.c --*/
+key_info_t find_kinfo (card_info_t info, const char *keyref);
+
+
/*-- card-call-scd.c --*/
void release_card_info (card_info_t info);
const char *app_type_string (app_type_t app_type);