/[winpt]/trunk/w32gpgme/w32gpgme.h
ViewVC logotype

Contents of /trunk/w32gpgme/w32gpgme.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 24 - (show annotations)
Sat Oct 8 10:43:08 2005 UTC (19 years, 4 months ago) by twoaday
File MIME type: text/plain
File size: 5319 byte(s)
Bug fixes to correct some problems introduced by
the MyGPGME to GPGME port.

1 /* w32gpgme.h - W32 specific utility code for GPGME.
2 * Copyright (C) 2005 Timo Schulz
3 *
4 * This file is part of WinPT.
5 *
6 * WinPT is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * WinPT is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with WinPT; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 */
20
21 #ifndef W32_GPGME_H
22 #define W32_GPGME_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include "c:/oss/w32root/include/gpgme.h"
29
30
31
32 struct keycache_s {
33 struct keycache_s * next;
34 int flags;
35 gpgme_key_t key;
36 struct keycache_s *pubpart;
37 struct {
38 unsigned int is_protected:1;
39 unsigned int divert_to_card:1;
40 unsigned int has_desig_rev:1;
41 } gloflags;
42 struct {
43 unsigned int used:1;
44 unsigned char *d;
45 unsigned int len;
46 } attrib;
47 unsigned char *sym_prefs;
48 };
49
50 struct gpgme_keycache_s {
51 struct keycache_s *item;
52 struct keycache_s *tmp;
53 int secret;
54 int pos;
55 void (*cb) (void *, const char *, int, int, int);
56 void *cb_value;
57 int cb_value2;
58 };
59 typedef struct gpgme_keycache_s *gpgme_keycache_t;
60
61 typedef enum {
62 PGP_MESSAGE = 1,
63 PGP_CLEARSIG = 2,
64 PGP_SIG = 4,
65 PGP_PUBKEY = 8,
66 PGP_SECKEY = 16,
67 PGP_DASH_ESCAPED = 32 /* actually not a type, just a flag */
68 } gpgme_pgptype_t;
69
70
71 gpgme_error_t gpg_data_new_from_clipboard (gpgme_data_t *r_dh, int wraplen);
72 void gpg_data_release_and_set_clipboard (gpgme_data_t dh, int chg_ver);
73 size_t gpg_data_readline (gpgme_data_t dh, char *line, size_t nbytes);
74
75 gpgme_error_t gpg_data_release_and_set_file (gpgme_data_t dh, const char *fname);
76 gpgme_error_t gpg_data_mail_quote (gpgme_data_t *r_dh);
77 gpgme_error_t gpg_data_extract_plaintext (gpgme_data_t sig, gpgme_data_t *r_plain);
78
79 /* Key caching */
80 gpgme_error_t gpgme_keycache_new (gpgme_keycache_t * r_ctx);
81 void gpgme_keycache_release (gpgme_keycache_t ctx);
82 void gpgme_keycache_set_cb (gpgme_keycache_t ctx,
83 void (*cb)(void *, const char *, int, int, int),
84 void * cb_value1, int cb_value2);
85 gpgme_error_t gpgme_keycache_add_key (gpgme_keycache_t ctx, gpgme_key_t key,
86 void **opaque);
87 gpgme_error_t gpgme_keycache_update_key (gpgme_keycache_t ctx, int is_sec,
88 void *opaque, const char *keyid);
89 gpgme_error_t gpgme_keycache_find_key (gpgme_keycache_t ctx, const char * pattern,
90 int flags, gpgme_key_t * r_key);
91 gpgme_error_t gpgme_keycache_find_key2 (gpgme_keycache_t ctx, const char *pattern, int flags,
92 gpgme_key_t *r_key, struct keycache_s **r_item);
93 gpgme_error_t gpgme_keycache_delete_key (gpgme_keycache_t ctx,
94 const char * pattern);
95 gpgme_error_t gpgme_keycache_init (gpgme_keycache_t ctx, const char * pattern,
96 int secret);
97 gpgme_error_t gpgme_keycache_next_key (gpgme_keycache_t ctx, int flags,
98 gpgme_key_t * r_key);
99 void gpgme_keycache_rewind( gpgme_keycache_t ctx );
100 int gpgme_keycache_count( gpgme_keycache_t ctx );
101 gpgme_error_t gpgme_keycache_prepare (gpgme_keycache_t ctx,
102 const char *pubring, const char * secring);
103 gpgme_error_t gpgme_keycache_prepare_single (gpgme_keycache_t ctx,
104 const char *keyid,
105 const char *pubr,
106 const char *secr);
107 gpgme_error_t gpgme_keycache_sync (gpgme_keycache_t pub, gpgme_keycache_t sec);
108 int gpgme_getkey_bykeyid (void *fd_handle, const char * keyid, gpgme_key_t *r_key);
109
110 /* XXX */
111 gpgme_error_t
112 _gpgme_keycache_find_key2 (gpgme_keycache_t ctx, const char *pattern, int flags,
113 gpgme_key_t *r_key, struct keycache_s **r_item);
114
115 /* Clipboard interface */
116 gpgme_error_t gpgme_clip_istext_avail (int *r_rc);
117 gpgme_error_t gpgme_clip_is_secured (gpgme_pgptype_t *r_type, int *r_rc);
118 gpgme_error_t gpgme_clip_get_pgptype (gpgme_pgptype_t *r_type);
119 gpgme_error_t gpgme_clip_parse_pgpid (const char *data, gpgme_pgptype_t *r_type);
120 gpgme_error_t gpgme_clip_do_check (int *r_rc);
121
122 /*-- util.c --*/
123 gpgme_error_t gpg_rebuild_cache (char **r_inf);
124 gpgme_error_t gpg_get_version (char **r_inf);
125 void gpg_set_debug_mode (int val);
126 gpgme_error_t gpg_export_seckey (const char *keyid, const char *outfile);
127 gpgme_error_t gpg_manage_ownertrust (char **data, int export);
128
129 char* generate_revoc_input (int code, const char *cmt, const char *pass);
130 gpgme_error_t gpg_revoke_key (const char *inp_data,
131 const char *keyid,
132 char **r_revcert);
133 gpgme_error_t gpg_decode_c_string (const char *src, char **destp, size_t len);
134 gpgme_error_t gpg_import_key_list (const char *fname, char **r_out);
135
136 #ifdef __cplusplus
137 }
138 #endif
139
140 /* helpers */
141 char* strsep (char **stringp, const char *delim);
142 const char *stristr (const char *buf, const char *sub);
143
144 #endif /*W32_GPGME_H*/

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26