/[winpt]/trunk/MyGPGME/gpgme.h
ViewVC logotype

Contents of /trunk/MyGPGME/gpgme.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13 - (show annotations)
Mon Apr 25 07:15:30 2005 UTC (19 years, 10 months ago) by twoaday
File MIME type: text/plain
File size: 31102 byte(s)
Commit bug fixes. Release 0.9.92.

1 /* gpgme.h - My GnuPG Made Easy (MyGPGME)
2 * Copyright (C) 2000 Werner Koch (dd9jn)
3 * Copyright (C) 2001-2005 Timo Schulz
4 *
5 * This file is part of MyGPGME.
6 *
7 * MyGPGME is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * MyGPGME is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 */
21
22 #ifndef GPGME_H
23 #define GPGME_H
24
25 #include <stdio.h> /* for FILE * */
26 #include <time.h> /* for time_t */
27
28 #ifdef __cplusplus
29 extern "C" {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 #endif
34
35
36 /*
37 * The version of this header should match the one of the library
38 * It should not be used by a program because gpgme_check_version(NULL)
39 * does return the same version. The purpose of this macro is to
40 * let autoconf (using the AM_PATH_GPGME macro) check that this
41 * header matches the installed library.
42 * Warning: Do not edit the next line. configure will do that for you! */
43 #define GPGME_VERSION "20050418ts"
44
45 struct gpgme_context_s;
46 typedef struct gpgme_context_s *gpgme_ctx_t;
47
48 struct gpgme_data_s;
49 typedef struct gpgme_data_s *gpgme_data_t;
50
51 struct gpgme_recipients_s;
52 typedef struct gpgme_recipients_s *gpgme_recipients_t;
53
54 struct gpgme_key_s;
55 typedef struct gpgme_key_s *gpgme_key_t;
56
57 struct gpgme_keycache_s;
58 typedef struct gpgme_keycache_s *gpgme_keycache_t;
59
60 struct gpgme_signature_s;
61 typedef struct gpgme_signature_s *gpgme_sig_t;
62
63 struct gpgme_editkey_s;
64 typedef struct gpgme_editkey_s *gpgme_editkey_t;
65
66 struct gpgme_editcard_s;
67 typedef struct gpgme_editcard_s *gpgme_editcard_t;
68
69 struct gpgme_card_s;
70 typedef struct gpgme_card_s *gpgme_card_t;
71
72 struct gpgme_user_id_info_s;
73 typedef struct gpgme_user_id_info_s *gpgme_uidinfo_t;
74
75 struct gpgme_rev_cert_s;
76 typedef struct gpgme_rev_cert_s *gpgme_revcert_t;
77
78
79 typedef enum {
80 GPGME_EOF = -1,
81 GPGME_No_Error = 0,
82 GPGME_General_Error = 1,
83 GPGME_Out_Of_Core = 2,
84 GPGME_Invalid_Value = 3,
85 GPGME_Busy = 4,
86 GPGME_No_Request = 5,
87 GPGME_Exec_Error = 6,
88 GPGME_Too_Many_Procs = 7,
89 GPGME_Pipe_Error = 8,
90 GPGME_No_Recipients = 9,
91 GPGME_No_Data = 10,
92 GPGME_Conflict = 11,
93 GPGME_Not_Implemented = 12,
94 GPGME_Read_Error = 13,
95 GPGME_Write_Error = 14,
96 GPGME_Invalid_Type = 15,
97 GPGME_Invalid_Mode = 16,
98 GPGME_File_Error = 17, /* errno is set in this case */
99 GPGME_Decryption_Failed = 18,
100 GPGME_Signing_Failed = 19,
101 GPGME_Encryption_Failed = 29,
102 GPGME_No_Passphrase = 20,
103 GPGME_No_Seckey = 21,
104 GPGME_No_Pubkey = 27,
105 GPGME_Canceled = 22,
106 GPGME_Invalid_Key = 23,
107 GPGME_Invalid_Engine = 24,
108 GPGME_Bad_Signature = 25,
109 GPGME_Bad_Passphrase = 26,
110 GPGME_Inv_Recipients = 28,
111 GPGME_Internal_GPG_Problem = 30,
112 GPGME_Clip_Open = 31,
113 GPGME_Clip_Empty = 32,
114 GPGME_Clip_Get = 33,
115 GPGME_Cipher_IDEA = 34,
116 GPGME_Conf_InvOption = 35,
117 GPGME_SC_Failure = 36,
118
119 /* Recipient Errors */
120 GPGME_RecpError_NoReason = 100,
121 GPGME_RecpError_NotFound = 101,
122 GPGME_RecpError_Ambigious = 102,
123 GPGME_RecpError_WrongKeyUsage = 103,
124 GPGME_RecpError_Revoked = 104,
125 GPGME_RecpError_Expired = 105,
126 GPGME_RecpError_NotSecret = 109,
127 GPGME_RecpError_Untrusted = 110,
128 } gpgme_error_t;
129
130 typedef enum {
131 GPGME_DATA_TYPE_NONE = 0,
132 GPGME_DATA_TYPE_MEM = 1,
133 GPGME_DATA_TYPE_FD = 2,
134 GPGME_DATA_TYPE_FILE = 3,
135 GPGME_DATA_TYPE_CB = 4
136 } gpgme_data_type_t;
137
138 typedef enum {
139 GPGME_SIG_STAT_NONE = 0,
140 GPGME_SIG_STAT_GOOD = 1,
141 GPGME_SIG_STAT_BAD = 2,
142 GPGME_SIG_STAT_NOKEY = 3,
143 GPGME_SIG_STAT_NOSIG = 4,
144 GPGME_SIG_STAT_ERROR = 5,
145 GPGME_SIG_STAT_DIFF = 6,
146 GPGME_SIG_STAT_E_GOOD= 7,
147 GPGME_SIG_STAT_R_GOOD= 8,
148 } gpgme_sigstat_t;
149
150 typedef enum {
151 GPGME_SIGF_NONE = 0,
152 GPGME_SIGF_LOCAL = 1,
153 GPGME_SIGF_NREV = 2
154 } gpgme_sigflat_t;
155
156 typedef enum {
157 GPGME_SIG_MODE_NORMAL = 0,
158 GPGME_SIG_MODE_DETACH = 1,
159 GPGME_SIG_MODE_CLEAR = 2
160 } gpgme_sigmode_t;
161
162 typedef enum {
163 GPGME_ATTR_KEYID = 1,
164 GPGME_ATTR_FPR = 2,
165 GPGME_ATTR_ALGO = 3,
166 GPGME_ATTR_ALGO_SHORT = 4,
167 GPGME_ATTR_LEN = 5,
168 GPGME_ATTR_CREATED = 6,
169 GPGME_ATTR_EXPIRE = 7,
170 GPGME_ATTR_EXPIRES = 8,
171 GPGME_ATTR_OTRUST = 9,
172 GPGME_ATTR_USERID = 10,
173 GPGME_ATTR_NAME = 11,
174 GPGME_ATTR_EMAIL = 12,
175 GPGME_ATTR_COMMENT = 13,
176 GPGME_ATTR_VALIDITY = 14,
177 GPGME_ATTR_LEVEL = 15,
178 GPGME_ATTR_TYPE = 16,
179 GPGME_ATTR_IS_SECRET = 17,
180 GPGME_ATTR_IS_ULTIMATE = 18,
181 GPGME_ATTR_IS_PROTECTED = 19,
182 GPGME_ATTR_MDC = 20,
183 GPGME_ATTR_NOTATION = 21,
184 GPGME_ATTR_POLICY_URL = 22,
185 GPGME_ATTR_REVKEY_ALGO = 23,
186 GPGME_ATTR_REVKEY_FPR = 24,
187 GPGME_ATTR_OPAQUE = 25,
188 GPGME_ATTR_MD = 26,
189 GPGME_ATTR_PHOTO = 27,
190 GPGME_ATTR_CAN_ENCRYPT = 28,
191 GPGME_ATTR_CAN_SIGN = 29,
192 GPGME_ATTR_CAN_CERTIFY = 30,
193 GPGME_ATTR_CAN_AUTH = 31,
194 GPGME_ATTR_DIVERT_CARD = 32,
195 GPGME_ATTR_KEYSERVER = 33,
196
197 GPGME_ATTR_KEYDAT_NP = 50,
198 GPGME_ATTR_KEYDAT_BITS = 51,
199 GPGME_ATTR_KEYDAT_VAL = 52,
200
201 GPGME_ATTR_KEY_REVOKED = 100,
202 GPGME_ATTR_KEY_INVALID = 101,
203 GPGME_ATTR_KEY_EXPIRED = 102,
204 GPGME_ATTR_KEY_DISABLED = 103,
205 GPGME_ATTR_KEY_CAPS = 104,
206 GPGME_ATTR_KEY_SYMPREFS = 105,
207 GPGME_ATTR_KEY_VALIDITY = 106,
208 GPGME_ATTR_KEY_CARDNO = 107,
209 GPGME_ATTR_KEY_USABLE = 108,
210
211 GPGME_ATTR_UID_REVOKED = 150,
212 GPGME_ATTR_UID_INVALID = 151,
213 GPGME_ATTR_UID_PRIMARY = 152,
214 GPGME_ATTR_UID_PREFS = 153,
215 GPGME_ATTR_UID_CREATED = 154,
216 GPGME_ATTR_UID_HASH = 155,
217
218 GPGME_ATTR_SIG_ALGO = 200,
219 GPGME_ATTR_SIG_KEYID = 201,
220 GPGME_ATTR_SIG_ISSUER = 202,
221 GPGME_ATTR_SIG_CREATED = 203,
222 GPGME_ATTR_SIG_EXPIRES = 204,
223 GPGME_ATTR_SIG_STAT = 205,
224 GPGME_ATTR_SIG_USERID = 206,
225 GPGME_ATTR_SIG_CLASS = 206,
226 GPGME_ATTR_SIG_FLAGS = 207,
227
228 GPGME_ATTR_CARD_AID = 250,
229 GPGME_ATTR_CARD_VER = 251,
230 GPGME_ATTR_CARD_VENDOR = 252,
231 GPGME_ATTR_CARD_SERIAL = 253,
232 GPGME_ATTR_CARD_NAME = 254,
233 GPGME_ATTR_CARD_NAME2 = 255,
234 GPGME_ATTR_CARD_LANG = 256,
235 GPGME_ATTR_CARD_SEX = 257,
236 GPGME_ATTR_CARD_URL = 258,
237 GPGME_ATTR_CARD_LOGIN = 259,
238 GPGME_ATTR_CARD_MAXPINLEN=260,
239 GPGME_ATTR_CARD_SIGCOUNT= 261,
240 GPGME_ATTR_CARD_FPR = 262
241 } gpgme_attr_t;
242
243 typedef enum {
244 GPGME_EDITKEY_SIGN = 1,
245 GPGME_EDITKEY_LSIGN = 2,
246 GPGME_EDITKEY_NRSIGN = 19,
247 GPGME_EDITKEY_NRLSIGN = 22,
248 GPGME_EDITKEY_TSIGN = 20,
249 GPGME_EDITKEY_TRUST = 3,
250 GPGME_EDITKEY_ADDUID = 4,
251 GPGME_EDITKEY_DELUID = 5,
252 GPGME_EDITKEY_DELKEY = 6,
253 GPGME_EDITKEY_ADDKEY = 7,
254 GPGME_EDITKEY_PASSWD = 8,
255 GPGME_EDITKEY_PRIMARY = 9,
256 GPGME_EDITKEY_EXPIRE = 10,
257 GPGME_EDITKEY_REVSIG = 11,
258 GPGME_EDITKEY_REVKEY = 12,
259 GPGME_EDITKEY_REVOKE = 13, /* revoke the whole key */
260 GPGME_EDITKEY_ADDREV = 14,
261 GPGME_EDITKEY_ADDPHOTO= 15,
262 GPGME_EDITKEY_ENABLE = 16,
263 GPGME_EDITKEY_DISABLE = 17,
264 GPGME_EDITKEY_SETPREF = 18,
265 GPGME_EDITKEY_DELSIG = 21,
266 GPGME_EDITKEY_KEYSERV = 23
267 } gpgme_edit_key_t;
268
269
270 typedef enum {
271 GPGME_EDITCARD_NAME = 1,
272 GPGME_EDITCARD_NAME2 = 2,
273 GPGME_EDITCARD_KEYURL = 3,
274 GPGME_EDITCARD_LOGIN = 4,
275 GPGME_EDITCARD_SEX = 5,
276 GPGME_EDITCARD_LANG = 6,
277 GPGME_EDITCARD_APIN = 7,
278 GPGME_EDITCARD_UPIN = 8,
279 GPGME_EDITCARD_GENKEY = 9,
280 GPGME_EDITCARD_FETCH = 10,
281 GPGME_EDITCARD_CAFPR = 11,
282 /* change pin */
283 GPGME_EDITCARD_CHAPIN = 20,
284 GPGME_EDITCARD_CHUPIN = 21,
285 GPGME_EDITCARD_UNBPIN = 22 /*unblock PIN*/
286 } gpgme_edit_card_t;
287
288 typedef enum {
289 GPGME_CARDFLAG_NONE = 0,
290 GPGME_CARDFLAG_REPLACE = 1,
291 GPGME_CARDFLAG_BAKENC = 2
292 } gpgme_cardflag_t;
293
294 typedef enum {
295 GPGME_VALIDITY_UNKNOWN = 0,
296 GPGME_VALIDITY_UNDEFINED = 1,
297 GPGME_VALIDITY_NEVER = 2,
298 GPGME_VALIDITY_MARGINAL = 3,
299 GPGME_VALIDITY_FULL = 4,
300 GPGME_VALIDITY_ULTIMATE = 5,
301 GPGME_VALIDITY_REVOKED = 6,
302 GPGME_VALIDITY_EXPIRED = 7
303 } gpgme_validity_t;
304
305 typedef enum {
306 GPGME_TRUST_UNKNOWN = 0,
307 GPGME_TRUST_DONTKNOW = 1,
308 GPGME_TRUST_NEVER = 2,
309 GPGME_TRUST_MARGINAL = 3,
310 GPGME_TRUST_FULLY = 4,
311 GPGME_TRUST_ULTIMATE = 5,
312 GPGME_TRUST_UNDEFINED = 6,
313 GPGME_TRUST_EXPIRED = 7
314 } GpgmeOwnertrust;
315
316 typedef enum {
317 GPGME_CTRL_ARMOR = 1,
318 GPGME_CTRL_TEXTMODE = 2,
319 GPGME_CTRL_THROWKEYID = 4,
320 GPGME_CTRL_LISTMODE = 8,
321 GPGME_CTRL_FORCETRUST = 16,
322 GPGME_CTRL_SIGMODE = 32,
323 GPGME_CTRL_CIPHER = 64,
324 GPGME_CTRL_PASSPWD = 128,
325 GPGME_CTRL_TMPFILES = 256,
326 GPGME_CTRL_WITH_SECRET_KEY = 512,
327 GPGME_CTRL_FORCEOPT = 1024,
328 GPGME_CTRL_FILE = 2048,
329 GPGME_CTRL_FPR = 4096,
330 GPGME_CTRL_S2K = 8192,
331 GPGME_CTRL_S2K_MODE = 16384,
332 GPGME_CTRL_S2K_HASH = 32678,
333 GPGME_CTRL_INTERACTIVE = 65536,
334 GPGME_CTRL_PIPEMODE = 131072,
335 GPGME_CTRL_LOGGING = 262144,
336 GPGME_CTRL_NO_COMPR = 524288,
337 GPGME_CTRL_CB_VAL = 1048576
338 } gpgme_control_t;
339
340 typedef enum {
341 GPGME_LISTMODE_NORMAL = 0,
342 GPGME_LISTMODE_NOTRUST = 1,
343 GPGME_LISTMODE_KEYDATA = 2,
344 GPGME_LISTMODE_FAST = 4
345 } gpgme_listmode_t;
346
347 typedef enum {
348 GPGME_LISTOPT_NONE = 0,
349 GPGME_LISTOPT_SIGSUBPKT = 1
350 } gpgme_listopt_t;
351
352 typedef enum {
353 GPGME_KEYGEN_NONE = 0,
354 GPGME_KEYGEN_DSA_ELG = 1,
355 GPGME_KEYGEN_DSA_RSA = 2,
356 GPGME_KEYGEN_DSA_SIG = 3,
357 GPGME_KEYGEN_RSA_SIG = 4,
358 GPGME_KEYGEN_RSA = 5,
359 GPGME_KEYGEN_RSA_RSA = 6 /*PGP*/
360 } gpgme_keygen_t;
361
362 typedef enum {
363 GPGME_IMPSTAT_NPKEYS = 0,
364 GPGME_IMPSTAT_NOSELFSIG = 1,
365 GPGME_IMPSTAT_IPKEYS = 2,
366 GPGME_IMPSTAT_NUIDS = 5,
367 GPGME_IMPSTAT_NSUBKEYS = 6,
368 GPGME_IMPSTAT_NSIGS = 7,
369 GPGME_IMPSTAT_NREV = 8,
370 GPGME_IMPSTAT_NSKEYS = 9,
371 GPGME_IMPSTAT_ISKEYS = 10
372 } gpgme_import_status_t;
373
374
375 typedef enum {
376 GPGME_REVOKE_INSECURE = 1,
377 GPGME_REVOKE_SUPERSEDED = 2,
378 GPGME_REVOKE_NOUSED = 3
379 } gpgme_revoke_reason_t;
380
381
382 typedef enum {
383 GPGME_OPFLAG_NOSECKEY = 1,
384 GPGME_OPFLAG_BADMDC = 2,
385 GPGME_OPFLAG_BADARMOR = 4
386 } gpgme_op_flags_t;
387
388
389 typedef enum {
390 GPGME_CLIP_MESSAGE = 1,
391 GPGME_CLIP_CLEARSIG = 2,
392 GPGME_CLIP_SIG = 4,
393 GPGME_CLIP_PUBKEY = 8,
394 GPGME_CLIP_SECKEY = 16,
395 GPGME_CLIP_DASH_ESCAPED = 32
396 } gpgme_cliptype_t;
397
398 typedef enum {
399 GPGME_CIPHER_3DES = 1,
400 GPGME_CIPHER_CAST5 = 2,
401 GPGME_CIPHER_BLOWFISH = 3,
402 GPGME_CIPHER_AES128 = 4,
403 GPGME_CIPHER_AES192 = 5,
404 GPGME_CIPHER_AES256 = 6,
405 GPGME_CIPHER_TWOFISH = 7
406 } gpgme_cipher_t;
407
408 typedef enum {
409 GPGME_S2K_SIMPLE = 0,
410 GPGME_S2K_SALTED = 1,
411 GPGME_S2K_ITERSALTED = 3
412 } gpgme_s2kmode_t;
413
414
415 typedef enum {
416 GPGME_PK_RSA = 1,
417 GPGME_PK_RSA_E = 2,
418 GPGME_PK_RSA_S = 3,
419 GPGME_PK_ELG_E = 16,
420 GPGME_PK_DSA = 17,
421 GPGME_PK_ELG_ES = 20
422 } gpgme_pk_cipher_t;
423
424 typedef enum {
425 GPGME_MD_SHA1 = 2,
426 GPGME_MD_RMD160 = 3
427 } gpgme_md_t;
428
429
430 #define GPGME_KEY_CANSIGN 0x01
431 #define GPGME_KEY_CANENCR 0x02
432
433 typedef const char *(*gpgme_passphrase_cb_t)( void*, const char *desc,
434 void * r_hd );
435
436 typedef const char *(*gpgme_interactive_cb_t)( void * opaque,
437 int code, const char * key,
438 const char * val );
439 typedef void (*gpgme_progress_cb_t)( void * opaque,
440 const char * what,
441 int type, unsigned current, unsigned total );
442
443 typedef void (*gpgme_wipe_t)( const char *path, int simple );
444
445
446 /* Initialize the library */
447 gpgme_error_t gpgme_lib_init (void);
448 void gpgme_lib_cleanup (void);
449
450 /* Context management */
451 gpgme_error_t gpgme_new( gpgme_ctx_t * r_ctx );
452 void gpgme_release( gpgme_ctx_t ctx );
453 void gpgme_cancel( gpgme_ctx_t ctx );
454 gpgme_ctx_t gpgme_wait( gpgme_ctx_t c, int hang );
455
456 gpgme_error_t gpgme_get_enc_to_ctx( gpgme_ctx_t c, gpgme_recipients_t *r_ctx );
457 void gpgme_clear_enc_to_ctx (gpgme_ctx_t ctx);
458 char * gpgme_get_notation (gpgme_ctx_t ctx);
459 char * gpgme_get_logging (gpgme_ctx_t ctx);
460 gpgme_error_t gpgme_check_logging (gpgme_ctx_t ctx);
461 void gpgme_set_comment (gpgme_ctx_t c, const char * text);
462 void * gpgme_control( gpgme_ctx_t c, int cmd, int val );
463 void gpgme_set_passphrase_cb( gpgme_ctx_t c,
464 gpgme_passphrase_cb_t cb, void *cb_value );
465 void gpgme_set_interactive_cb( gpgme_ctx_t ctx,
466 gpgme_interactive_cb_t cb, void * cb_value );
467 void gpgme_set_progress_cb( gpgme_ctx_t c,
468 gpgme_progress_cb_t cb, void * cb_value );
469 void gpgme_set_wipe_fnc( gpgme_ctx_t c, gpgme_wipe_t fnc );
470 void gpgme_set_local_user( gpgme_ctx_t ctx, const char * name );
471 int gpgme_get_process_rc( gpgme_ctx_t ctx );
472
473 void gpgme_signers_clear( gpgme_ctx_t ctx );
474 gpgme_error_t gpgme_signers_add( gpgme_ctx_t ctx, const gpgme_key_t key );
475 gpgme_key_t gpgme_signers_enum( const gpgme_ctx_t c, int seq );
476 gpgme_error_t gpgme_get_sig_key( gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key );
477 gpgme_error_t gpgme_get_sig_ctx( gpgme_ctx_t ctx, int idx, size_t *r_ncount,
478 gpgme_sig_t *r_sig );
479
480 /* Functions to handle recipients */
481 gpgme_error_t gpgme_recipients_new( gpgme_recipients_t *r_rset );
482 void gpgme_recipients_release( gpgme_recipients_t rset );
483 gpgme_error_t gpgme_recipients_add_name( gpgme_recipients_t rset,
484 const char *name );
485 gpgme_error_t gpgme_recipients_add_name_with_validity( gpgme_recipients_t rset,
486 const char *name,
487 gpgme_validity_t val );
488 unsigned int gpgme_recipients_count (const gpgme_recipients_t rset);
489 const char* gpgme_recipients_get_name (const gpgme_recipients_t rset, int pos);
490 gpgme_error_t gpgme_recipients_enum_open( const gpgme_recipients_t rset,
491 void ** ctx );
492 const char * gpgme_recipients_enum_read( const gpgme_recipients_t rset,
493 void ** ctx );
494 gpgme_error_t gpgme_recipients_enum_close( const gpgme_recipients_t rset,
495 void ** ctx );
496
497 int gpgme_recperr_count_items( gpgme_ctx_t ctx );
498 const char * gpgme_recperr_get( gpgme_ctx_t ctx, int idx,
499 gpgme_error_t * r_code );
500
501 /* Functions to handle data sources */
502 gpgme_error_t gpgme_data_new( gpgme_data_t *r_dh );
503 gpgme_error_t gpgme_data_new_from_mem( gpgme_data_t *r_dh,
504 const char *buffer, size_t size,
505 int copy );
506 gpgme_error_t gpgme_data_new_with_read_cb( gpgme_data_t *r_dh,
507 int (*read_cb)(void*,char *,size_t,size_t*),
508 void *read_cb_value );
509
510 gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh,
511 const char *fname);
512 gpgme_error_t gpgme_data_new_from_filepart( gpgme_data_t * r_dh,
513 const char * fname, FILE * fp,
514 long offset,
515 unsigned long length );
516 void gpgme_data_release( gpgme_data_t dh );
517 char * gpgme_data_release_and_get_mem( gpgme_data_t dh,
518 size_t * r_len );
519 gpgme_data_type_t gpgme_data_get_type( gpgme_data_t dh );
520 gpgme_error_t gpgme_data_rewind( gpgme_data_t dh );
521 gpgme_error_t gpgme_data_read( gpgme_data_t dh,
522 char *buffer, size_t length, size_t *nread );
523 gpgme_error_t gpgme_data_write( gpgme_data_t dh,
524 const char *buffer, size_t length );
525 #define gpgme_data_putc( dh, c ) do { \
526 unsigned char buf[2]; \
527 buf[0] = c & 0xFF; buf[1] = 0x00; \
528 gpgme_data_write( dh, buf, 1 ); \
529 } while( 0 )
530
531 /* Key and trust functions */
532 int gpgme_key_append (gpgme_key_t dst, gpgme_key_t src, int idx);
533 void gpgme_key_ref( gpgme_key_t key );
534 void gpgme_key_unref( gpgme_key_t key );
535 void gpgme_key_release( gpgme_key_t key );
536 const char * gpgme_key_get_string_attr( gpgme_key_t key, gpgme_attr_t what,
537 void **reserved, int idx );
538 unsigned long gpgme_key_get_ulong_attr( gpgme_key_t key, gpgme_attr_t what,
539 void **reserved, int idx );
540
541 /* Key management functions */
542 gpgme_error_t gpgme_op_keylist_start( gpgme_ctx_t ctx,
543 const char *pattern, int secret_only );
544 gpgme_error_t gpgme_op_keylist_next( gpgme_ctx_t ctx, gpgme_key_t * r_key );
545
546 /* Convenience functions for normal usage */
547 gpgme_error_t gpgme_op_encrypt ( gpgme_ctx_t c, gpgme_recipients_t recp,
548 gpgme_data_t in, gpgme_data_t out );
549 gpgme_error_t gpgme_op_file_encrypt( gpgme_ctx_t ctx, gpgme_recipients_t rset,
550 const char * input, const char * output );
551 gpgme_error_t gpgme_op_files_encrypt( gpgme_ctx_t ctx, gpgme_recipients_t rset,
552 const char ** files, size_t nfiles );
553 gpgme_error_t gpgme_op_clip_encrypt( gpgme_recipients_t rset, int opts,
554 gpgme_ctx_t * r_ctx );
555
556 gpgme_error_t gpgme_op_list_keys( gpgme_data_t ciph, const char * file,
557 gpgme_recipients_t * r_rset );
558 gpgme_error_t gpgme_op_decrypt( gpgme_ctx_t ctx, gpgme_data_t ciph,
559 gpgme_data_t plain );
560 gpgme_error_t gpgme_op_file_decrypt( gpgme_ctx_t ctx, const char * ciph,
561 const char * plain );
562 gpgme_error_t gpgme_op_files_decrypt( gpgme_ctx_t ctx, const char ** files,
563 size_t nfiles );
564 gpgme_error_t gpgme_op_clip_decrypt( gpgme_ctx_t ctx );
565
566 gpgme_error_t gpgme_op_sign ( gpgme_ctx_t c, gpgme_data_t in, gpgme_data_t out,
567 gpgme_sigmode_t mode );
568 gpgme_error_t gpgme_op_clip_sign( gpgme_ctx_t ctx, gpgme_sigmode_t mode,
569 const char * keyid, int wraplen );
570 gpgme_error_t gpgme_op_file_sign( gpgme_ctx_t ctx, gpgme_sigmode_t mode,
571 const char *input, const char *output );
572 gpgme_error_t gpgme_op_files_sign( gpgme_ctx_t ctx, gpgme_sigmode_t mode,
573 const char ** files, size_t nfiles );
574
575 gpgme_error_t gpgme_op_verify ( gpgme_ctx_t c, gpgme_data_t sig,
576 gpgme_data_t text );
577 gpgme_error_t gpgme_op_file_verify( gpgme_ctx_t ctx, gpgme_sigmode_t sigmode,
578 gpgme_sig_t * r_sigctx,
579 const char * sigfile, const char * datfile );
580 gpgme_error_t gpgme_op_files_verify( gpgme_ctx_t ctx, const char ** files,
581 size_t nfiles, gpgme_sig_t * ret_sig );
582 gpgme_error_t gpgme_op_clip_verify( gpgme_keycache_t cache,
583 gpgme_sig_t * r_sigctx );
584 gpgme_error_t gpgme_op_clip_verify_detached( gpgme_keycache_t cache,
585 gpgme_sig_t * r_sigctx,
586 const char * data, size_t len );
587
588 gpgme_error_t gpgme_op_import( gpgme_ctx_t ctx, gpgme_recipients_t selkeys,
589 gpgme_data_t keydata );
590 gpgme_error_t gpgme_op_clip_import( int ctrl, gpgme_recipients_t selkeys,
591 int * import_res );
592 gpgme_error_t gpgme_op_file_import( gpgme_ctx_t ctx, gpgme_recipients_t selkeys,
593 const char *input );
594 gpgme_error_t gpgme_op_import_list( gpgme_ctx_t ctx, gpgme_data_t in,
595 gpgme_data_t out );
596 gpgme_error_t gpgme_op_import_list_next( gpgme_data_t out,
597 char **pending_line,
598 gpgme_key_t *r_key );
599
600 gpgme_error_t gpgme_op_export ( gpgme_ctx_t c, gpgme_recipients_t recp,
601 gpgme_data_t keydata );
602 gpgme_error_t gpgme_op_file_export( gpgme_ctx_t ctx, gpgme_recipients_t recp,
603 const char *output );
604 gpgme_error_t gpgme_op_clip_export( gpgme_recipients_t rset );
605
606 gpgme_error_t gpgme_op_genkey ( gpgme_ctx_t c, const char *parms,
607 gpgme_data_t pubkey, gpgme_data_t seckey );
608 gpgme_error_t gpgme_op_delete ( gpgme_ctx_t c, const gpgme_key_t key,
609 int allow_secret );
610
611 gpgme_error_t gpgme_op_symenc ( gpgme_ctx_t c, gpgme_data_t in,
612 gpgme_data_t out );
613 gpgme_error_t gpgme_op_clip_symenc( gpgme_ctx_t ctx );
614
615 gpgme_error_t gpgme_op_sign_encrypt( gpgme_ctx_t ctx, gpgme_recipients_t rset,
616 gpgme_data_t plain, gpgme_data_t ciph );
617 gpgme_error_t gpgme_op_clip_sign_encrypt( gpgme_ctx_t c, gpgme_recipients_t rset,
618 const char * keyid, int force_trust );
619 gpgme_error_t gpgme_op_file_sign_encrypt( gpgme_ctx_t ctx,
620 gpgme_recipients_t rset,
621 const char * input,
622 const char * output );
623 gpgme_error_t gpgme_op_files_sign_encrypt( gpgme_ctx_t ctx,
624 gpgme_recipients_t recp,
625 const char ** files, size_t nfiles );
626
627 /* miscellaneous functions */
628 const char *gpgme_strerror( gpgme_error_t err );
629
630 /* Extensions */
631 void gpgme_set_debug_mode( int val );
632 void gpgme_set_edit_ctx( gpgme_ctx_t c, void * edit_ctx, int edit_id );
633 void gpgme_set_cache_ctx( gpgme_ctx_t c, void * cache_ctx );
634
635 /* Signature API */
636 gpgme_error_t gpgme_sig_new( gpgme_sig_t * r_sig );
637 void gpgme_sig_release( gpgme_sig_t sig );
638 unsigned long gpgme_sig_get_ulong_attr( gpgme_sig_t sig, int idx, int what );
639 const char* gpgme_sig_get_string_attr( gpgme_sig_t sig, int what );
640 void gpgme_sig_set_key_ctx( gpgme_sig_t sig, gpgme_keycache_t cache );
641
642 /* Passphrase operations */
643 void gpgme_set_passphrase( gpgme_ctx_t c, const char * passphrase );
644
645 /* Data operations */
646 gpgme_error_t gpgme_data_new_from_clipboard (gpgme_data_t * r_dh);
647 void gpgme_data_release_and_set_clipboard (gpgme_data_t dh);
648 gpgme_error_t gpgme_data_change_version( gpgme_data_t *r_dh );
649 size_t gpgme_data_readline( gpgme_data_t dh, char *line, size_t nbytes );
650 int gpgme_data_wrap_lines( gpgme_data_t *r_dh, size_t wraplen );
651 gpgme_error_t gpgme_data_release_and_set_file( gpgme_data_t dh, const char *fname );
652 char* gpgme_data_release_and_return_string( gpgme_data_t dh );
653 char* gpgme_data_get_as_string (gpgme_data_t dh);
654 gpgme_error_t gpgme_data_extract_plaintext (gpgme_data_t sig, gpgme_data_t *r_plain);
655 gpgme_error_t gpgme_data_mail_quote (gpgme_data_t *r_dh);
656
657 /* Key edit operations */
658 gpgme_error_t gpgme_op_delete_key( const char *keyid, int allow_secret );
659 gpgme_error_t gpgme_op_delete_keys( gpgme_recipients_t rset, int allow_secret );
660
661 /* Key caching */
662 gpgme_error_t gpgme_keycache_new (gpgme_keycache_t * r_ctx);
663 void gpgme_keycache_release (gpgme_keycache_t ctx);
664 void gpgme_keycache_set_cb (gpgme_keycache_t ctx,
665 void (*cb)(void *, const char *, int, unsigned, unsigned),
666 void * cb_value1, int cb_value2);
667 int gpgme_keycache_add_key (gpgme_keycache_t ctx, gpgme_key_t key);
668 gpgme_error_t gpgme_keycache_find_key (gpgme_keycache_t ctx, const char * pattern,
669 int flags, gpgme_key_t * r_key);
670 gpgme_error_t gpgme_keycache_delete_key (gpgme_keycache_t ctx,
671 const char * pattern);
672 gpgme_error_t gpgme_keycache_init (gpgme_keycache_t ctx, const char * pattern,
673 int secret);
674 gpgme_error_t gpgme_keycache_next_key (gpgme_keycache_t ctx, int flags,
675 gpgme_key_t * r_key);
676 void gpgme_keycache_rewind( gpgme_keycache_t ctx );
677 int gpgme_keycache_count( gpgme_keycache_t ctx );
678 gpgme_error_t gpgme_keycache_prepare( gpgme_keycache_t ctx,
679 const char *pubring, const char * secring );
680 gpgme_error_t gpgme_keycache_sync (gpgme_keycache_t pub, gpgme_keycache_t sec);
681 int gpgme_getkey_bykeyid( void *fd_handle, const char * keyid, gpgme_key_t *r_key );
682
683
684 /* Ownertrust */
685 gpgme_error_t gpgme_op_key_trust_import( gpgme_ctx_t c, gpgme_data_t in );
686 gpgme_error_t gpgme_op_key_trust_export( gpgme_ctx_t c, gpgme_data_t out );
687 gpgme_error_t gpgme_op_ownertrust_export_file( const char *output );
688 gpgme_error_t gpgme_op_ownertrust_import_file( const char *input );
689
690 gpgme_error_t gpgme_op_rebuild_cache( void );
691
692 /* Import parser */
693
694 void gpgme_implist_create_revcert( gpgme_key_t *r_key, gpgme_revcert_t cert, gpgme_key_t pubk );
695
696
697 /* Key generation */
698 char * gpgme_genkey_params( int keytype, int bits,
699 const char *user, const char *comment,const char *email,
700 const char *expdate, const char *passphrase );
701 gpgme_error_t gpgme_op_genkey_auto( const char *params, gpgme_progress_cb_t prog_cb,
702 char **fpr );
703
704 /* Key attributes */
705 const char * gpgme_key_expand_attr( int what, unsigned long attr );
706
707 /* Key edit */
708 gpgme_error_t gpgme_uid_info_new( gpgme_uidinfo_t * r_inf );
709 void gpgme_uid_info_release( gpgme_uidinfo_t inf );
710 gpgme_error_t gpgme_op_editkey_get_info( gpgme_ctx_t ctx, const char * keyid,
711 gpgme_uidinfo_t * r_inf );
712 unsigned long gpgme_editkey_get_ulong_attr( gpgme_uidinfo_t inf, int what, int idx );
713 const char * gpgme_editkey_get_string_attr( gpgme_uidinfo_t inf, int what, int idx );
714 int gpgme_editkey_count_items( gpgme_uidinfo_t inf );
715 gpgme_error_t gpgme_op_editkey( gpgme_ctx_t ctx, const char *keyid );
716
717 /* Card edit */
718 gpgme_error_t gpgme_editcard_new( gpgme_editcard_t * r_ctx );
719 void gpgme_editcard_release( gpgme_editcard_t ctx );
720 gpgme_error_t gpgme_editcard_control( gpgme_editcard_t ctx, int cmd,
721 const void * val );
722 gpgme_error_t gpgme_editcard_set_passwd (gpgme_editcard_t ctx, const char * passwd);
723 gpgme_error_t gpgme_editcard_set_keygen_params( gpgme_editcard_t ctx, int flags,
724 const char * name, const char * email,
725 const char * comment, const char * expdate );
726 void gpgme_editcard_set_callback( gpgme_editcard_t ctx,
727 const char *(*cb)( int code, void * opaque ),
728 void * cb_value );
729
730 gpgme_error_t gpgme_op_changepin( gpgme_ctx_t ctx );
731 gpgme_error_t gpgme_changepin_set( gpgme_editcard_t chpin, int which,
732 const char * pinold, const char * pinnew );
733
734 gpgme_error_t gpgme_op_editcard( gpgme_ctx_t ctx );
735 gpgme_error_t gpgme_op_statuscard( gpgme_ctx_t ctx, gpgme_card_t * ret_card );
736
737 gpgme_error_t gpgme_card_new( gpgme_card_t * ret_card );
738 void gpgme_card_release( gpgme_card_t card );
739 const char * gpgme_card_get_string_attr( gpgme_card_t card, gpgme_attr_t what,
740 void ** reserved, int idx );
741 unsigned long gpgme_card_get_ulong_attr( gpgme_card_t card, gpgme_attr_t what,
742 void ** reserved, int idx );
743
744 /* Key revocation */
745 gpgme_error_t gpgme_revcert_new( gpgme_revcert_t *r_cert );
746 void gpgme_revcert_release( gpgme_revcert_t cert );
747 gpgme_error_t gpgme_revcert_parse( const char *data, gpgme_revcert_t cert, char * keyid );
748 gpgme_error_t gpgme_revoke_set( gpgme_editkey_t ctx, const char *uid,
749 const char *text, int reason, int pgpmode,
750 const char *pass );
751 gpgme_error_t gpgme_op_revoke( gpgme_ctx_t c, gpgme_editkey_t rev, gpgme_data_t cert );
752
753 /* Misc - version */
754 gpgme_error_t gpgme_op_version( char **info );
755 void gpgme_set_gettext_handler( char *(*gettext)( const char *id ) );
756
757 /* Misc */
758 void gpgme_set_pgm_string( const char *name );
759 int gpgme_key_count_items( gpgme_key_t key, int what );
760 int gpgme_key_get_cability( gpgme_key_t key, int attr, int keyidx );
761 int gpgme_key_cability_from_algo( gpgme_pk_cipher_t algo );
762 gpgme_error_t gpgme_get_import_status( gpgme_ctx_t ctx, int * import_res,
763 gpgme_recipients_t * r_keys );
764 void gpgme_decrypt_get_status( gpgme_ctx_t ctx, char * keyid,
765 gpgme_op_flags_t *r_flags );
766 void gpgme_decrypt_get_sig_ctx( gpgme_ctx_t ctx, gpgme_sig_t *r_sig );
767
768 /* Edit key interface */
769 gpgme_error_t gpgme_editkey_new( gpgme_editkey_t *ctx );
770 void gpgme_editkey_release( gpgme_editkey_t ctx );
771 void gpgme_editkey_make_invalid( gpgme_editkey_t ctx );
772 int gpgme_editkey_is_valid( gpgme_editkey_t ctx );
773 int gpgme_editkey_is_secret( gpgme_editkey_t ctx, int val );
774
775
776 void gpgme_editkey_trust_set( gpgme_editkey_t ctx, int val );
777 void gpgme_editkey_delsig_set (gpgme_editkey_t ctx, int uid, int signo);
778 gpgme_error_t gpgme_editkey_sign_set (gpgme_editkey_t ctx,
779 const char * passwd,
780 int sigclass,
781 int sigtype,
782 const char * param);
783 void gpgme_editkey_primary_set( gpgme_editkey_t ctx, int id, const char *passwd );
784 void gpgme_editkey_adduid_set( gpgme_editkey_t ctx, const char *name,
785 const char *email, const char *comment,
786 const char *passwd );
787 void gpgme_editkey_deluid_set_id( gpgme_editkey_t ctx, int id );
788 void gpgme_editkey_delkey_set_id( gpgme_editkey_t ctx, int id );
789 gpgme_error_t gpgme_editkey_addkey_set (gpgme_editkey_t ctx,
790 const char * passwd,
791 int algo, int size, int valid);
792 void gpgme_editkey_passwd_set( gpgme_editkey_t ctx,
793 const char * old_pwd, const char * new_pwd,
794 int allow_empty );
795 void gpgme_editkey_expire_set( gpgme_editkey_t ctx, int id, int days,
796 const char *date, const char *passwd );
797 void gpgme_editkey_revsig_set( gpgme_editkey_t ctx, int id, const char *passwd );
798 void gpgme_editkey_revkey_set( gpgme_editkey_t ctx, int id, int reason,
799 const char * passwd );
800 void gpgme_editkey_setpref_set (gpgme_editkey_t ctx, const char * new_prefs,
801 int uid_idx, const char * passwd);
802 gpgme_error_t gpgme_editkey_addrev_set (gpgme_editkey_t ctx, const char * userid,
803 const char * passwd);
804 void gpgme_editkey_addphoto_set( gpgme_editkey_t ctx, const char *jpegfile,
805 const char * passwd );
806 void gpgme_editkey_enable_set( gpgme_editkey_t ctx );
807 void gpgme_editkey_disable_set( gpgme_editkey_t ctx );
808
809
810 /* Clipboard interface */
811 gpgme_error_t gpgme_clip_istext_avail( int *r_rc );
812 gpgme_error_t gpgme_clip_is_secured( gpgme_cliptype_t *r_type, int *r_rc );
813 gpgme_error_t gpgme_clip_get_pgptype( gpgme_cliptype_t *r_type );
814 gpgme_error_t gpgme_clip_parse_pgpid( const char *data, gpgme_cliptype_t *r_type );
815 gpgme_error_t gpgme_clip_do_check( int *r_rc );
816
817 #ifdef __cplusplus
818 }
819 #endif
820 #endif /* GPGME_H */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26