aboutsummaryrefslogtreecommitdiffstats
path: root/tools/card-tool.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-01-30 14:01:34 +0000
committerWerner Koch <[email protected]>2019-01-30 14:01:34 +0000
commit833f27a6a7e059e38bccaf360f05e72e4403545a (patch)
tree3de745f43d9d3d12fa19d551ea7225f3f0854def /tools/card-tool.h
parentgpg: Emit an ERROR status if no key was found with --list-keys. (diff)
downloadgnupg-833f27a6a7e059e38bccaf360f05e72e4403545a.tar.gz
gnupg-833f27a6a7e059e38bccaf360f05e72e4403545a.zip
card: Print matching OpenPGP and X.509 data.
* tools/card-tool-keys.c: New. * tools/Makefile.am (gpg_card_tool_SOURCES): Add file. * tools/card-tool.h (struct pubkey_s, pubkey_t): New. (struct userid_s, userid_t): New. (struct keyblock_s, keyblock_t): New. * common/util.h (GNUPG_PROTOCOL_): New const * tools/gpg-card-tool.c (aTest): Add temporary command. (list_one_kinfo): Print info from gpg and gpgsm. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tools/card-tool.h')
-rw-r--r--tools/card-tool.h48
1 files changed, 45 insertions, 3 deletions
diff --git a/tools/card-tool.h b/tools/card-tool.h
index b1d866228..d502ecb58 100644
--- a/tools/card-tool.h
+++ b/tools/card-tool.h
@@ -50,6 +50,41 @@ struct
#define DBG_IPC (opt.debug & DBG_IPC_VALUE)
#define DBG_EXTPROG (opt.debug & DBG_EXTPROG_VALUE)
+/* The maximum length of a binary fingerprint. */
+#define MAX_FINGERPRINT_LEN 32
+
+
+/*
+ * Data structures to store keyblocks (aka certificates).
+ */
+struct pubkey_s
+{
+ struct pubkey_s *next; /* The next key. */
+ unsigned char grip[KEYGRIP_LEN];
+ unsigned char fpr[MAX_FINGERPRINT_LEN];
+ unsigned char fprlen; /* The used length of a FPR. */
+ unsigned int grip_valid:1;/* The grip is valid. */
+ unsigned int requested: 1;/* This is the requested grip. */
+};
+typedef struct pubkey_s *pubkey_t;
+
+struct userid_s
+{
+ struct userid_s *next;
+ char *value; /* Malloced. */
+};
+typedef struct userid_s *userid_t;
+
+struct keyblock_s
+{
+ struct keyblock_s *next; /* Allow to link several keyblocks. */
+ int protocol; /* GPGME_PROTOCOL_OPENPGP or _CMS. */
+ pubkey_t keys; /* The key. For OpenPGP primary + list of subkeys. */
+ userid_t uids; /* The list of user ids. */
+};
+typedef struct keyblock_s *keyblock_t;
+
+
/* Enumeration of the known card application types. */
typedef enum
@@ -76,9 +111,9 @@ 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. */
+/* An object to store information pertaining to a key pair as stored
+ * on a card. 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;
@@ -144,6 +179,13 @@ struct card_info_s
typedef struct card_info_s *card_info_t;
+/*-- card-tool-keys.c --*/
+void release_keyblock (keyblock_t keyblock);
+gpg_error_t get_matching_keys (const unsigned char *keygrip, int protocol,
+ keyblock_t *r_keyblock);
+gpg_error_t test_get_matching_keys (const char *hexgrip);
+
+
/*-- card-tool-misc.c --*/
key_info_t find_kinfo (card_info_t info, const char *keyref);