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 2 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, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
30
#include "keybox-search-desc.h"
32
#define KEYBOX_WITH_OPENPGP 1
33
#define KEYBOX_WITH_X509 1
36
#ifdef KEYBOX_WITH_OPENPGP
37
# undef KEYBOX_WITH_OPENPGP
38
/*#include <lib-to-handle-gpg-data-structs.h>*/
41
#ifdef KEYBOX_WITH_X509
45
typedef struct keybox_handle *KEYBOX_HANDLE;
50
KEYBOX_FLAG_BLOB, /* The blob flags. */
51
KEYBOX_FLAG_VALIDITY, /* The validity of the entire key. */
52
KEYBOX_FLAG_OWNERTRUST, /* The assigned ownertrust. */
53
KEYBOX_FLAG_KEY, /* The key flags; requires a key index. */
54
KEYBOX_FLAG_UID, /* The user ID flags; requires an uid index. */
55
KEYBOX_FLAG_UID_VALIDITY,/* The validity of a specific uid, requires
57
KEYBOX_FLAG_CREATED_AT /* The date the block was created. */
61
/*-- keybox-init.c --*/
62
void *keybox_register_file (const char *fname, int secret);
63
int keybox_is_writable (void *token);
65
KEYBOX_HANDLE keybox_new (void *token, int secret);
66
void keybox_release (KEYBOX_HANDLE hd);
67
const char *keybox_get_resource_name (KEYBOX_HANDLE hd);
68
int keybox_set_ephemeral (KEYBOX_HANDLE hd, int yes);
71
/*-- keybox-search.c --*/
72
#ifdef KEYBOX_WITH_X509
73
int keybox_get_cert (KEYBOX_HANDLE hd, ksba_cert_t *ret_cert);
74
#endif /*KEYBOX_WITH_X509*/
75
int keybox_get_flags (KEYBOX_HANDLE hd, int what, int idx, unsigned int *value);
77
int keybox_search_reset (KEYBOX_HANDLE hd);
78
int keybox_search (KEYBOX_HANDLE hd, KEYBOX_SEARCH_DESC *desc, size_t ndesc);
81
/*-- keybox-update.c --*/
82
#ifdef KEYBOX_WITH_X509
83
int keybox_insert_cert (KEYBOX_HANDLE hd, ksba_cert_t cert,
84
unsigned char *sha1_digest);
85
int keybox_update_cert (KEYBOX_HANDLE hd, ksba_cert_t cert,
86
unsigned char *sha1_digest);
87
#endif /*KEYBOX_WITH_X509*/
88
int keybox_set_flags (KEYBOX_HANDLE hd, int what, int idx, unsigned int value);
90
int keybox_delete (KEYBOX_HANDLE hd);
91
int keybox_compress (KEYBOX_HANDLE hd);
97
int keybox_lock (KEYBOX_HANDLE hd, int yes);
98
int keybox_get_keyblock (KEYBOX_HANDLE hd, KBNODE *ret_kb);
99
int keybox_locate_writable (KEYBOX_HANDLE hd);
100
int keybox_search_reset (KEYBOX_HANDLE hd);
101
int keybox_search (KEYBOX_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc);
102
int keybox_rebuild_cache (void *);
106
/*-- keybox-util.c --*/
107
void keybox_set_malloc_hooks ( void *(*new_alloc_func)(size_t n),
108
void *(*new_realloc_func)(void *p, size_t n),
109
void (*new_free_func)(void*) );