1 /* keybox.h - Keybox operations
2 * Copyright (C) 2001, 2003 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
29 #include "keybox-search-desc.h"
31 #define KEYBOX_WITH_OPENPGP 1
32 #define KEYBOX_WITH_X509 1
35 #ifdef KEYBOX_WITH_OPENPGP
36 # undef KEYBOX_WITH_OPENPGP
37 /*#include <lib-to-handle-gpg-data-structs.h>*/
40 #ifdef KEYBOX_WITH_X509
44 typedef struct keybox_handle
*KEYBOX_HANDLE
;
49 KEYBOX_FLAG_BLOB
, /* The blob flags. */
50 KEYBOX_FLAG_VALIDITY
, /* The validity of the entire key. */
51 KEYBOX_FLAG_OWNERTRUST
, /* The assigned ownertrust. */
52 KEYBOX_FLAG_KEY
, /* The key flags; requires a key index. */
53 KEYBOX_FLAG_UID
, /* The user ID flags; requires an uid index. */
54 KEYBOX_FLAG_UID_VALIDITY
,/* The validity of a specific uid, requires
56 KEYBOX_FLAG_CREATED_AT
/* The date the block was created. */
59 /* Flag values used with KEYBOX_FLAG_BLOB. */
60 #define KEYBOX_FLAG_BLOB_SECRET 1
61 #define KEYBOX_FLAG_BLOB_EPHEMERAL 2
65 /*-- keybox-init.c --*/
66 void *keybox_register_file (const char *fname
, int secret
);
67 int keybox_is_writable (void *token
);
69 KEYBOX_HANDLE
keybox_new (void *token
, int secret
);
70 void keybox_release (KEYBOX_HANDLE hd
);
71 const char *keybox_get_resource_name (KEYBOX_HANDLE hd
);
72 int keybox_set_ephemeral (KEYBOX_HANDLE hd
, int yes
);
75 /*-- keybox-search.c --*/
76 #ifdef KEYBOX_WITH_X509
77 int keybox_get_cert (KEYBOX_HANDLE hd
, ksba_cert_t
*ret_cert
);
78 #endif /*KEYBOX_WITH_X509*/
79 int keybox_get_flags (KEYBOX_HANDLE hd
, int what
, int idx
, unsigned int *value
);
81 int keybox_search_reset (KEYBOX_HANDLE hd
);
82 int keybox_search (KEYBOX_HANDLE hd
, KEYBOX_SEARCH_DESC
*desc
, size_t ndesc
);
85 /*-- keybox-update.c --*/
86 #ifdef KEYBOX_WITH_X509
87 int keybox_insert_cert (KEYBOX_HANDLE hd
, ksba_cert_t cert
,
88 unsigned char *sha1_digest
);
89 int keybox_update_cert (KEYBOX_HANDLE hd
, ksba_cert_t cert
,
90 unsigned char *sha1_digest
);
91 #endif /*KEYBOX_WITH_X509*/
92 int keybox_set_flags (KEYBOX_HANDLE hd
, int what
, int idx
, unsigned int value
);
94 int keybox_delete (KEYBOX_HANDLE hd
);
95 int keybox_compress (KEYBOX_HANDLE hd
);
101 int keybox_lock (KEYBOX_HANDLE hd
, int yes
);
102 int keybox_get_keyblock (KEYBOX_HANDLE hd
, KBNODE
*ret_kb
);
103 int keybox_locate_writable (KEYBOX_HANDLE hd
);
104 int keybox_search_reset (KEYBOX_HANDLE hd
);
105 int keybox_search (KEYBOX_HANDLE hd
, KEYDB_SEARCH_DESC
*desc
, size_t ndesc
);
106 int keybox_rebuild_cache (void *);
110 /*-- keybox-util.c --*/
111 void keybox_set_malloc_hooks ( void *(*new_alloc_func
)(size_t n
),
112 void *(*new_realloc_func
)(void *p
, size_t n
),
113 void (*new_free_func
)(void*) );