aboutsummaryrefslogtreecommitdiffstats
path: root/kbx/keybox-defs.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2004-08-24 19:55:47 +0000
committerWerner Koch <[email protected]>2004-08-24 19:55:47 +0000
commit2a09a35ad07494747f55957286fdc5ad78871451 (patch)
tree3b961e695a97fa554a93869b739dd939211bb11e /kbx/keybox-defs.h
parentFixed typo in ocsp OID. (diff)
downloadgnupg-2a09a35ad07494747f55957286fdc5ad78871451.tar.gz
gnupg-2a09a35ad07494747f55957286fdc5ad78871451.zip
* kbxutil.c: New command --import-openpgp.
(main): Updated libgcrypt initialization stuff. (my_gcry_logger): New. (read_file): New. Taken from ../agent/protect-tool. (dump_fpr, dump_openpgp_key, import_openpgp): New. * keybox-openpgp.c: New.
Diffstat (limited to 'kbx/keybox-defs.h')
-rw-r--r--kbx/keybox-defs.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/kbx/keybox-defs.h b/kbx/keybox-defs.h
index 759289a0e..4906a386e 100644
--- a/kbx/keybox-defs.h
+++ b/kbx/keybox-defs.h
@@ -82,6 +82,40 @@ struct keybox_handle {
};
+/* Openpgp helper structures. */
+struct _keybox_openpgp_key_info
+{
+ struct _keybox_openpgp_key_info *next;
+ unsigned char keyid[8];
+ int fprlen; /* Either 16 or 20 */
+ unsigned char fpr[20];
+};
+
+struct _keybox_openpgp_uid_info
+{
+ struct _keybox_openpgp_uid_info *next;
+ size_t off;
+ size_t len;
+};
+
+struct _keybox_openpgp_info
+{
+ int is_secret; /* True if this is a secret key. */
+ unsigned int nsubkeys;/* Total number of subkeys. */
+ unsigned int nuids; /* Total number of user IDs in the keyblock. */
+ unsigned int nsigs; /* Total number of signatures in the keyblock. */
+
+ /* Note, we use 2 structs here to better cope with the most common
+ use of having one primary and one subkey - this allows us to
+ statically allocate this structure and only malloc stuff for more
+ than one subkey. */
+ struct _keybox_openpgp_key_info primary;
+ struct _keybox_openpgp_key_info subkeys;
+ struct _keybox_openpgp_uid_info uids;
+};
+typedef struct _keybox_openpgp_info *keybox_openpgp_info_t;
+
+
/* Don't know whether this is needed: */
/* static struct { */
/* const char *homedir; */
@@ -108,6 +142,13 @@ const char *_keybox_get_blob_image (KEYBOXBLOB blob, size_t *n);
off_t _keybox_get_blob_fileoffset (KEYBOXBLOB blob);
void _keybox_update_header_blob (KEYBOXBLOB blob);
+/*-- keybox-openpgp.c --*/
+gpg_error_t _keybox_parse_openpgp (const unsigned char *image, size_t imagelen,
+ size_t *nparsed,
+ keybox_openpgp_info_t info);
+void _keybox_destroy_openpgp_info (keybox_openpgp_info_t info);
+
+
/*-- keybox-file.c --*/
int _keybox_read_blob (KEYBOXBLOB *r_blob, FILE *fp);
int _keybox_read_blob2 (KEYBOXBLOB *r_blob, FILE *fp, int *skipped_deleted);