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