1 /* keydb.h - Key database routines
2 * Copyright (C) 2002-2012 Free Software Foundation, Inc.
6 * This file is part of OpenCDK.
8 * The OpenCDK library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 /* Internal key index structure. */
28 byte fpr
[KEY_FPR_LEN
];
30 typedef struct key_idx_s
*key_idx_t
;
32 /* Internal key cache to associate a key with an file offset. */
35 struct key_table_s
*next
;
38 typedef struct key_table_s
*key_table_t
;
40 typedef struct cdk_keydb_search_s
42 off_t off
; /* last file offset */
45 char *pattern
; /* A search is performed by pattern. */
46 u32 keyid
[2]; /* A search by keyid. */
47 byte fpr
[KEY_FPR_LEN
]; /* A search by fingerprint. */
50 struct key_table_s
*cache
;
52 unsigned int no_cache
:1; /* disable the index cache. */
55 char *idx_name
; /* name of the index file or NULL. */
59 /* Internal key database handle. */
62 int type
; /* type of the key db handle. */
63 int fp_ref
; /* 1=means it is a reference and shall not be closed. */
65 char *name
; /* name of the underlying file or NULL. */
66 unsigned int secret
:1; /* contain secret keys. */
67 unsigned int isopen
:1; /* the underlying stream is opened. */
69 /* structure to store some stats about the keydb. */
72 size_t new_keys
; /* amount of new keys that were imported. */