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

Annotation of /trunk/MyGPGME/gpgme.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Mon Jan 31 11:02:21 2005 UTC (20 years, 1 month ago) by twoaday
File MIME type: text/plain
File size: 30932 byte(s)
WinPT initial checkin.


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26