1 | /* gpgme.h - Public interface to GnuPG Made Easy. -*- c -*- |
2 | Copyright (C) 2000 Werner Koch (dd9jn) |
3 | Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009 |
4 | 2010, 2011, 2012, 2013, 2014 g10 Code GmbH |
5 | |
6 | This file is part of GPGME. |
7 | |
8 | GPGME is free software; you can redistribute it and/or modify it |
9 | under the terms of the GNU Lesser General Public License as |
10 | published by the Free Software Foundation; either version 2.1 of |
11 | the License, or (at your option) any later version. |
12 | |
13 | GPGME 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. |
17 | |
18 | You should have received a copy of the GNU Lesser General Public |
19 | License along with this program; if not, see <http://www.gnu.org/licenses/>. |
20 | |
21 | Generated from gpgme.h.in for x86_64-unknown-linux-gnu. */ |
22 | |
23 | #ifndef GPGME_H |
24 | #define GPGME_H |
25 | |
26 | #ifdef __GNUC__ |
27 | #define _GPGME_INLINE __inline__ |
28 | #elif __STDC_VERSION__ >= 199901L |
29 | #define _GPGME_INLINE inline |
30 | #else |
31 | #define _GPGME_INLINE |
32 | #endif |
33 | |
34 | /* Include stdio.h for the FILE type definition. */ |
35 | #include <stdio.h> |
36 | #include <time.h> |
37 | #include <gpg-error.h> |
38 | |
39 | #ifdef __cplusplus |
40 | extern "C" { |
41 | #if 0 /* just to make Emacs auto-indent happy */ |
42 | } |
43 | #endif |
44 | #endif /* __cplusplus */ |
45 | |
46 | |
47 | #include <sys/types.h> |
48 | typedef off_t gpgme_off_t; |
49 | typedef ssize_t gpgme_ssize_t; |
50 | |
51 | |
52 | /* Check for compiler features. */ |
53 | #if __GNUC__ |
54 | #define _GPGME_GCC_VERSION (__GNUC__ * 10000 \ |
55 | + __GNUC_MINOR__ * 100 \ |
56 | + __GNUC_PATCHLEVEL__) |
57 | |
58 | #if _GPGME_GCC_VERSION > 30100 |
59 | #define _GPGME_DEPRECATED __attribute__ ((__deprecated__)) |
60 | #endif |
61 | #endif |
62 | |
63 | #ifndef _GPGME_DEPRECATED |
64 | #define _GPGME_DEPRECATED |
65 | #endif |
66 | |
67 | /* The macro _GPGME_DEPRECATED_OUTSIDE_GPGME suppresses warnings for |
68 | fields we must access in GPGME for ABI compatibility. */ |
69 | #ifdef _GPGME_IN_GPGME |
70 | #define _GPGME_DEPRECATED_OUTSIDE_GPGME |
71 | #else |
72 | #define _GPGME_DEPRECATED_OUTSIDE_GPGME _GPGME_DEPRECATED |
73 | #endif |
74 | |
75 | |
76 | /* The version of this header should match the one of the library. Do |
77 | not use this symbol in your application, use gpgme_check_version |
78 | instead. The purpose of this macro is to let autoconf (using the |
79 | AM_PATH_GPGME macro) check that this header matches the installed |
80 | library. */ |
81 | #define GPGME_VERSION "1.5.0" |
82 | |
83 | /* The version number of this header. It may be used to handle minor |
84 | API incompatibilities. */ |
85 | #define GPGME_VERSION_NUMBER 0x010500 |
86 | |
87 | /* Check for a matching _FILE_OFFSET_BITS definition. */ |
88 | #if 0 |
89 | #ifndef _FILE_OFFSET_BITS |
90 | #error GPGME was compiled with _FILE_OFFSET_BITS = 0, please see the section "Largefile support (LFS)" in the GPGME manual. |
91 | #else |
92 | #if (_FILE_OFFSET_BITS) != (0) |
93 | #error GPGME was compiled with a different value for _FILE_OFFSET_BITS, namely 0, please see the section "Largefile support (LFS)" in the GPGME manual. |
94 | #endif |
95 | #endif |
96 | #endif |
97 | |
98 | |
99 | |
100 | /* Some opaque data types used by GPGME. */ |
101 | |
102 | /* The context holds some global state and configuration options, as |
103 | well as the results of a crypto operation. */ |
104 | struct gpgme_context; |
105 | typedef struct gpgme_context *gpgme_ctx_t; |
106 | |
107 | /* The data object is used by GPGME to exchange arbitrary data. */ |
108 | struct gpgme_data; |
109 | typedef struct gpgme_data *gpgme_data_t; |
110 | |
111 | |
112 | /* Wrappers for the libgpg-error library. */ |
113 | |
114 | typedef gpg_error_t gpgme_error_t; |
115 | typedef gpg_err_code_t gpgme_err_code_t; |
116 | typedef gpg_err_source_t gpgme_err_source_t; |
117 | |
118 | |
119 | static _GPGME_INLINE gpgme_error_t |
120 | gpgme_err_make (gpgme_err_source_t source, gpgme_err_code_t code) |
121 | { |
122 | return gpg_err_make (source, code); |
123 | } |
124 | |
125 | |
126 | /* The user can define GPGME_ERR_SOURCE_DEFAULT before including this |
127 | file to specify a default source for gpgme_error. */ |
128 | #ifndef GPGME_ERR_SOURCE_DEFAULT |
129 | #define GPGME_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1 |
130 | #endif |
131 | |
132 | static _GPGME_INLINE gpgme_error_t |
133 | gpgme_error (gpgme_err_code_t code) |
134 | { |
135 | return gpgme_err_make (GPGME_ERR_SOURCE_DEFAULT, code); |
136 | } |
137 | |
138 | |
139 | static _GPGME_INLINE gpgme_err_code_t |
140 | gpgme_err_code (gpgme_error_t err) |
141 | { |
142 | return gpg_err_code (err); |
143 | } |
144 | |
145 | |
146 | static _GPGME_INLINE gpgme_err_source_t |
147 | gpgme_err_source (gpgme_error_t err) |
148 | { |
149 | return gpg_err_source (err); |
150 | } |
151 | |
152 | |
153 | /* Return a pointer to a string containing a description of the error |
154 | code in the error value ERR. This function is not thread safe. */ |
155 | const char *gpgme_strerror (gpgme_error_t err); |
156 | |
157 | /* Return the error string for ERR in the user-supplied buffer BUF of |
158 | size BUFLEN. This function is, in contrast to gpg_strerror, |
159 | thread-safe if a thread-safe strerror_r() function is provided by |
160 | the system. If the function succeeds, 0 is returned and BUF |
161 | contains the string describing the error. If the buffer was not |
162 | large enough, ERANGE is returned and BUF contains as much of the |
163 | beginning of the error string as fits into the buffer. */ |
164 | int gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen); |
165 | |
166 | /* Return a pointer to a string containing a description of the error |
167 | source in the error value ERR. */ |
168 | const char *gpgme_strsource (gpgme_error_t err); |
169 | |
170 | /* Retrieve the error code for the system error ERR. This returns |
171 | GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report |
172 | this). */ |
173 | gpgme_err_code_t gpgme_err_code_from_errno (int err); |
174 | |
175 | /* Retrieve the system error for the error code CODE. This returns 0 |
176 | if CODE is not a system error code. */ |
177 | int gpgme_err_code_to_errno (gpgme_err_code_t code); |
178 | |
179 | /* Retrieve the error code directly from the ERRNO variable. This |
180 | returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped |
181 | (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */ |
182 | gpgme_err_code_t gpgme_err_code_from_syserror (void); |
183 | |
184 | /* Set the ERRNO variable. This function is the preferred way to set |
185 | ERRNO due to peculiarities on WindowsCE. */ |
186 | void gpgme_err_set_errno (int err); |
187 | |
188 | /* Return an error value with the error source SOURCE and the system |
189 | error ERR. FIXME: Should be inline. */ |
190 | gpgme_error_t gpgme_err_make_from_errno (gpgme_err_source_t source, int err); |
191 | |
192 | /* Return an error value with the system error ERR. FIXME: Should be inline. */ |
193 | gpgme_error_t gpgme_error_from_errno (int err); |
194 | |
195 | |
196 | static _GPGME_INLINE gpgme_error_t |
197 | gpgme_error_from_syserror (void) |
198 | { |
199 | return gpgme_error (gpgme_err_code_from_syserror ()); |
200 | } |
201 | |
202 | |
203 | /* The possible encoding mode of gpgme_data_t objects. */ |
204 | typedef enum |
205 | { |
206 | GPGME_DATA_ENCODING_NONE = 0, /* Not specified. */ |
207 | GPGME_DATA_ENCODING_BINARY = 1, |
208 | GPGME_DATA_ENCODING_BASE64 = 2, |
209 | GPGME_DATA_ENCODING_ARMOR = 3, /* Either PEM or OpenPGP Armor. */ |
210 | GPGME_DATA_ENCODING_URL = 4, /* LF delimited URL list. */ |
211 | GPGME_DATA_ENCODING_URLESC = 5, /* Ditto, but percent escaped. */ |
212 | GPGME_DATA_ENCODING_URL0 = 6 /* Nul delimited URL list. */ |
213 | } |
214 | gpgme_data_encoding_t; |
215 | |
216 | /* Known data types. */ |
217 | typedef enum |
218 | { |
219 | GPGME_DATA_TYPE_INVALID = 0, /* Not detected. */ |
220 | GPGME_DATA_TYPE_UNKNOWN = 1, |
221 | GPGME_DATA_TYPE_PGP_SIGNED = 0x10, |
222 | GPGME_DATA_TYPE_PGP_OTHER = 0x12, |
223 | GPGME_DATA_TYPE_PGP_KEY = 0x13, |
224 | GPGME_DATA_TYPE_CMS_SIGNED = 0x20, |
225 | GPGME_DATA_TYPE_CMS_ENCRYPTED= 0x21, |
226 | GPGME_DATA_TYPE_CMS_OTHER = 0x22, |
227 | GPGME_DATA_TYPE_X509_CERT = 0x23, |
228 | GPGME_DATA_TYPE_PKCS12 = 0x24, |
229 | } |
230 | gpgme_data_type_t; |
231 | |
232 | |
233 | /* Public key algorithms. */ |
234 | typedef enum |
235 | { |
236 | GPGME_PK_RSA = 1, |
237 | GPGME_PK_RSA_E = 2, |
238 | GPGME_PK_RSA_S = 3, |
239 | GPGME_PK_ELG_E = 16, |
240 | GPGME_PK_DSA = 17, |
241 | GPGME_PK_ECC = 18, |
242 | GPGME_PK_ELG = 20, |
243 | GPGME_PK_ECDSA = 301, |
244 | GPGME_PK_ECDH = 302 |
245 | } |
246 | gpgme_pubkey_algo_t; |
247 | |
248 | |
249 | /* Hash algorithms (the values match those from libgcrypt). */ |
250 | typedef enum |
251 | { |
252 | GPGME_MD_NONE = 0, |
253 | GPGME_MD_MD5 = 1, |
254 | GPGME_MD_SHA1 = 2, |
255 | GPGME_MD_RMD160 = 3, |
256 | GPGME_MD_MD2 = 5, |
257 | GPGME_MD_TIGER = 6, /* TIGER/192. */ |
258 | GPGME_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */ |
259 | GPGME_MD_SHA256 = 8, |
260 | GPGME_MD_SHA384 = 9, |
261 | GPGME_MD_SHA512 = 10, |
262 | GPGME_MD_SHA224 = 11, |
263 | GPGME_MD_MD4 = 301, |
264 | GPGME_MD_CRC32 = 302, |
265 | GPGME_MD_CRC32_RFC1510 = 303, |
266 | GPGME_MD_CRC24_RFC2440 = 304 |
267 | } |
268 | gpgme_hash_algo_t; |
269 | |
270 | |
271 | /* The possible signature stati. Deprecated, use error value in sig |
272 | status. */ |
273 | typedef enum |
274 | { |
275 | GPGME_SIG_STAT_NONE = 0, |
276 | GPGME_SIG_STAT_GOOD = 1, |
277 | GPGME_SIG_STAT_BAD = 2, |
278 | GPGME_SIG_STAT_NOKEY = 3, |
279 | GPGME_SIG_STAT_NOSIG = 4, |
280 | GPGME_SIG_STAT_ERROR = 5, |
281 | GPGME_SIG_STAT_DIFF = 6, |
282 | GPGME_SIG_STAT_GOOD_EXP = 7, |
283 | GPGME_SIG_STAT_GOOD_EXPKEY = 8 |
284 | } |
285 | _gpgme_sig_stat_t; |
286 | typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED; |
287 | |
288 | |
289 | /* The available signature modes. */ |
290 | typedef enum |
291 | { |
292 | GPGME_SIG_MODE_NORMAL = 0, |
293 | GPGME_SIG_MODE_DETACH = 1, |
294 | GPGME_SIG_MODE_CLEAR = 2 |
295 | } |
296 | gpgme_sig_mode_t; |
297 | |
298 | |
299 | /* The available key and signature attributes. Deprecated, use the |
300 | individual result structures instead. */ |
301 | typedef enum |
302 | { |
303 | GPGME_ATTR_KEYID = 1, |
304 | GPGME_ATTR_FPR = 2, |
305 | GPGME_ATTR_ALGO = 3, |
306 | GPGME_ATTR_LEN = 4, |
307 | GPGME_ATTR_CREATED = 5, |
308 | GPGME_ATTR_EXPIRE = 6, |
309 | GPGME_ATTR_OTRUST = 7, |
310 | GPGME_ATTR_USERID = 8, |
311 | GPGME_ATTR_NAME = 9, |
312 | GPGME_ATTR_EMAIL = 10, |
313 | = 11, |
314 | GPGME_ATTR_VALIDITY = 12, |
315 | GPGME_ATTR_LEVEL = 13, |
316 | GPGME_ATTR_TYPE = 14, |
317 | GPGME_ATTR_IS_SECRET = 15, |
318 | GPGME_ATTR_KEY_REVOKED = 16, |
319 | GPGME_ATTR_KEY_INVALID = 17, |
320 | GPGME_ATTR_UID_REVOKED = 18, |
321 | GPGME_ATTR_UID_INVALID = 19, |
322 | GPGME_ATTR_KEY_CAPS = 20, |
323 | GPGME_ATTR_CAN_ENCRYPT = 21, |
324 | GPGME_ATTR_CAN_SIGN = 22, |
325 | GPGME_ATTR_CAN_CERTIFY = 23, |
326 | GPGME_ATTR_KEY_EXPIRED = 24, |
327 | GPGME_ATTR_KEY_DISABLED = 25, |
328 | GPGME_ATTR_SERIAL = 26, |
329 | GPGME_ATTR_ISSUER = 27, |
330 | GPGME_ATTR_CHAINID = 28, |
331 | GPGME_ATTR_SIG_STATUS = 29, |
332 | GPGME_ATTR_ERRTOK = 30, |
333 | GPGME_ATTR_SIG_SUMMARY = 31, |
334 | GPGME_ATTR_SIG_CLASS = 32 |
335 | } |
336 | _gpgme_attr_t; |
337 | typedef _gpgme_attr_t gpgme_attr_t _GPGME_DEPRECATED; |
338 | |
339 | |
340 | /* The available validities for a trust item or key. */ |
341 | typedef enum |
342 | { |
343 | GPGME_VALIDITY_UNKNOWN = 0, |
344 | GPGME_VALIDITY_UNDEFINED = 1, |
345 | GPGME_VALIDITY_NEVER = 2, |
346 | GPGME_VALIDITY_MARGINAL = 3, |
347 | GPGME_VALIDITY_FULL = 4, |
348 | GPGME_VALIDITY_ULTIMATE = 5 |
349 | } |
350 | gpgme_validity_t; |
351 | |
352 | |
353 | /* The available protocols. */ |
354 | typedef enum |
355 | { |
356 | GPGME_PROTOCOL_OpenPGP = 0, /* The default mode. */ |
357 | GPGME_PROTOCOL_CMS = 1, |
358 | GPGME_PROTOCOL_GPGCONF = 2, /* Special code for gpgconf. */ |
359 | GPGME_PROTOCOL_ASSUAN = 3, /* Low-level access to an Assuan server. */ |
360 | GPGME_PROTOCOL_G13 = 4, |
361 | GPGME_PROTOCOL_UISERVER= 5, |
362 | GPGME_PROTOCOL_SPAWN = 6, /* Direct access to any program. */ |
363 | GPGME_PROTOCOL_DEFAULT = 254, |
364 | GPGME_PROTOCOL_UNKNOWN = 255 |
365 | } |
366 | gpgme_protocol_t; |
367 | /* Convenience macro for the surprisingly mixed spelling. */ |
368 | #define GPGME_PROTOCOL_OPENPGP GPGME_PROTOCOL_OpenPGP |
369 | |
370 | |
371 | /* The available keylist mode flags. */ |
372 | #define GPGME_KEYLIST_MODE_LOCAL 1 |
373 | #define GPGME_KEYLIST_MODE_EXTERN 2 |
374 | #define GPGME_KEYLIST_MODE_SIGS 4 |
375 | #define GPGME_KEYLIST_MODE_SIG_NOTATIONS 8 |
376 | #define GPGME_KEYLIST_MODE_EPHEMERAL 128 |
377 | #define GPGME_KEYLIST_MODE_VALIDATE 256 |
378 | |
379 | typedef unsigned int gpgme_keylist_mode_t; |
380 | |
381 | |
382 | /* The pinentry modes. */ |
383 | typedef enum |
384 | { |
385 | GPGME_PINENTRY_MODE_DEFAULT = 0, |
386 | GPGME_PINENTRY_MODE_ASK = 1, |
387 | GPGME_PINENTRY_MODE_CANCEL = 2, |
388 | GPGME_PINENTRY_MODE_ERROR = 3, |
389 | GPGME_PINENTRY_MODE_LOOPBACK = 4 |
390 | } |
391 | gpgme_pinentry_mode_t; |
392 | |
393 | |
394 | /* The available export mode flags. */ |
395 | #define GPGME_EXPORT_MODE_EXTERN 2 |
396 | #define GPGME_EXPORT_MODE_MINIMAL 4 |
397 | |
398 | typedef unsigned int gpgme_export_mode_t; |
399 | |
400 | |
401 | /* Flags for the audit log functions. */ |
402 | #define GPGME_AUDITLOG_HTML 1 |
403 | #define GPGME_AUDITLOG_WITH_HELP 128 |
404 | |
405 | |
406 | /* Signature notations. */ |
407 | |
408 | /* The available signature notation flags. */ |
409 | #define GPGME_SIG_NOTATION_HUMAN_READABLE 1 |
410 | #define GPGME_SIG_NOTATION_CRITICAL 2 |
411 | |
412 | typedef unsigned int gpgme_sig_notation_flags_t; |
413 | |
414 | struct _gpgme_sig_notation |
415 | { |
416 | struct _gpgme_sig_notation *next; |
417 | |
418 | /* If NAME is a null pointer, then VALUE contains a policy URL |
419 | rather than a notation. */ |
420 | char *name; |
421 | |
422 | /* The value of the notation data. */ |
423 | char *value; |
424 | |
425 | /* The length of the name of the notation data. */ |
426 | int name_len; |
427 | |
428 | /* The length of the value of the notation data. */ |
429 | int value_len; |
430 | |
431 | /* The accumulated flags. */ |
432 | gpgme_sig_notation_flags_t flags; |
433 | |
434 | /* Notation data is human-readable. */ |
435 | unsigned int human_readable : 1; |
436 | |
437 | /* Notation data is critical. */ |
438 | unsigned int critical : 1; |
439 | |
440 | /* Internal to GPGME, do not use. */ |
441 | int _unused : 30; |
442 | }; |
443 | typedef struct _gpgme_sig_notation *gpgme_sig_notation_t; |
444 | |
445 | |
446 | /* The possible stati for the edit operation. */ |
447 | typedef enum |
448 | { |
449 | GPGME_STATUS_EOF = 0, |
450 | /* mkstatus processing starts here */ |
451 | GPGME_STATUS_ENTER = 1, |
452 | GPGME_STATUS_LEAVE = 2, |
453 | GPGME_STATUS_ABORT = 3, |
454 | |
455 | GPGME_STATUS_GOODSIG = 4, |
456 | GPGME_STATUS_BADSIG = 5, |
457 | GPGME_STATUS_ERRSIG = 6, |
458 | |
459 | GPGME_STATUS_BADARMOR = 7, |
460 | |
461 | GPGME_STATUS_RSA_OR_IDEA = 8, /* (legacy) */ |
462 | GPGME_STATUS_KEYEXPIRED = 9, |
463 | GPGME_STATUS_KEYREVOKED = 10, |
464 | |
465 | GPGME_STATUS_TRUST_UNDEFINED = 11, |
466 | GPGME_STATUS_TRUST_NEVER = 12, |
467 | GPGME_STATUS_TRUST_MARGINAL = 13, |
468 | GPGME_STATUS_TRUST_FULLY = 14, |
469 | GPGME_STATUS_TRUST_ULTIMATE = 15, |
470 | |
471 | GPGME_STATUS_SHM_INFO = 16, /* (legacy) */ |
472 | GPGME_STATUS_SHM_GET = 17, /* (legacy) */ |
473 | GPGME_STATUS_SHM_GET_BOOL = 18, /* (legacy) */ |
474 | GPGME_STATUS_SHM_GET_HIDDEN = 19, /* (legacy) */ |
475 | |
476 | GPGME_STATUS_NEED_PASSPHRASE = 20, |
477 | GPGME_STATUS_VALIDSIG = 21, |
478 | GPGME_STATUS_SIG_ID = 22, |
479 | GPGME_STATUS_ENC_TO = 23, |
480 | GPGME_STATUS_NODATA = 24, |
481 | GPGME_STATUS_BAD_PASSPHRASE = 25, |
482 | GPGME_STATUS_NO_PUBKEY = 26, |
483 | GPGME_STATUS_NO_SECKEY = 27, |
484 | GPGME_STATUS_NEED_PASSPHRASE_SYM = 28, |
485 | GPGME_STATUS_DECRYPTION_FAILED = 29, |
486 | GPGME_STATUS_DECRYPTION_OKAY = 30, |
487 | GPGME_STATUS_MISSING_PASSPHRASE = 31, |
488 | GPGME_STATUS_GOOD_PASSPHRASE = 32, |
489 | GPGME_STATUS_GOODMDC = 33, |
490 | GPGME_STATUS_BADMDC = 34, |
491 | GPGME_STATUS_ERRMDC = 35, |
492 | GPGME_STATUS_IMPORTED = 36, |
493 | GPGME_STATUS_IMPORT_OK = 37, |
494 | GPGME_STATUS_IMPORT_PROBLEM = 38, |
495 | GPGME_STATUS_IMPORT_RES = 39, |
496 | GPGME_STATUS_FILE_START = 40, |
497 | GPGME_STATUS_FILE_DONE = 41, |
498 | GPGME_STATUS_FILE_ERROR = 42, |
499 | |
500 | GPGME_STATUS_BEGIN_DECRYPTION = 43, |
501 | GPGME_STATUS_END_DECRYPTION = 44, |
502 | GPGME_STATUS_BEGIN_ENCRYPTION = 45, |
503 | GPGME_STATUS_END_ENCRYPTION = 46, |
504 | |
505 | GPGME_STATUS_DELETE_PROBLEM = 47, |
506 | GPGME_STATUS_GET_BOOL = 48, |
507 | GPGME_STATUS_GET_LINE = 49, |
508 | GPGME_STATUS_GET_HIDDEN = 50, |
509 | GPGME_STATUS_GOT_IT = 51, |
510 | GPGME_STATUS_PROGRESS = 52, |
511 | GPGME_STATUS_SIG_CREATED = 53, |
512 | GPGME_STATUS_SESSION_KEY = 54, |
513 | GPGME_STATUS_NOTATION_NAME = 55, |
514 | GPGME_STATUS_NOTATION_DATA = 56, |
515 | GPGME_STATUS_POLICY_URL = 57, |
516 | GPGME_STATUS_BEGIN_STREAM = 58, /* (legacy) */ |
517 | GPGME_STATUS_END_STREAM = 59, /* (legacy) */ |
518 | GPGME_STATUS_KEY_CREATED = 60, |
519 | GPGME_STATUS_USERID_HINT = 61, |
520 | GPGME_STATUS_UNEXPECTED = 62, |
521 | GPGME_STATUS_INV_RECP = 63, |
522 | GPGME_STATUS_NO_RECP = 64, |
523 | GPGME_STATUS_ALREADY_SIGNED = 65, |
524 | GPGME_STATUS_SIGEXPIRED = 66, /* (legacy) */ |
525 | GPGME_STATUS_EXPSIG = 67, |
526 | GPGME_STATUS_EXPKEYSIG = 68, |
527 | GPGME_STATUS_TRUNCATED = 69, |
528 | GPGME_STATUS_ERROR = 70, |
529 | GPGME_STATUS_NEWSIG = 71, |
530 | GPGME_STATUS_REVKEYSIG = 72, |
531 | GPGME_STATUS_SIG_SUBPACKET = 73, |
532 | GPGME_STATUS_NEED_PASSPHRASE_PIN = 74, |
533 | GPGME_STATUS_SC_OP_FAILURE = 75, |
534 | GPGME_STATUS_SC_OP_SUCCESS = 76, |
535 | GPGME_STATUS_CARDCTRL = 77, |
536 | GPGME_STATUS_BACKUP_KEY_CREATED = 78, |
537 | GPGME_STATUS_PKA_TRUST_BAD = 79, |
538 | GPGME_STATUS_PKA_TRUST_GOOD = 80, |
539 | GPGME_STATUS_PLAINTEXT = 81, |
540 | GPGME_STATUS_INV_SGNR = 82, |
541 | GPGME_STATUS_NO_SGNR = 83, |
542 | GPGME_STATUS_SUCCESS = 84, |
543 | GPGME_STATUS_DECRYPTION_INFO = 85, |
544 | GPGME_STATUS_PLAINTEXT_LENGTH = 86, |
545 | GPGME_STATUS_MOUNTPOINT = 87, |
546 | GPGME_STATUS_PINENTRY_LAUNCHED = 88, |
547 | GPGME_STATUS_ATTRIBUTE = 89, |
548 | GPGME_STATUS_BEGIN_SIGNING = 90, |
549 | GPGME_STATUS_KEY_NOT_CREATED = 91 |
550 | } |
551 | gpgme_status_code_t; |
552 | |
553 | |
554 | /* The engine information structure. */ |
555 | struct _gpgme_engine_info |
556 | { |
557 | struct _gpgme_engine_info *next; |
558 | |
559 | /* The protocol ID. */ |
560 | gpgme_protocol_t protocol; |
561 | |
562 | /* The file name of the engine binary. */ |
563 | char *file_name; |
564 | |
565 | /* The version string of the installed engine. */ |
566 | char *version; |
567 | |
568 | /* The minimum version required for GPGME. */ |
569 | const char *req_version; |
570 | |
571 | /* The home directory used, or NULL if default. */ |
572 | char *home_dir; |
573 | }; |
574 | typedef struct _gpgme_engine_info *gpgme_engine_info_t; |
575 | |
576 | |
577 | /* A subkey from a key. */ |
578 | struct _gpgme_subkey |
579 | { |
580 | struct _gpgme_subkey *next; |
581 | |
582 | /* True if subkey is revoked. */ |
583 | unsigned int revoked : 1; |
584 | |
585 | /* True if subkey is expired. */ |
586 | unsigned int expired : 1; |
587 | |
588 | /* True if subkey is disabled. */ |
589 | unsigned int disabled : 1; |
590 | |
591 | /* True if subkey is invalid. */ |
592 | unsigned int invalid : 1; |
593 | |
594 | /* True if subkey can be used for encryption. */ |
595 | unsigned int can_encrypt : 1; |
596 | |
597 | /* True if subkey can be used for signing. */ |
598 | unsigned int can_sign : 1; |
599 | |
600 | /* True if subkey can be used for certification. */ |
601 | unsigned int can_certify : 1; |
602 | |
603 | /* True if subkey is secret. */ |
604 | unsigned int secret : 1; |
605 | |
606 | /* True if subkey can be used for authentication. */ |
607 | unsigned int can_authenticate : 1; |
608 | |
609 | /* True if subkey is qualified for signatures according to German law. */ |
610 | unsigned int is_qualified : 1; |
611 | |
612 | /* True if the secret key is stored on a smart card. */ |
613 | unsigned int is_cardkey : 1; |
614 | |
615 | /* Internal to GPGME, do not use. */ |
616 | unsigned int _unused : 21; |
617 | |
618 | /* Public key algorithm supported by this subkey. */ |
619 | gpgme_pubkey_algo_t pubkey_algo; |
620 | |
621 | /* Length of the subkey. */ |
622 | unsigned int length; |
623 | |
624 | /* The key ID of the subkey. */ |
625 | char *keyid; |
626 | |
627 | /* Internal to GPGME, do not use. */ |
628 | char _keyid[16 + 1]; |
629 | |
630 | /* The fingerprint of the subkey in hex digit form. */ |
631 | char *fpr; |
632 | |
633 | /* The creation timestamp, -1 if invalid, 0 if not available. */ |
634 | long int timestamp; |
635 | |
636 | /* The expiration timestamp, 0 if the subkey does not expire. */ |
637 | long int expires; |
638 | |
639 | /* The serial number of a smart card holding this key or NULL. */ |
640 | char *card_number; |
641 | |
642 | /* The name of the curve for ECC algorithms or NULL. */ |
643 | char *curve; |
644 | }; |
645 | typedef struct _gpgme_subkey *gpgme_subkey_t; |
646 | |
647 | |
648 | /* A signature on a user ID. */ |
649 | struct _gpgme_key_sig |
650 | { |
651 | struct _gpgme_key_sig *next; |
652 | |
653 | /* True if the signature is a revocation signature. */ |
654 | unsigned int revoked : 1; |
655 | |
656 | /* True if the signature is expired. */ |
657 | unsigned int expired : 1; |
658 | |
659 | /* True if the signature is invalid. */ |
660 | unsigned int invalid : 1; |
661 | |
662 | /* True if the signature should be exported. */ |
663 | unsigned int exportable : 1; |
664 | |
665 | /* Internal to GPGME, do not use. */ |
666 | unsigned int _unused : 28; |
667 | |
668 | /* The public key algorithm used to create the signature. */ |
669 | gpgme_pubkey_algo_t pubkey_algo; |
670 | |
671 | /* The key ID of key used to create the signature. */ |
672 | char *keyid; |
673 | |
674 | /* Internal to GPGME, do not use. */ |
675 | char _keyid[16 + 1]; |
676 | |
677 | /* The creation timestamp, -1 if invalid, 0 if not available. */ |
678 | long int timestamp; |
679 | |
680 | /* The expiration timestamp, 0 if the subkey does not expire. */ |
681 | long int expires; |
682 | |
683 | /* Same as in gpgme_signature_t. */ |
684 | gpgme_error_t status; |
685 | |
686 | #ifdef __cplusplus |
687 | unsigned int _obsolete_class _GPGME_DEPRECATED; |
688 | #else |
689 | /* Must be set to SIG_CLASS below. */ |
690 | unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME; |
691 | #endif |
692 | |
693 | /* The user ID string. */ |
694 | char *uid; |
695 | |
696 | /* The name part of the user ID. */ |
697 | char *name; |
698 | |
699 | /* The email part of the user ID. */ |
700 | char *email; |
701 | |
702 | /* The comment part of the user ID. */ |
703 | char *; |
704 | |
705 | /* Crypto backend specific signature class. */ |
706 | unsigned int sig_class; |
707 | |
708 | /* Notation data and policy URLs. */ |
709 | gpgme_sig_notation_t notations; |
710 | |
711 | /* Internal to GPGME, do not use. */ |
712 | gpgme_sig_notation_t _last_notation; |
713 | }; |
714 | typedef struct _gpgme_key_sig *gpgme_key_sig_t; |
715 | |
716 | |
717 | /* An user ID from a key. */ |
718 | struct _gpgme_user_id |
719 | { |
720 | struct _gpgme_user_id *next; |
721 | |
722 | /* True if the user ID is revoked. */ |
723 | unsigned int revoked : 1; |
724 | |
725 | /* True if the user ID is invalid. */ |
726 | unsigned int invalid : 1; |
727 | |
728 | /* Internal to GPGME, do not use. */ |
729 | unsigned int _unused : 30; |
730 | |
731 | /* The validity of the user ID. */ |
732 | gpgme_validity_t validity; |
733 | |
734 | /* The user ID string. */ |
735 | char *uid; |
736 | |
737 | /* The name part of the user ID. */ |
738 | char *name; |
739 | |
740 | /* The email part of the user ID. */ |
741 | char *email; |
742 | |
743 | /* The comment part of the user ID. */ |
744 | char *; |
745 | |
746 | /* The signatures of the user ID. */ |
747 | gpgme_key_sig_t signatures; |
748 | |
749 | /* Internal to GPGME, do not use. */ |
750 | gpgme_key_sig_t _last_keysig; |
751 | }; |
752 | typedef struct _gpgme_user_id *gpgme_user_id_t; |
753 | |
754 | |
755 | /* A key from the keyring. */ |
756 | struct _gpgme_key |
757 | { |
758 | /* Internal to GPGME, do not use. */ |
759 | unsigned int _refs; |
760 | |
761 | /* True if key is revoked. */ |
762 | unsigned int revoked : 1; |
763 | |
764 | /* True if key is expired. */ |
765 | unsigned int expired : 1; |
766 | |
767 | /* True if key is disabled. */ |
768 | unsigned int disabled : 1; |
769 | |
770 | /* True if key is invalid. */ |
771 | unsigned int invalid : 1; |
772 | |
773 | /* True if key can be used for encryption. */ |
774 | unsigned int can_encrypt : 1; |
775 | |
776 | /* True if key can be used for signing. */ |
777 | unsigned int can_sign : 1; |
778 | |
779 | /* True if key can be used for certification. */ |
780 | unsigned int can_certify : 1; |
781 | |
782 | /* True if key is secret. */ |
783 | unsigned int secret : 1; |
784 | |
785 | /* True if key can be used for authentication. */ |
786 | unsigned int can_authenticate : 1; |
787 | |
788 | /* True if subkey is qualified for signatures according to German law. */ |
789 | unsigned int is_qualified : 1; |
790 | |
791 | /* Internal to GPGME, do not use. */ |
792 | unsigned int _unused : 22; |
793 | |
794 | /* This is the protocol supported by this key. */ |
795 | gpgme_protocol_t protocol; |
796 | |
797 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the |
798 | issuer serial. */ |
799 | char *issuer_serial; |
800 | |
801 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the |
802 | issuer name. */ |
803 | char *issuer_name; |
804 | |
805 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain |
806 | ID. */ |
807 | char *chain_id; |
808 | |
809 | /* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the |
810 | owner trust. */ |
811 | gpgme_validity_t owner_trust; |
812 | |
813 | /* The subkeys of the key. */ |
814 | gpgme_subkey_t subkeys; |
815 | |
816 | /* The user IDs of the key. */ |
817 | gpgme_user_id_t uids; |
818 | |
819 | /* Internal to GPGME, do not use. */ |
820 | gpgme_subkey_t _last_subkey; |
821 | |
822 | /* Internal to GPGME, do not use. */ |
823 | gpgme_user_id_t _last_uid; |
824 | |
825 | /* The keylist mode that was active when listing the key. */ |
826 | gpgme_keylist_mode_t keylist_mode; |
827 | }; |
828 | typedef struct _gpgme_key *gpgme_key_t; |
829 | |
830 | |
831 | |
832 | /* Types for callback functions. */ |
833 | |
834 | /* Request a passphrase from the user. */ |
835 | typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook, |
836 | const char *uid_hint, |
837 | const char *passphrase_info, |
838 | int prev_was_bad, int fd); |
839 | |
840 | /* Inform the user about progress made. */ |
841 | typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what, |
842 | int type, int current, int total); |
843 | |
844 | /* Interact with the user about an edit operation. */ |
845 | typedef gpgme_error_t (*gpgme_edit_cb_t) (void *opaque, |
846 | gpgme_status_code_t status, |
847 | const char *args, int fd); |
848 | |
849 | |
850 | |
851 | |
852 | /* Context management functions. */ |
853 | |
854 | /* Create a new context and return it in CTX. */ |
855 | gpgme_error_t gpgme_new (gpgme_ctx_t *ctx); |
856 | |
857 | /* Release the context CTX. */ |
858 | void gpgme_release (gpgme_ctx_t ctx); |
859 | |
860 | /* Set the protocol to be used by CTX to PROTO. */ |
861 | gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto); |
862 | |
863 | /* Get the protocol used with CTX */ |
864 | gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx); |
865 | |
866 | /* Set the crypto protocol to be used by CTX to PROTO. |
867 | gpgme_set_protocol actually sets the backend engine. This sets the |
868 | crypto protocol used in engines that support more than one crypto |
869 | prococol (for example, an UISERVER can support OpenPGP and CMS). |
870 | This is reset to the default with gpgme_set_protocol. */ |
871 | gpgme_error_t gpgme_set_sub_protocol (gpgme_ctx_t ctx, |
872 | gpgme_protocol_t proto); |
873 | |
874 | /* Get the sub protocol. */ |
875 | gpgme_protocol_t gpgme_get_sub_protocol (gpgme_ctx_t ctx); |
876 | |
877 | /* Get the string describing protocol PROTO, or NULL if invalid. */ |
878 | const char *gpgme_get_protocol_name (gpgme_protocol_t proto); |
879 | |
880 | /* If YES is non-zero, enable armor mode in CTX, disable it otherwise. */ |
881 | void gpgme_set_armor (gpgme_ctx_t ctx, int yes); |
882 | |
883 | /* Return non-zero if armor mode is set in CTX. */ |
884 | int gpgme_get_armor (gpgme_ctx_t ctx); |
885 | |
886 | /* If YES is non-zero, enable text mode in CTX, disable it otherwise. */ |
887 | void gpgme_set_textmode (gpgme_ctx_t ctx, int yes); |
888 | |
889 | /* Return non-zero if text mode is set in CTX. */ |
890 | int gpgme_get_textmode (gpgme_ctx_t ctx); |
891 | |
892 | /* Use whatever the default of the backend crypto engine is. */ |
893 | #define GPGME_INCLUDE_CERTS_DEFAULT -256 |
894 | |
895 | /* Include up to NR_OF_CERTS certificates in an S/MIME message. */ |
896 | void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs); |
897 | |
898 | /* Return the number of certs to include in an S/MIME message. */ |
899 | int gpgme_get_include_certs (gpgme_ctx_t ctx); |
900 | |
901 | /* Set keylist mode in CTX to MODE. */ |
902 | gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx, |
903 | gpgme_keylist_mode_t mode); |
904 | |
905 | /* Get keylist mode in CTX. */ |
906 | gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx); |
907 | |
908 | /* Set the pinentry mode for CTX to MODE. */ |
909 | gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t ctx, |
910 | gpgme_pinentry_mode_t mode); |
911 | |
912 | /* Get the pinentry mode of CTX. */ |
913 | gpgme_pinentry_mode_t gpgme_get_pinentry_mode (gpgme_ctx_t ctx); |
914 | |
915 | /* Set the passphrase callback function in CTX to CB. HOOK_VALUE is |
916 | passed as first argument to the passphrase callback function. */ |
917 | void gpgme_set_passphrase_cb (gpgme_ctx_t ctx, |
918 | gpgme_passphrase_cb_t cb, void *hook_value); |
919 | |
920 | /* Get the current passphrase callback function in *CB and the current |
921 | hook value in *HOOK_VALUE. */ |
922 | void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb, |
923 | void **hook_value); |
924 | |
925 | /* Set the progress callback function in CTX to CB. HOOK_VALUE is |
926 | passed as first argument to the progress callback function. */ |
927 | void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb, |
928 | void *hook_value); |
929 | |
930 | /* Get the current progress callback function in *CB and the current |
931 | hook value in *HOOK_VALUE. */ |
932 | void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb, |
933 | void **hook_value); |
934 | |
935 | /* This function sets the locale for the context CTX, or the default |
936 | locale if CTX is a null pointer. */ |
937 | gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category, |
938 | const char *value); |
939 | |
940 | /* Get the information about the configured engines. A pointer to the |
941 | first engine in the statically allocated linked list is returned. |
942 | The returned data is valid until the next gpgme_ctx_set_engine_info. */ |
943 | gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx); |
944 | |
945 | /* Set the engine info for the context CTX, protocol PROTO, to the |
946 | file name FILE_NAME and the home directory HOME_DIR. */ |
947 | gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, |
948 | gpgme_protocol_t proto, |
949 | const char *file_name, |
950 | const char *home_dir); |
951 | |
952 | |
953 | /* Return a statically allocated string with the name of the public |
954 | key algorithm ALGO, or NULL if that name is not known. */ |
955 | const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo); |
956 | |
957 | /* Return a statically allocated string with the name of the hash |
958 | algorithm ALGO, or NULL if that name is not known. */ |
959 | const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo); |
960 | |
961 | |
962 | /* Delete all signers from CTX. */ |
963 | void gpgme_signers_clear (gpgme_ctx_t ctx); |
964 | |
965 | /* Add KEY to list of signers in CTX. */ |
966 | gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key); |
967 | |
968 | /* Return the number of signers in CTX. */ |
969 | unsigned int gpgme_signers_count (const gpgme_ctx_t ctx); |
970 | |
971 | /* Return the SEQth signer's key in CTX. */ |
972 | gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq); |
973 | |
974 | /* Retrieve the signature status of signature IDX in CTX after a |
975 | successful verify operation in R_STAT (if non-null). The creation |
976 | time stamp of the signature is returned in R_CREATED (if non-null). |
977 | The function returns a string containing the fingerprint. |
978 | Deprecated, use verify result directly. */ |
979 | const char *gpgme_get_sig_status (gpgme_ctx_t ctx, int idx, |
980 | _gpgme_sig_stat_t *r_stat, |
981 | time_t *r_created) _GPGME_DEPRECATED; |
982 | |
983 | /* Retrieve certain attributes of a signature. IDX is the index |
984 | number of the signature after a successful verify operation. WHAT |
985 | is an attribute where GPGME_ATTR_EXPIRE is probably the most useful |
986 | one. WHATIDX is to be passed as 0 for most attributes . */ |
987 | unsigned long gpgme_get_sig_ulong_attr (gpgme_ctx_t c, int idx, |
988 | _gpgme_attr_t what, int whatidx) |
989 | _GPGME_DEPRECATED; |
990 | const char *gpgme_get_sig_string_attr (gpgme_ctx_t c, int idx, |
991 | _gpgme_attr_t what, int whatidx) |
992 | _GPGME_DEPRECATED; |
993 | |
994 | |
995 | /* Get the key used to create signature IDX in CTX and return it in |
996 | R_KEY. */ |
997 | gpgme_error_t gpgme_get_sig_key (gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key) |
998 | _GPGME_DEPRECATED; |
999 | |
1000 | |
1001 | /* Clear all notation data from the context. */ |
1002 | void gpgme_sig_notation_clear (gpgme_ctx_t ctx); |
1003 | |
1004 | /* Add the human-readable notation data with name NAME and value VALUE |
1005 | to the context CTX, using the flags FLAGS. If NAME is NULL, then |
1006 | VALUE should be a policy URL. The flag |
1007 | GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation |
1008 | data, and false for policy URLs. */ |
1009 | gpgme_error_t gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name, |
1010 | const char *value, |
1011 | gpgme_sig_notation_flags_t flags); |
1012 | |
1013 | /* Get the sig notations for this context. */ |
1014 | gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx); |
1015 | |
1016 | |
1017 | /* Run control. */ |
1018 | |
1019 | /* The type of an I/O callback function. */ |
1020 | typedef gpgme_error_t (*gpgme_io_cb_t) (void *data, int fd); |
1021 | |
1022 | /* The type of a function that can register FNC as the I/O callback |
1023 | function for the file descriptor FD with direction dir (0: for writing, |
1024 | 1: for reading). FNC_DATA should be passed as DATA to FNC. The |
1025 | function should return a TAG suitable for the corresponding |
1026 | gpgme_remove_io_cb_t, and an error value. */ |
1027 | typedef gpgme_error_t (*gpgme_register_io_cb_t) (void *data, int fd, int dir, |
1028 | gpgme_io_cb_t fnc, |
1029 | void *fnc_data, void **tag); |
1030 | |
1031 | /* The type of a function that can remove a previously registered I/O |
1032 | callback function given TAG as returned by the register |
1033 | function. */ |
1034 | typedef void (*gpgme_remove_io_cb_t) (void *tag); |
1035 | |
1036 | typedef enum |
1037 | { |
1038 | GPGME_EVENT_START, |
1039 | GPGME_EVENT_DONE, |
1040 | GPGME_EVENT_NEXT_KEY, |
1041 | GPGME_EVENT_NEXT_TRUSTITEM |
1042 | } |
1043 | gpgme_event_io_t; |
1044 | |
1045 | struct gpgme_io_event_done_data |
1046 | { |
1047 | /* A fatal IPC error or an operational error in state-less |
1048 | protocols. */ |
1049 | gpgme_error_t err; |
1050 | |
1051 | /* An operational errors in session-based protocols. */ |
1052 | gpgme_error_t op_err; |
1053 | }; |
1054 | typedef struct gpgme_io_event_done_data *gpgme_io_event_done_data_t; |
1055 | |
1056 | /* The type of a function that is called when a context finished an |
1057 | operation. */ |
1058 | typedef void (*gpgme_event_io_cb_t) (void *data, gpgme_event_io_t type, |
1059 | void *type_data); |
1060 | |
1061 | struct gpgme_io_cbs |
1062 | { |
1063 | gpgme_register_io_cb_t add; |
1064 | void *add_priv; |
1065 | gpgme_remove_io_cb_t remove; |
1066 | gpgme_event_io_cb_t event; |
1067 | void *event_priv; |
1068 | }; |
1069 | typedef struct gpgme_io_cbs *gpgme_io_cbs_t; |
1070 | |
1071 | /* Set the I/O callback functions in CTX to IO_CBS. */ |
1072 | void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); |
1073 | |
1074 | /* Get the current I/O callback functions. */ |
1075 | void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); |
1076 | |
1077 | /* Wrappers around the internal I/O functions for use with |
1078 | gpgme_passphrase_cb_t and gpgme_edit_cb_t. */ |
1079 | ssize_t gpgme_io_read (int fd, void *buffer, size_t count); |
1080 | ssize_t gpgme_io_write (int fd, const void *buffer, size_t count); |
1081 | int gpgme_io_writen (int fd, const void *buffer, size_t count); |
1082 | |
1083 | /* Process the pending operation and, if HANG is non-zero, wait for |
1084 | the pending operation to finish. */ |
1085 | gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang); |
1086 | |
1087 | gpgme_ctx_t gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status, |
1088 | gpgme_error_t *op_err, int hang); |
1089 | |
1090 | |
1091 | /* Functions to handle data objects. */ |
1092 | |
1093 | /* Read up to SIZE bytes into buffer BUFFER from the data object with |
1094 | the handle HANDLE. Return the number of characters read, 0 on EOF |
1095 | and -1 on error. If an error occurs, errno is set. */ |
1096 | typedef ssize_t (*gpgme_data_read_cb_t) (void *handle, void *buffer, |
1097 | size_t size); |
1098 | |
1099 | /* Write up to SIZE bytes from buffer BUFFER to the data object with |
1100 | the handle HANDLE. Return the number of characters written, or -1 |
1101 | on error. If an error occurs, errno is set. */ |
1102 | typedef ssize_t (*gpgme_data_write_cb_t) (void *handle, const void *buffer, |
1103 | size_t size); |
1104 | |
1105 | /* Set the current position from where the next read or write starts |
1106 | in the data object with the handle HANDLE to OFFSET, relativ to |
1107 | WHENCE. */ |
1108 | typedef off_t (*gpgme_data_seek_cb_t) (void *handle, |
1109 | off_t offset, int whence); |
1110 | |
1111 | /* Close the data object with the handle DL. */ |
1112 | typedef void (*gpgme_data_release_cb_t) (void *handle); |
1113 | |
1114 | struct gpgme_data_cbs |
1115 | { |
1116 | gpgme_data_read_cb_t read; |
1117 | gpgme_data_write_cb_t write; |
1118 | gpgme_data_seek_cb_t seek; |
1119 | gpgme_data_release_cb_t release; |
1120 | }; |
1121 | typedef struct gpgme_data_cbs *gpgme_data_cbs_t; |
1122 | |
1123 | /* Read up to SIZE bytes into buffer BUFFER from the data object with |
1124 | the handle DH. Return the number of characters read, 0 on EOF and |
1125 | -1 on error. If an error occurs, errno is set. */ |
1126 | ssize_t gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size); |
1127 | |
1128 | /* Write up to SIZE bytes from buffer BUFFER to the data object with |
1129 | the handle DH. Return the number of characters written, or -1 on |
1130 | error. If an error occurs, errno is set. */ |
1131 | ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size); |
1132 | |
1133 | /* Set the current position from where the next read or write starts |
1134 | in the data object with the handle DH to OFFSET, relativ to |
1135 | WHENCE. */ |
1136 | off_t gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence); |
1137 | |
1138 | /* Create a new data buffer and return it in R_DH. */ |
1139 | gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh); |
1140 | |
1141 | /* Destroy the data buffer DH. */ |
1142 | void gpgme_data_release (gpgme_data_t dh); |
1143 | |
1144 | /* Create a new data buffer filled with SIZE bytes starting from |
1145 | BUFFER. If COPY is zero, copying is delayed until necessary, and |
1146 | the data is taken from the original location when needed. */ |
1147 | gpgme_error_t gpgme_data_new_from_mem (gpgme_data_t *r_dh, |
1148 | const char *buffer, size_t size, |
1149 | int copy); |
1150 | |
1151 | /* Destroy the data buffer DH and return a pointer to its content. |
1152 | The memory has be to released with gpgme_free() by the user. It's |
1153 | size is returned in R_LEN. */ |
1154 | char *gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len); |
1155 | |
1156 | /* Release the memory returned by gpgme_data_release_and_get_mem(). */ |
1157 | void gpgme_free (void *buffer); |
1158 | |
1159 | gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *dh, |
1160 | gpgme_data_cbs_t cbs, |
1161 | void *handle); |
1162 | |
1163 | gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *dh, int fd); |
1164 | |
1165 | gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream); |
1166 | |
1167 | /* Return the encoding attribute of the data buffer DH */ |
1168 | gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh); |
1169 | |
1170 | /* Set the encoding attribute of data buffer DH to ENC */ |
1171 | gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh, |
1172 | gpgme_data_encoding_t enc); |
1173 | |
1174 | /* Get the file name associated with the data object with handle DH, or |
1175 | NULL if there is none. */ |
1176 | char *gpgme_data_get_file_name (gpgme_data_t dh); |
1177 | |
1178 | /* Set the file name associated with the data object with handle DH to |
1179 | FILE_NAME. */ |
1180 | gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh, |
1181 | const char *file_name); |
1182 | |
1183 | /* Try to identify the type of the data in DH. */ |
1184 | gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved); |
1185 | |
1186 | |
1187 | /* Create a new data buffer which retrieves the data from the callback |
1188 | function READ_CB. Deprecated, please use gpgme_data_new_from_cbs |
1189 | instead. */ |
1190 | gpgme_error_t gpgme_data_new_with_read_cb (gpgme_data_t *r_dh, |
1191 | int (*read_cb) (void*,char *, |
1192 | size_t,size_t*), |
1193 | void *read_cb_value) |
1194 | _GPGME_DEPRECATED; |
1195 | |
1196 | /* Create a new data buffer filled with the content of file FNAME. |
1197 | COPY must be non-zero. For delayed read, please use |
1198 | gpgme_data_new_from_fd or gpgme_data_new_from stream instead. */ |
1199 | gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh, |
1200 | const char *fname, |
1201 | int copy); |
1202 | |
1203 | /* Create a new data buffer filled with LENGTH bytes starting from |
1204 | OFFSET within the file FNAME or stream FP (exactly one must be |
1205 | non-zero). */ |
1206 | gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh, |
1207 | const char *fname, FILE *fp, |
1208 | off_t offset, size_t length); |
1209 | |
1210 | /* Reset the read pointer in DH. Deprecated, please use |
1211 | gpgme_data_seek instead. */ |
1212 | gpgme_error_t gpgme_data_rewind (gpgme_data_t dh) _GPGME_DEPRECATED; |
1213 | |
1214 | |
1215 | /* Key and trust functions. */ |
1216 | |
1217 | /* Get the key with the fingerprint FPR from the crypto backend. If |
1218 | SECRET is true, get the secret key. */ |
1219 | gpgme_error_t gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, |
1220 | gpgme_key_t *r_key, int secret); |
1221 | |
1222 | /* Acquire a reference to KEY. */ |
1223 | void gpgme_key_ref (gpgme_key_t key); |
1224 | |
1225 | /* Release a reference to KEY. If this was the last one the key is |
1226 | destroyed. */ |
1227 | void gpgme_key_unref (gpgme_key_t key); |
1228 | void gpgme_key_release (gpgme_key_t key); |
1229 | |
1230 | /* Return the value of the attribute WHAT of KEY, which has to be |
1231 | representable by a string. IDX specifies the sub key or user ID |
1232 | for attributes related to sub keys or user IDs. Deprecated, use |
1233 | key structure directly instead. */ |
1234 | const char *gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what, |
1235 | const void *reserved, int idx) |
1236 | _GPGME_DEPRECATED; |
1237 | |
1238 | /* Return the value of the attribute WHAT of KEY, which has to be |
1239 | representable by an unsigned integer. IDX specifies the sub key or |
1240 | user ID for attributes related to sub keys or user IDs. |
1241 | Deprecated, use key structure directly instead. */ |
1242 | unsigned long gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what, |
1243 | const void *reserved, int idx) |
1244 | _GPGME_DEPRECATED; |
1245 | |
1246 | /* Return the value of the attribute WHAT of a signature on user ID |
1247 | UID_IDX in KEY, which has to be representable by a string. IDX |
1248 | specifies the signature. Deprecated, use key structure directly |
1249 | instead. */ |
1250 | const char *gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx, |
1251 | _gpgme_attr_t what, |
1252 | const void *reserved, int idx) |
1253 | _GPGME_DEPRECATED; |
1254 | |
1255 | /* Return the value of the attribute WHAT of a signature on user ID |
1256 | UID_IDX in KEY, which has to be representable by an unsigned |
1257 | integer string. IDX specifies the signature. Deprecated, use key |
1258 | structure directly instead. */ |
1259 | unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx, |
1260 | _gpgme_attr_t what, |
1261 | const void *reserved, int idx) |
1262 | _GPGME_DEPRECATED; |
1263 | |
1264 | |
1265 | /* Crypto Operations. */ |
1266 | |
1267 | /* Cancel a pending asynchronous operation. */ |
1268 | gpgme_error_t gpgme_cancel (gpgme_ctx_t ctx); |
1269 | |
1270 | /* Cancel a pending operation asynchronously. */ |
1271 | gpgme_error_t gpgme_cancel_async (gpgme_ctx_t ctx); |
1272 | |
1273 | |
1274 | struct _gpgme_invalid_key |
1275 | { |
1276 | struct _gpgme_invalid_key *next; |
1277 | char *fpr; |
1278 | gpgme_error_t reason; |
1279 | }; |
1280 | typedef struct _gpgme_invalid_key *gpgme_invalid_key_t; |
1281 | |
1282 | |
1283 | /* Encryption. */ |
1284 | struct _gpgme_op_encrypt_result |
1285 | { |
1286 | /* The list of invalid recipients. */ |
1287 | gpgme_invalid_key_t invalid_recipients; |
1288 | }; |
1289 | typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t; |
1290 | |
1291 | /* Retrieve a pointer to the result of the encrypt operation. */ |
1292 | gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx); |
1293 | |
1294 | /* The valid encryption flags. */ |
1295 | typedef enum |
1296 | { |
1297 | GPGME_ENCRYPT_ALWAYS_TRUST = 1, |
1298 | GPGME_ENCRYPT_NO_ENCRYPT_TO = 2, |
1299 | GPGME_ENCRYPT_PREPARE = 4, |
1300 | GPGME_ENCRYPT_EXPECT_SIGN = 8, |
1301 | GPGME_ENCRYPT_NO_COMPRESS = 16 |
1302 | } |
1303 | gpgme_encrypt_flags_t; |
1304 | |
1305 | /* Encrypt plaintext PLAIN within CTX for the recipients RECP and |
1306 | store the resulting ciphertext in CIPHER. */ |
1307 | gpgme_error_t gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[], |
1308 | gpgme_encrypt_flags_t flags, |
1309 | gpgme_data_t plain, gpgme_data_t cipher); |
1310 | gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[], |
1311 | gpgme_encrypt_flags_t flags, |
1312 | gpgme_data_t plain, gpgme_data_t cipher); |
1313 | |
1314 | /* Encrypt plaintext PLAIN within CTX for the recipients RECP and |
1315 | store the resulting ciphertext in CIPHER. Also sign the ciphertext |
1316 | with the signers in CTX. */ |
1317 | gpgme_error_t gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx, |
1318 | gpgme_key_t recp[], |
1319 | gpgme_encrypt_flags_t flags, |
1320 | gpgme_data_t plain, |
1321 | gpgme_data_t cipher); |
1322 | gpgme_error_t gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[], |
1323 | gpgme_encrypt_flags_t flags, |
1324 | gpgme_data_t plain, gpgme_data_t cipher); |
1325 | |
1326 | |
1327 | /* Decryption. */ |
1328 | |
1329 | struct _gpgme_recipient |
1330 | { |
1331 | struct _gpgme_recipient *next; |
1332 | |
1333 | /* The key ID of key for which the text was encrypted. */ |
1334 | char *keyid; |
1335 | |
1336 | /* Internal to GPGME, do not use. */ |
1337 | char _keyid[16 + 1]; |
1338 | |
1339 | /* The public key algorithm of the recipient key. */ |
1340 | gpgme_pubkey_algo_t pubkey_algo; |
1341 | |
1342 | /* The status of the recipient. */ |
1343 | gpgme_error_t status; |
1344 | }; |
1345 | typedef struct _gpgme_recipient *gpgme_recipient_t; |
1346 | |
1347 | struct _gpgme_op_decrypt_result |
1348 | { |
1349 | char *unsupported_algorithm; |
1350 | |
1351 | /* Key should not have been used for encryption. */ |
1352 | unsigned int wrong_key_usage : 1; |
1353 | |
1354 | /* Internal to GPGME, do not use. */ |
1355 | int _unused : 31; |
1356 | |
1357 | gpgme_recipient_t recipients; |
1358 | |
1359 | /* The original file name of the plaintext message, if |
1360 | available. */ |
1361 | char *file_name; |
1362 | }; |
1363 | typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t; |
1364 | |
1365 | /* Retrieve a pointer to the result of the decrypt operation. */ |
1366 | gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx); |
1367 | |
1368 | /* Decrypt ciphertext CIPHER within CTX and store the resulting |
1369 | plaintext in PLAIN. */ |
1370 | gpgme_error_t gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher, |
1371 | gpgme_data_t plain); |
1372 | gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx, |
1373 | gpgme_data_t cipher, gpgme_data_t plain); |
1374 | |
1375 | /* Decrypt ciphertext CIPHER and make a signature verification within |
1376 | CTX and store the resulting plaintext in PLAIN. */ |
1377 | gpgme_error_t gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, |
1378 | gpgme_data_t cipher, |
1379 | gpgme_data_t plain); |
1380 | gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, |
1381 | gpgme_data_t plain); |
1382 | |
1383 | |
1384 | /* Signing. */ |
1385 | struct _gpgme_new_signature |
1386 | { |
1387 | struct _gpgme_new_signature *next; |
1388 | |
1389 | /* The type of the signature. */ |
1390 | gpgme_sig_mode_t type; |
1391 | |
1392 | /* The public key algorithm used to create the signature. */ |
1393 | gpgme_pubkey_algo_t pubkey_algo; |
1394 | |
1395 | /* The hash algorithm used to create the signature. */ |
1396 | gpgme_hash_algo_t hash_algo; |
1397 | |
1398 | /* Internal to GPGME, do not use. Must be set to the same value as |
1399 | CLASS below. */ |
1400 | unsigned long _obsolete_class; |
1401 | |
1402 | /* Signature creation time. */ |
1403 | long int timestamp; |
1404 | |
1405 | /* The fingerprint of the signature. */ |
1406 | char *fpr; |
1407 | |
1408 | #ifdef __cplusplus |
1409 | unsigned int _obsolete_class_2; |
1410 | #else |
1411 | /* Must be set to SIG_CLASS below. */ |
1412 | unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME; |
1413 | #endif |
1414 | |
1415 | /* Crypto backend specific signature class. */ |
1416 | unsigned int sig_class; |
1417 | }; |
1418 | typedef struct _gpgme_new_signature *gpgme_new_signature_t; |
1419 | |
1420 | struct _gpgme_op_sign_result |
1421 | { |
1422 | /* The list of invalid signers. */ |
1423 | gpgme_invalid_key_t invalid_signers; |
1424 | gpgme_new_signature_t signatures; |
1425 | }; |
1426 | typedef struct _gpgme_op_sign_result *gpgme_sign_result_t; |
1427 | |
1428 | /* Retrieve a pointer to the result of the signing operation. */ |
1429 | gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx); |
1430 | |
1431 | /* Sign the plaintext PLAIN and store the signature in SIG. */ |
1432 | gpgme_error_t gpgme_op_sign_start (gpgme_ctx_t ctx, |
1433 | gpgme_data_t plain, gpgme_data_t sig, |
1434 | gpgme_sig_mode_t mode); |
1435 | gpgme_error_t gpgme_op_sign (gpgme_ctx_t ctx, |
1436 | gpgme_data_t plain, gpgme_data_t sig, |
1437 | gpgme_sig_mode_t mode); |
1438 | |
1439 | |
1440 | /* Verify. */ |
1441 | |
1442 | /* Flags used for the SUMMARY field in a gpgme_signature_t. */ |
1443 | typedef enum |
1444 | { |
1445 | GPGME_SIGSUM_VALID = 0x0001, /* The signature is fully valid. */ |
1446 | GPGME_SIGSUM_GREEN = 0x0002, /* The signature is good. */ |
1447 | GPGME_SIGSUM_RED = 0x0004, /* The signature is bad. */ |
1448 | GPGME_SIGSUM_KEY_REVOKED = 0x0010, /* One key has been revoked. */ |
1449 | GPGME_SIGSUM_KEY_EXPIRED = 0x0020, /* One key has expired. */ |
1450 | GPGME_SIGSUM_SIG_EXPIRED = 0x0040, /* The signature has expired. */ |
1451 | GPGME_SIGSUM_KEY_MISSING = 0x0080, /* Can't verify: key missing. */ |
1452 | GPGME_SIGSUM_CRL_MISSING = 0x0100, /* CRL not available. */ |
1453 | GPGME_SIGSUM_CRL_TOO_OLD = 0x0200, /* Available CRL is too old. */ |
1454 | GPGME_SIGSUM_BAD_POLICY = 0x0400, /* A policy was not met. */ |
1455 | GPGME_SIGSUM_SYS_ERROR = 0x0800 /* A system error occured. */ |
1456 | } |
1457 | gpgme_sigsum_t; |
1458 | |
1459 | struct _gpgme_signature |
1460 | { |
1461 | struct _gpgme_signature *next; |
1462 | |
1463 | /* A summary of the signature status. */ |
1464 | gpgme_sigsum_t summary; |
1465 | |
1466 | /* The fingerprint or key ID of the signature. */ |
1467 | char *fpr; |
1468 | |
1469 | /* The status of the signature. */ |
1470 | gpgme_error_t status; |
1471 | |
1472 | /* Notation data and policy URLs. */ |
1473 | gpgme_sig_notation_t notations; |
1474 | |
1475 | /* Signature creation time. */ |
1476 | unsigned long timestamp; |
1477 | |
1478 | /* Signature exipration time or 0. */ |
1479 | unsigned long exp_timestamp; |
1480 | |
1481 | /* Key should not have been used for signing. */ |
1482 | unsigned int wrong_key_usage : 1; |
1483 | |
1484 | /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */ |
1485 | unsigned int pka_trust : 2; |
1486 | |
1487 | /* Validity has been verified using the chain model. */ |
1488 | unsigned int chain_model : 1; |
1489 | |
1490 | /* Internal to GPGME, do not use. */ |
1491 | int _unused : 28; |
1492 | |
1493 | gpgme_validity_t validity; |
1494 | gpgme_error_t validity_reason; |
1495 | |
1496 | /* The public key algorithm used to create the signature. */ |
1497 | gpgme_pubkey_algo_t pubkey_algo; |
1498 | |
1499 | /* The hash algorithm used to create the signature. */ |
1500 | gpgme_hash_algo_t hash_algo; |
1501 | |
1502 | /* The mailbox from the PKA information or NULL. */ |
1503 | char *pka_address; |
1504 | }; |
1505 | typedef struct _gpgme_signature *gpgme_signature_t; |
1506 | |
1507 | struct _gpgme_op_verify_result |
1508 | { |
1509 | gpgme_signature_t signatures; |
1510 | |
1511 | /* The original file name of the plaintext message, if |
1512 | available. */ |
1513 | char *file_name; |
1514 | }; |
1515 | typedef struct _gpgme_op_verify_result *gpgme_verify_result_t; |
1516 | |
1517 | /* Retrieve a pointer to the result of the verify operation. */ |
1518 | gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx); |
1519 | |
1520 | /* Verify within CTX that SIG is a valid signature for TEXT. */ |
1521 | gpgme_error_t gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig, |
1522 | gpgme_data_t signed_text, |
1523 | gpgme_data_t plaintext); |
1524 | gpgme_error_t gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig, |
1525 | gpgme_data_t signed_text, |
1526 | gpgme_data_t plaintext); |
1527 | |
1528 | |
1529 | /* Import. */ |
1530 | |
1531 | /* The key was new. */ |
1532 | #define GPGME_IMPORT_NEW 1 |
1533 | |
1534 | /* The key contained new user IDs. */ |
1535 | #define GPGME_IMPORT_UID 2 |
1536 | |
1537 | /* The key contained new signatures. */ |
1538 | #define GPGME_IMPORT_SIG 4 |
1539 | |
1540 | /* The key contained new sub keys. */ |
1541 | #define GPGME_IMPORT_SUBKEY 8 |
1542 | |
1543 | /* The key contained a secret key. */ |
1544 | #define GPGME_IMPORT_SECRET 16 |
1545 | |
1546 | |
1547 | struct _gpgme_import_status |
1548 | { |
1549 | struct _gpgme_import_status *next; |
1550 | |
1551 | /* Fingerprint. */ |
1552 | char *fpr; |
1553 | |
1554 | /* If a problem occured, the reason why the key could not be |
1555 | imported. Otherwise GPGME_No_Error. */ |
1556 | gpgme_error_t result; |
1557 | |
1558 | /* The result of the import, the GPGME_IMPORT_* values bit-wise |
1559 | ORed. 0 means the key was already known and no new components |
1560 | have been added. */ |
1561 | unsigned int status; |
1562 | }; |
1563 | typedef struct _gpgme_import_status *gpgme_import_status_t; |
1564 | |
1565 | /* Import. */ |
1566 | struct _gpgme_op_import_result |
1567 | { |
1568 | /* Number of considered keys. */ |
1569 | int considered; |
1570 | |
1571 | /* Keys without user ID. */ |
1572 | int no_user_id; |
1573 | |
1574 | /* Imported keys. */ |
1575 | int imported; |
1576 | |
1577 | /* Imported RSA keys. */ |
1578 | int imported_rsa; |
1579 | |
1580 | /* Unchanged keys. */ |
1581 | int unchanged; |
1582 | |
1583 | /* Number of new user ids. */ |
1584 | int new_user_ids; |
1585 | |
1586 | /* Number of new sub keys. */ |
1587 | int new_sub_keys; |
1588 | |
1589 | /* Number of new signatures. */ |
1590 | int new_signatures; |
1591 | |
1592 | /* Number of new revocations. */ |
1593 | int new_revocations; |
1594 | |
1595 | /* Number of secret keys read. */ |
1596 | int secret_read; |
1597 | |
1598 | /* Number of secret keys imported. */ |
1599 | int secret_imported; |
1600 | |
1601 | /* Number of secret keys unchanged. */ |
1602 | int secret_unchanged; |
1603 | |
1604 | /* Number of new keys skipped. */ |
1605 | int skipped_new_keys; |
1606 | |
1607 | /* Number of keys not imported. */ |
1608 | int not_imported; |
1609 | |
1610 | /* List of keys for which an import was attempted. */ |
1611 | gpgme_import_status_t imports; |
1612 | }; |
1613 | typedef struct _gpgme_op_import_result *gpgme_import_result_t; |
1614 | |
1615 | /* Retrieve a pointer to the result of the import operation. */ |
1616 | gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx); |
1617 | |
1618 | /* Import the key in KEYDATA into the keyring. */ |
1619 | gpgme_error_t gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata); |
1620 | gpgme_error_t gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata); |
1621 | gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata, |
1622 | int *nr) _GPGME_DEPRECATED; |
1623 | |
1624 | /* Import the keys from the array KEYS into the keyring. */ |
1625 | gpgme_error_t gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t keys[]); |
1626 | gpgme_error_t gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t keys[]); |
1627 | |
1628 | |
1629 | |
1630 | /* Export the keys found by PATTERN into KEYDATA. */ |
1631 | gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern, |
1632 | gpgme_export_mode_t mode, |
1633 | gpgme_data_t keydata); |
1634 | gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, |
1635 | gpgme_export_mode_t mode, |
1636 | gpgme_data_t keydata); |
1637 | |
1638 | gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx, |
1639 | const char *pattern[], |
1640 | gpgme_export_mode_t mode, |
1641 | gpgme_data_t keydata); |
1642 | gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], |
1643 | gpgme_export_mode_t mode, |
1644 | gpgme_data_t keydata); |
1645 | |
1646 | /* Export the keys from the array KEYS into KEYDATA. */ |
1647 | gpgme_error_t gpgme_op_export_keys_start (gpgme_ctx_t ctx, |
1648 | gpgme_key_t keys[], |
1649 | gpgme_export_mode_t mode, |
1650 | gpgme_data_t keydata); |
1651 | gpgme_error_t gpgme_op_export_keys (gpgme_ctx_t ctx, |
1652 | gpgme_key_t keys[], |
1653 | gpgme_export_mode_t mode, |
1654 | gpgme_data_t keydata); |
1655 | |
1656 | |
1657 | |
1658 | /* Key generation. */ |
1659 | struct _gpgme_op_genkey_result |
1660 | { |
1661 | /* A primary key was generated. */ |
1662 | unsigned int primary : 1; |
1663 | |
1664 | /* A sub key was generated. */ |
1665 | unsigned int sub : 1; |
1666 | |
1667 | /* Internal to GPGME, do not use. */ |
1668 | unsigned int _unused : 30; |
1669 | |
1670 | /* The fingerprint of the generated key. */ |
1671 | char *fpr; |
1672 | }; |
1673 | typedef struct _gpgme_op_genkey_result *gpgme_genkey_result_t; |
1674 | |
1675 | /* Generate a new keypair and add it to the keyring. PUBKEY and |
1676 | SECKEY should be null for now. PARMS specifies what keys should be |
1677 | generated. */ |
1678 | gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms, |
1679 | gpgme_data_t pubkey, gpgme_data_t seckey); |
1680 | gpgme_error_t gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms, |
1681 | gpgme_data_t pubkey, gpgme_data_t seckey); |
1682 | |
1683 | /* Retrieve a pointer to the result of the genkey operation. */ |
1684 | gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx); |
1685 | |
1686 | |
1687 | /* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret |
1688 | keys are also deleted. */ |
1689 | gpgme_error_t gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key, |
1690 | int allow_secret); |
1691 | gpgme_error_t gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key, |
1692 | int allow_secret); |
1693 | |
1694 | |
1695 | /* Edit the key KEY. Send status and command requests to FNC and |
1696 | output of edit commands to OUT. */ |
1697 | gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, |
1698 | gpgme_edit_cb_t fnc, void *fnc_value, |
1699 | gpgme_data_t out); |
1700 | gpgme_error_t gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key, |
1701 | gpgme_edit_cb_t fnc, void *fnc_value, |
1702 | gpgme_data_t out); |
1703 | |
1704 | /* Edit the card for the key KEY. Send status and command requests to |
1705 | FNC and output of edit commands to OUT. */ |
1706 | gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, |
1707 | gpgme_edit_cb_t fnc, void *fnc_value, |
1708 | gpgme_data_t out); |
1709 | gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key, |
1710 | gpgme_edit_cb_t fnc, void *fnc_value, |
1711 | gpgme_data_t out); |
1712 | |
1713 | |
1714 | /* Flags for the spawn operations. */ |
1715 | #define GPGME_SPAWN_DETACHED 1 |
1716 | #define GPGME_SPAWN_ALLOW_SET_FG 2 |
1717 | |
1718 | |
1719 | /* Run the command FILE with the arguments in ARGV. Connect stdin to |
1720 | DATAIN, stdout to DATAOUT, and STDERR to DATAERR. If one the data |
1721 | streams is NULL, connect to /dev/null instead. */ |
1722 | gpgme_error_t gpgme_op_spawn_start (gpgme_ctx_t ctx, |
1723 | const char *file, const char *argv[], |
1724 | gpgme_data_t datain, |
1725 | gpgme_data_t dataout, gpgme_data_t dataerr, |
1726 | unsigned int flags); |
1727 | gpgme_error_t gpgme_op_spawn (gpgme_ctx_t ctx, |
1728 | const char *file, const char *argv[], |
1729 | gpgme_data_t datain, |
1730 | gpgme_data_t dataout, gpgme_data_t dataerr, |
1731 | unsigned int flags); |
1732 | |
1733 | |
1734 | /* Key management functions. */ |
1735 | struct _gpgme_op_keylist_result |
1736 | { |
1737 | unsigned int truncated : 1; |
1738 | |
1739 | /* Internal to GPGME, do not use. */ |
1740 | unsigned int _unused : 31; |
1741 | }; |
1742 | typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t; |
1743 | |
1744 | /* Retrieve a pointer to the result of the key listing operation. */ |
1745 | gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx); |
1746 | |
1747 | /* Start a keylist operation within CTX, searching for keys which |
1748 | match PATTERN. If SECRET_ONLY is true, only secret keys are |
1749 | returned. */ |
1750 | gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern, |
1751 | int secret_only); |
1752 | gpgme_error_t gpgme_op_keylist_ext_start (gpgme_ctx_t ctx, |
1753 | const char *pattern[], |
1754 | int secret_only, int reserved); |
1755 | |
1756 | /* Return the next key from the keylist in R_KEY. */ |
1757 | gpgme_error_t gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key); |
1758 | |
1759 | /* Terminate a pending keylist operation within CTX. */ |
1760 | gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx); |
1761 | |
1762 | /* Change the passphrase for KEY. FLAGS is reserved for future use |
1763 | and must be passed as 0. */ |
1764 | gpgme_error_t gpgme_op_passwd_start (gpgme_ctx_t ctx, gpgme_key_t key, |
1765 | unsigned int flags); |
1766 | gpgme_error_t gpgme_op_passwd (gpgme_ctx_t ctx, gpgme_key_t key, |
1767 | unsigned int flags); |
1768 | |
1769 | |
1770 | |
1771 | /* Trust items and operations. */ |
1772 | |
1773 | struct _gpgme_trust_item |
1774 | { |
1775 | /* Internal to GPGME, do not use. */ |
1776 | unsigned int _refs; |
1777 | |
1778 | /* The key ID to which the trust item belongs. */ |
1779 | char *keyid; |
1780 | |
1781 | /* Internal to GPGME, do not use. */ |
1782 | char _keyid[16 + 1]; |
1783 | |
1784 | /* The type of the trust item, 1 refers to a key, 2 to a user ID. */ |
1785 | int type; |
1786 | |
1787 | /* The trust level. */ |
1788 | int level; |
1789 | |
1790 | /* The owner trust if TYPE is 1. */ |
1791 | char *owner_trust; |
1792 | |
1793 | /* Internal to GPGME, do not use. */ |
1794 | char _owner_trust[2]; |
1795 | |
1796 | /* The calculated validity. */ |
1797 | char *validity; |
1798 | |
1799 | /* Internal to GPGME, do not use. */ |
1800 | char _validity[2]; |
1801 | |
1802 | /* The user name if TYPE is 2. */ |
1803 | char *name; |
1804 | }; |
1805 | typedef struct _gpgme_trust_item *gpgme_trust_item_t; |
1806 | |
1807 | /* Start a trustlist operation within CTX, searching for trust items |
1808 | which match PATTERN. */ |
1809 | gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx, |
1810 | const char *pattern, int max_level); |
1811 | |
1812 | /* Return the next trust item from the trustlist in R_ITEM. */ |
1813 | gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx, |
1814 | gpgme_trust_item_t *r_item); |
1815 | |
1816 | /* Terminate a pending trustlist operation within CTX. */ |
1817 | gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx); |
1818 | |
1819 | /* Acquire a reference to ITEM. */ |
1820 | void gpgme_trust_item_ref (gpgme_trust_item_t item); |
1821 | |
1822 | /* Release a reference to ITEM. If this was the last one the trust |
1823 | item is destroyed. */ |
1824 | void gpgme_trust_item_unref (gpgme_trust_item_t item); |
1825 | |
1826 | /* Release the trust item ITEM. Deprecated, use |
1827 | gpgme_trust_item_unref. */ |
1828 | void gpgme_trust_item_release (gpgme_trust_item_t item) _GPGME_DEPRECATED; |
1829 | |
1830 | /* Return the value of the attribute WHAT of ITEM, which has to be |
1831 | representable by a string. Deprecated, use trust item structure |
1832 | directly. */ |
1833 | const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item, |
1834 | _gpgme_attr_t what, |
1835 | const void *reserved, int idx) |
1836 | _GPGME_DEPRECATED; |
1837 | |
1838 | /* Return the value of the attribute WHAT of KEY, which has to be |
1839 | representable by an integer. IDX specifies a running index if the |
1840 | attribute appears more than once in the key. Deprecated, use trust |
1841 | item structure directly. */ |
1842 | int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what, |
1843 | const void *reserved, int idx) |
1844 | _GPGME_DEPRECATED; |
1845 | |
1846 | |
1847 | /* Return the auditlog for the current session. This may be called |
1848 | after a successful or failed operation. If no audit log is |
1849 | available GPG_ERR_NO_DATA is returned. */ |
1850 | gpgme_error_t gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output, |
1851 | unsigned int flags); |
1852 | gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, |
1853 | unsigned int flags); |
1854 | |
1855 | |
1856 | |
1857 | /* Low-level Assuan protocol access. */ |
1858 | typedef gpgme_error_t (*gpgme_assuan_data_cb_t) |
1859 | (void *opaque, const void *data, size_t datalen); |
1860 | |
1861 | typedef gpgme_error_t (*gpgme_assuan_inquire_cb_t) |
1862 | (void *opaque, const char *name, const char *args, |
1863 | gpgme_data_t *r_data); |
1864 | |
1865 | typedef gpgme_error_t (*gpgme_assuan_status_cb_t) |
1866 | (void *opaque, const char *status, const char *args); |
1867 | |
1868 | /* Send the Assuan COMMAND and return results via the callbacks. |
1869 | Asynchronous variant. */ |
1870 | gpgme_error_t gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, |
1871 | const char *command, |
1872 | gpgme_assuan_data_cb_t data_cb, |
1873 | void *data_cb_value, |
1874 | gpgme_assuan_inquire_cb_t inq_cb, |
1875 | void *inq_cb_value, |
1876 | gpgme_assuan_status_cb_t stat_cb, |
1877 | void *stat_cb_value); |
1878 | |
1879 | /* Send the Assuan COMMAND and return results via the callbacks. |
1880 | Synchronous variant. */ |
1881 | gpgme_error_t gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, |
1882 | const char *command, |
1883 | gpgme_assuan_data_cb_t data_cb, |
1884 | void *data_cb_value, |
1885 | gpgme_assuan_inquire_cb_t inq_cb, |
1886 | void *inq_cb_value, |
1887 | gpgme_assuan_status_cb_t stat_cb, |
1888 | void *stat_cb_value, |
1889 | gpgme_error_t *op_err); |
1890 | |
1891 | /* Compat. */ |
1892 | struct _gpgme_op_assuan_result |
1893 | { |
1894 | /* Deprecated. Use the second value in a DONE event or the |
1895 | synchronous variant gpgme_op_assuan_transact_ext. */ |
1896 | gpgme_error_t err _GPGME_DEPRECATED_OUTSIDE_GPGME; |
1897 | }; |
1898 | typedef struct _gpgme_op_assuan_result *gpgme_assuan_result_t; |
1899 | |
1900 | |
1901 | /* Return the result of the last Assuan command. */ |
1902 | gpgme_assuan_result_t gpgme_op_assuan_result (gpgme_ctx_t ctx) |
1903 | _GPGME_DEPRECATED; |
1904 | |
1905 | gpgme_error_t |
1906 | gpgme_op_assuan_transact (gpgme_ctx_t ctx, |
1907 | const char *command, |
1908 | gpgme_assuan_data_cb_t data_cb, |
1909 | void *data_cb_value, |
1910 | gpgme_assuan_inquire_cb_t inq_cb, |
1911 | void *inq_cb_value, |
1912 | gpgme_assuan_status_cb_t status_cb, |
1913 | void *status_cb_value) _GPGME_DEPRECATED; |
1914 | |
1915 | |
1916 | /* Crypto container support. */ |
1917 | struct _gpgme_op_vfs_mount_result |
1918 | { |
1919 | char *mount_dir; |
1920 | }; |
1921 | typedef struct _gpgme_op_vfs_mount_result *gpgme_vfs_mount_result_t; |
1922 | |
1923 | gpgme_vfs_mount_result_t gpgme_op_vfs_mount_result (gpgme_ctx_t ctx); |
1924 | |
1925 | /* The container is automatically unmounted when the context is reset |
1926 | or destroyed. Transmission errors are returned directly, |
1927 | operational errors are returned in OP_ERR. */ |
1928 | gpgme_error_t gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file, |
1929 | const char *mount_dir, unsigned int flags, |
1930 | gpgme_error_t *op_err); |
1931 | |
1932 | gpgme_error_t gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], |
1933 | const char *container_file, |
1934 | unsigned int flags, gpgme_error_t *op_err); |
1935 | |
1936 | |
1937 | /* Interface to gpgconf(1). */ |
1938 | |
1939 | /* The expert level at which a configuration option or group of |
1940 | options should be displayed. See the gpgconf(1) documentation for |
1941 | more details. */ |
1942 | typedef enum |
1943 | { |
1944 | GPGME_CONF_BASIC = 0, |
1945 | GPGME_CONF_ADVANCED = 1, |
1946 | GPGME_CONF_EXPERT = 2, |
1947 | GPGME_CONF_INVISIBLE = 3, |
1948 | GPGME_CONF_INTERNAL = 4 |
1949 | } |
1950 | gpgme_conf_level_t; |
1951 | |
1952 | |
1953 | /* The data type of a configuration option argument. See the gpgconf(1) |
1954 | documentation for more details. */ |
1955 | typedef enum |
1956 | { |
1957 | /* Basic types. */ |
1958 | GPGME_CONF_NONE = 0, |
1959 | GPGME_CONF_STRING = 1, |
1960 | GPGME_CONF_INT32 = 2, |
1961 | GPGME_CONF_UINT32 = 3, |
1962 | |
1963 | /* Complex types. */ |
1964 | GPGME_CONF_FILENAME = 32, |
1965 | GPGME_CONF_LDAP_SERVER = 33, |
1966 | GPGME_CONF_KEY_FPR = 34, |
1967 | GPGME_CONF_PUB_KEY = 35, |
1968 | GPGME_CONF_SEC_KEY = 36, |
1969 | GPGME_CONF_ALIAS_LIST = 37 |
1970 | } |
1971 | gpgme_conf_type_t; |
1972 | |
1973 | /* For now, compatibility. */ |
1974 | #define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME |
1975 | |
1976 | |
1977 | /* This represents a single argument for a configuration option. |
1978 | Which of the members of value is used depends on the ALT_TYPE. */ |
1979 | typedef struct gpgme_conf_arg |
1980 | { |
1981 | struct gpgme_conf_arg *next; |
1982 | /* True if the option appears without an (optional) argument. */ |
1983 | unsigned int no_arg; |
1984 | union |
1985 | { |
1986 | unsigned int count; |
1987 | unsigned int uint32; |
1988 | int int32; |
1989 | char *string; |
1990 | } value; |
1991 | } *gpgme_conf_arg_t; |
1992 | |
1993 | |
1994 | /* The flags of a configuration option. See the gpg-conf |
1995 | documentation for details. */ |
1996 | #define GPGME_CONF_GROUP (1 << 0) |
1997 | #define GPGME_CONF_OPTIONAL (1 << 1) |
1998 | #define GPGME_CONF_LIST (1 << 2) |
1999 | #define GPGME_CONF_RUNTIME (1 << 3) |
2000 | #define GPGME_CONF_DEFAULT (1 << 4) |
2001 | #define GPGME_CONF_DEFAULT_DESC (1 << 5) |
2002 | #define GPGME_CONF_NO_ARG_DESC (1 << 6) |
2003 | #define GPGME_CONF_NO_CHANGE (1 << 7) |
2004 | |
2005 | |
2006 | /* The representation of a single configuration option. See the |
2007 | gpg-conf documentation for details. */ |
2008 | typedef struct gpgme_conf_opt |
2009 | { |
2010 | struct gpgme_conf_opt *next; |
2011 | |
2012 | /* The option name. */ |
2013 | char *name; |
2014 | |
2015 | /* The flags for this option. */ |
2016 | unsigned int flags; |
2017 | |
2018 | /* The level of this option. */ |
2019 | gpgme_conf_level_t level; |
2020 | |
2021 | /* The localized description of this option. */ |
2022 | char *description; |
2023 | |
2024 | /* The type and alternate type of this option. */ |
2025 | gpgme_conf_type_t type; |
2026 | gpgme_conf_type_t alt_type; |
2027 | |
2028 | /* The localized (short) name of the argument, if any. */ |
2029 | char *argname; |
2030 | |
2031 | /* The default value. */ |
2032 | gpgme_conf_arg_t default_value; |
2033 | char *default_description; |
2034 | |
2035 | /* The default value if the option is not set. */ |
2036 | gpgme_conf_arg_t no_arg_value; |
2037 | char *no_arg_description; |
2038 | |
2039 | /* The current value if the option is set. */ |
2040 | gpgme_conf_arg_t value; |
2041 | |
2042 | /* The new value, if any. NULL means reset to default. */ |
2043 | int change_value; |
2044 | gpgme_conf_arg_t new_value; |
2045 | |
2046 | /* Free for application use. */ |
2047 | void *user_data; |
2048 | } *gpgme_conf_opt_t; |
2049 | |
2050 | |
2051 | /* The representation of a component that can be configured. See the |
2052 | gpg-conf documentation for details. */ |
2053 | typedef struct gpgme_conf_comp |
2054 | { |
2055 | struct gpgme_conf_comp *next; |
2056 | |
2057 | /* Internal to GPGME, do not use! */ |
2058 | gpgme_conf_opt_t *_last_opt_p; |
2059 | |
2060 | /* The component name. */ |
2061 | char *name; |
2062 | |
2063 | /* A human-readable description for the component. */ |
2064 | char *description; |
2065 | |
2066 | /* The program name (an absolute path to the program). */ |
2067 | char *program_name; |
2068 | |
2069 | /* A linked list of options for this component. */ |
2070 | struct gpgme_conf_opt *options; |
2071 | } *gpgme_conf_comp_t; |
2072 | |
2073 | |
2074 | /* Allocate a new gpgme_conf_arg_t. If VALUE is NULL, a "no arg |
2075 | default" is prepared. If type is a string type, VALUE should point |
2076 | to the string. Else, it should point to an unsigned or signed |
2077 | integer respectively. */ |
2078 | gpgme_error_t gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p, |
2079 | gpgme_conf_type_t type, const void *value); |
2080 | |
2081 | /* This also releases all chained argument structures! */ |
2082 | void gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type); |
2083 | |
2084 | /* Register a change for the value of OPT to ARG. If RESET is 1 (do |
2085 | not use any values but 0 or 1), ARG is ignored and the option is |
2086 | not changed (reverting a previous change). Otherwise, if ARG is |
2087 | NULL, the option is cleared or reset to its default. */ |
2088 | gpgme_error_t gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, |
2089 | gpgme_conf_arg_t arg); |
2090 | |
2091 | /* Release a set of configurations. */ |
2092 | void gpgme_conf_release (gpgme_conf_comp_t conf); |
2093 | |
2094 | /* Retrieve the current configurations. */ |
2095 | gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p); |
2096 | |
2097 | /* Save the configuration of component comp. This function does not |
2098 | follow chained components! */ |
2099 | gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp); |
2100 | |
2101 | |
2102 | /* UIServer support. */ |
2103 | |
2104 | /* Create a dummy key to specify an email address. */ |
2105 | gpgme_error_t gpgme_key_from_uid (gpgme_key_t *key, const char *name); |
2106 | |
2107 | |
2108 | |
2109 | /* Various functions. */ |
2110 | |
2111 | /* Set special global flags; consult the manual before use. */ |
2112 | int gpgme_set_global_flag (const char *name, const char *value); |
2113 | |
2114 | /* Check that the library fulfills the version requirement. Note: |
2115 | This is here only for the case where a user takes a pointer from |
2116 | the old version of this function. The new version and macro for |
2117 | run-time checks are below. */ |
2118 | const char *gpgme_check_version (const char *req_version); |
2119 | |
2120 | /* Check that the library fulfills the version requirement and check |
2121 | for struct layout mismatch involving bitfields. */ |
2122 | const char *gpgme_check_version_internal (const char *req_version, |
2123 | size_t offset_sig_validity); |
2124 | |
2125 | #define gpgme_check_version(req_version) \ |
2126 | gpgme_check_version_internal (req_version, \ |
2127 | offsetof (struct _gpgme_signature, validity)) |
2128 | |
2129 | /* Return the default values for various directories. */ |
2130 | const char *gpgme_get_dirinfo (const char *what); |
2131 | |
2132 | /* Get the information about the configured and installed engines. A |
2133 | pointer to the first engine in the statically allocated linked list |
2134 | is returned in *INFO. If an error occurs, it is returned. The |
2135 | returned data is valid until the next gpgme_set_engine_info. */ |
2136 | gpgme_error_t gpgme_get_engine_info (gpgme_engine_info_t *engine_info); |
2137 | |
2138 | /* Set the default engine info for the protocol PROTO to the file name |
2139 | FILE_NAME and the home directory HOME_DIR. */ |
2140 | gpgme_error_t gpgme_set_engine_info (gpgme_protocol_t proto, |
2141 | const char *file_name, |
2142 | const char *home_dir); |
2143 | |
2144 | |
2145 | /* Engine support functions. */ |
2146 | |
2147 | /* Verify that the engine implementing PROTO is installed and |
2148 | available. */ |
2149 | gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto); |
2150 | |
2151 | |
2152 | void gpgme_result_ref (void *result); |
2153 | void gpgme_result_unref (void *result); |
2154 | |
2155 | |
2156 | /* Deprecated types. */ |
2157 | typedef gpgme_ctx_t GpgmeCtx _GPGME_DEPRECATED; |
2158 | typedef gpgme_data_t GpgmeData _GPGME_DEPRECATED; |
2159 | typedef gpgme_error_t GpgmeError _GPGME_DEPRECATED; |
2160 | typedef gpgme_data_encoding_t GpgmeDataEncoding _GPGME_DEPRECATED; |
2161 | typedef gpgme_pubkey_algo_t GpgmePubKeyAlgo _GPGME_DEPRECATED; |
2162 | typedef gpgme_hash_algo_t GpgmeHashAlgo _GPGME_DEPRECATED; |
2163 | typedef gpgme_sig_stat_t GpgmeSigStat _GPGME_DEPRECATED; |
2164 | typedef gpgme_sig_mode_t GpgmeSigMode _GPGME_DEPRECATED; |
2165 | typedef gpgme_attr_t GpgmeAttr _GPGME_DEPRECATED; |
2166 | typedef gpgme_validity_t GpgmeValidity _GPGME_DEPRECATED; |
2167 | typedef gpgme_protocol_t GpgmeProtocol _GPGME_DEPRECATED; |
2168 | typedef gpgme_engine_info_t GpgmeEngineInfo _GPGME_DEPRECATED; |
2169 | typedef gpgme_subkey_t GpgmeSubkey _GPGME_DEPRECATED; |
2170 | typedef gpgme_key_sig_t GpgmeKeySig _GPGME_DEPRECATED; |
2171 | typedef gpgme_user_id_t GpgmeUserID _GPGME_DEPRECATED; |
2172 | typedef gpgme_key_t GpgmeKey _GPGME_DEPRECATED; |
2173 | typedef gpgme_passphrase_cb_t GpgmePassphraseCb _GPGME_DEPRECATED; |
2174 | typedef gpgme_progress_cb_t GpgmeProgressCb _GPGME_DEPRECATED; |
2175 | typedef gpgme_io_cb_t GpgmeIOCb _GPGME_DEPRECATED; |
2176 | typedef gpgme_register_io_cb_t GpgmeRegisterIOCb _GPGME_DEPRECATED; |
2177 | typedef gpgme_remove_io_cb_t GpgmeRemoveIOCb _GPGME_DEPRECATED; |
2178 | typedef gpgme_event_io_t GpgmeEventIO _GPGME_DEPRECATED; |
2179 | typedef gpgme_event_io_cb_t GpgmeEventIOCb _GPGME_DEPRECATED; |
2180 | #define GpgmeIOCbs gpgme_io_cbs |
2181 | typedef gpgme_data_read_cb_t GpgmeDataReadCb _GPGME_DEPRECATED; |
2182 | typedef gpgme_data_write_cb_t GpgmeDataWriteCb _GPGME_DEPRECATED; |
2183 | typedef gpgme_data_seek_cb_t GpgmeDataSeekCb _GPGME_DEPRECATED; |
2184 | typedef gpgme_data_release_cb_t GpgmeDataReleaseCb _GPGME_DEPRECATED; |
2185 | #define GpgmeDataCbs gpgme_data_cbs |
2186 | typedef gpgme_encrypt_result_t GpgmeEncryptResult _GPGME_DEPRECATED; |
2187 | typedef gpgme_sig_notation_t GpgmeSigNotation _GPGME_DEPRECATED; |
2188 | typedef gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED; |
2189 | typedef gpgme_verify_result_t GpgmeVerifyResult _GPGME_DEPRECATED; |
2190 | typedef gpgme_import_status_t GpgmeImportStatus _GPGME_DEPRECATED; |
2191 | typedef gpgme_import_result_t GpgmeImportResult _GPGME_DEPRECATED; |
2192 | typedef gpgme_genkey_result_t GpgmeGenKeyResult _GPGME_DEPRECATED; |
2193 | typedef gpgme_trust_item_t GpgmeTrustItem _GPGME_DEPRECATED; |
2194 | typedef gpgme_status_code_t GpgmeStatusCode _GPGME_DEPRECATED; |
2195 | |
2196 | #ifdef __cplusplus |
2197 | } |
2198 | #endif |
2199 | #endif /* GPGME_H */ |
2200 | /* |
2201 | Local Variables: |
2202 | buffer-read-only: t |
2203 | End: |
2204 | */ |
2205 | |