1 |
twoaday |
2 |
/* key.h |
2 |
|
|
* Copyright (C) 2000, 2001 Werner Koch (dd9jn), g10 Code GmbH |
3 |
|
|
* Copyright (C) 2002-2004 Timo Schulz |
4 |
|
|
* |
5 |
|
|
* This file is part of MyGPGME. |
6 |
|
|
* |
7 |
|
|
* MyGPGME 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. |
11 |
|
|
* |
12 |
|
|
* MyGPGME 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. |
16 |
|
|
* |
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
#ifndef GPGME_KEY_H |
23 |
|
|
#define GPGME_KEY_H |
24 |
|
|
|
25 |
|
|
#include "types.h" |
26 |
|
|
#include "context.h" |
27 |
|
|
|
28 |
|
|
struct signature_s { |
29 |
|
|
struct signature_s * next; |
30 |
|
|
int algo; |
31 |
|
|
int stat; |
32 |
|
|
char keyid[16+1]; |
33 |
|
|
unsigned int created; |
34 |
|
|
unsigned int expires; |
35 |
|
|
int sigclass; |
36 |
|
|
unsigned int is_local:1; |
37 |
|
|
unsigned int is_nonrev:1; |
38 |
|
|
char * issuer; |
39 |
|
|
char * user_id; /* belongs to this user id */ |
40 |
|
|
}; |
41 |
|
|
|
42 |
|
|
struct revoker_key_s { |
43 |
|
|
struct revoker_key_s * next; |
44 |
|
|
unsigned int algo; |
45 |
|
|
char fpr[41]; |
46 |
|
|
}; |
47 |
|
|
|
48 |
|
|
struct subkey_s { |
49 |
|
|
struct subkey_s * next; |
50 |
|
|
unsigned int secret:1; |
51 |
|
|
struct { |
52 |
|
|
unsigned int revoked:1; |
53 |
|
|
unsigned int expired:1; |
54 |
|
|
unsigned int disabled:1; |
55 |
|
|
unsigned int invalid:1; |
56 |
|
|
unsigned int can_encrypt:1; |
57 |
|
|
unsigned int can_sign:1; |
58 |
|
|
unsigned int can_certify:1; |
59 |
|
|
unsigned int can_auth:1; |
60 |
|
|
} flags; |
61 |
|
|
unsigned int key_algo; |
62 |
|
|
unsigned int key_len; |
63 |
|
|
char keyid[16+1]; |
64 |
|
|
char cardno[32+1]; |
65 |
|
|
char * fingerprint; /* malloced hex digits */ |
66 |
|
|
long timestamp; /* -1 for invalid, 0 for not available */ |
67 |
|
|
long expires; |
68 |
|
|
}; |
69 |
|
|
|
70 |
|
|
struct mpi_s { |
71 |
|
|
struct mpi_s * next; |
72 |
|
|
int bits; |
73 |
|
|
char * hexval; |
74 |
|
|
}; |
75 |
|
|
|
76 |
|
|
struct gpgme_key_s { |
77 |
|
|
struct { |
78 |
|
|
unsigned int ultimate:1; |
79 |
|
|
unsigned int revoked:1 ; |
80 |
|
|
unsigned int expired:1 ; |
81 |
|
|
unsigned int disabled:1 ; |
82 |
|
|
unsigned int invalid:1 ; |
83 |
|
|
unsigned int can_encrypt:1; |
84 |
|
|
unsigned int can_sign:1; |
85 |
|
|
unsigned int can_certify:1; |
86 |
|
|
unsigned int can_auth:1; |
87 |
|
|
unsigned int is_protected:1; |
88 |
|
|
unsigned int divert_to_card:1; |
89 |
|
|
} gloflags; |
90 |
|
|
struct { |
91 |
|
|
unsigned used:1; |
92 |
|
|
unsigned char * d; |
93 |
|
|
int len; |
94 |
|
|
} attrib; |
95 |
|
|
unsigned int ref_count; |
96 |
|
|
unsigned int secret:1; |
97 |
|
|
unsigned int otrust; |
98 |
|
|
unsigned int validity; |
99 |
|
|
unsigned char * sym_prefs; |
100 |
|
|
struct subkey_s keys; |
101 |
|
|
struct user_id_s * uids; |
102 |
|
|
struct revoker_key_s * rvks; |
103 |
|
|
struct signature_s * sigs; |
104 |
|
|
struct mpi_s * pkey; |
105 |
|
|
}; |
106 |
|
|
|
107 |
|
|
struct signature_s * _gpgme_key_add_signature( gpgme_key_t key ); |
108 |
|
|
struct subkey_s * _gpgme_key_add_subkey( gpgme_key_t key ); |
109 |
|
|
struct subkey_s * _gpgme_key_add_secret_subkey( gpgme_key_t key ); |
110 |
|
|
gpgme_error_t _gpgme_key_append_name (gpgme_key_t key, const char * s, |
111 |
|
|
struct user_id_s ** u); |
112 |
|
|
|
113 |
|
|
#endif /* GPGME_KEY_H */ |