Fix for bug 797.
[gnupg.git] / g10 / trustdb.h
blob2d0581f9b71666ea416788813d023c312f2ff012
1 /* trustdb.h - Trust database
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3 * 2005 Free Software Foundation, Inc.
5 * This file is part of GnuPG.
7 * GnuPG is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * GnuPG is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 * USA.
23 #ifndef G10_TRUSTDB_H
24 #define G10_TRUSTDB_H
26 /* Trust values must be sorted in ascending order */
27 #define TRUST_MASK 15
28 #define TRUST_UNKNOWN 0 /* o: not yet calculated/assigned */
29 #define TRUST_EXPIRED 1 /* e: calculation may be invalid */
30 #define TRUST_UNDEFINED 2 /* q: not enough information for calculation */
31 #define TRUST_NEVER 3 /* n: never trust this pubkey */
32 #define TRUST_MARGINAL 4 /* m: marginally trusted */
33 #define TRUST_FULLY 5 /* f: fully trusted */
34 #define TRUST_ULTIMATE 6 /* u: ultimately trusted */
35 /* trust values not covered by the mask */
36 #define TRUST_FLAG_REVOKED 32 /* r: revoked */
37 #define TRUST_FLAG_SUB_REVOKED 64 /* r: revoked but for subkeys */
38 #define TRUST_FLAG_DISABLED 128 /* d: key/uid disabled */
39 #define TRUST_FLAG_PENDING_CHECK 256 /* a check-trustdb is pending */
41 #define NAMEHASH_HASH DIGEST_ALGO_RMD160
42 #define NAMEHASH_LEN 20
44 /*-- trustdb.c --*/
45 void register_trusted_keyid(u32 *keyid);
46 void register_trusted_key( const char *string );
47 void check_trustdb (void);
48 void update_trustdb (void);
49 int setup_trustdb( int level, const char *dbname );
50 void init_trustdb( void );
51 void check_trustdb_stale(void);
52 void sync_trustdb( void );
54 const char *uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid);
55 const char *trust_value_to_string (unsigned int value);
56 int string_to_trust_value (const char *str);
58 void revalidation_mark (void);
59 int trustdb_pending_check(void);
60 void trustdb_check_or_update(void);
62 int cache_disabled_value(PKT_public_key *pk);
64 unsigned int get_validity (PKT_public_key *pk, PKT_user_id *uid);
65 int get_validity_info (PKT_public_key *pk, PKT_user_id *uid);
66 const char *get_validity_string (PKT_public_key *pk, PKT_user_id *uid);
68 void list_trust_path( const char *username );
69 int enum_cert_paths( void **context, ulong *lid,
70 unsigned *ownertrust, unsigned *validity );
71 void enum_cert_paths_print( void **context, FILE *fp,
72 int refresh, ulong selected_lid );
74 void read_trust_options(byte *trust_model,ulong *created,ulong *nextcheck,
75 byte *marginals,byte *completes,byte *cert_depth);
77 unsigned int get_ownertrust (PKT_public_key *pk);
78 unsigned int get_min_ownertrust (PKT_public_key *pk);
79 int get_ownertrust_info (PKT_public_key *pk);
80 const char *get_ownertrust_string (PKT_public_key *pk);
82 void update_ownertrust (PKT_public_key *pk, unsigned int new_trust );
83 int clear_ownertrusts (PKT_public_key *pk);
85 void clean_one_uid(KBNODE keyblock,KBNODE uidnode,int noisy,int self_only,
86 int *uids_cleaned,int *sigs_cleaned);
87 void clean_key(KBNODE keyblock,int noisy,int self_only,
88 int *uids_cleaned,int *sigs_cleaned);
90 /*-- tdbdump.c --*/
91 void list_trustdb(const char *username);
92 void export_ownertrust(void);
93 void import_ownertrust(const char *fname);
95 /*-- pkclist.c --*/
96 int edit_ownertrust (PKT_public_key *pk, int mode );
98 #endif /*G10_TRUSTDB_H*/