1 |
twoaday |
23 |
/* 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 |
twoaday |
24 |
#ifdef __cplusplus |
25 |
|
|
extern "C" { |
26 |
|
|
#endif |
27 |
|
|
|
28 |
twoaday |
23 |
#include "c:/oss/w32root/include/gpgme.h" |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
struct keycache_s { |
33 |
|
|
struct keycache_s * next; |
34 |
|
|
int flags; |
35 |
twoaday |
26 |
gpgme_key_t key; /* actual key context. */ |
36 |
|
|
struct keycache_s *pubpart; /* corresponding public key. */ |
37 |
twoaday |
23 |
struct { |
38 |
twoaday |
26 |
unsigned int is_protected:1; /* key is protected. */ |
39 |
|
|
unsigned int divert_to_card:1; /* secret key on card. */ |
40 |
|
|
unsigned int has_desig_rev:1; /* has desig. revokers. */ |
41 |
twoaday |
23 |
} gloflags; |
42 |
|
|
struct { |
43 |
|
|
unsigned int used:1; |
44 |
twoaday |
26 |
unsigned char *d; /* attribute (JPG) data. */ |
45 |
|
|
unsigned int len; /* attribute data length. */ |
46 |
twoaday |
23 |
} attrib; |
47 |
twoaday |
26 |
unsigned char *sym_prefs;/* symmetric cipher preferences. */ |
48 |
|
|
char *card_type; /* if != NULL key stored on smart card. */ |
49 |
twoaday |
23 |
}; |
50 |
|
|
|
51 |
|
|
struct gpgme_keycache_s { |
52 |
|
|
struct keycache_s *item; |
53 |
|
|
struct keycache_s *tmp; |
54 |
|
|
int secret; |
55 |
|
|
int pos; |
56 |
|
|
void (*cb) (void *, const char *, int, int, int); |
57 |
|
|
void *cb_value; |
58 |
|
|
int cb_value2; |
59 |
|
|
}; |
60 |
|
|
typedef struct gpgme_keycache_s *gpgme_keycache_t; |
61 |
twoaday |
25 |
typedef struct gpgme_keycache_s *gpg_keycache_t; |
62 |
twoaday |
23 |
|
63 |
|
|
typedef enum { |
64 |
|
|
PGP_MESSAGE = 1, |
65 |
|
|
PGP_CLEARSIG = 2, |
66 |
|
|
PGP_SIG = 4, |
67 |
|
|
PGP_PUBKEY = 8, |
68 |
|
|
PGP_SECKEY = 16, |
69 |
|
|
PGP_DASH_ESCAPED = 32 /* actually not a type, just a flag */ |
70 |
twoaday |
25 |
} gpg_pgptype_t; |
71 |
twoaday |
23 |
|
72 |
|
|
|
73 |
|
|
gpgme_error_t gpg_data_new_from_clipboard (gpgme_data_t *r_dh, int wraplen); |
74 |
|
|
void gpg_data_release_and_set_clipboard (gpgme_data_t dh, int chg_ver); |
75 |
|
|
size_t gpg_data_readline (gpgme_data_t dh, char *line, size_t nbytes); |
76 |
|
|
|
77 |
|
|
gpgme_error_t gpg_data_release_and_set_file (gpgme_data_t dh, const char *fname); |
78 |
|
|
gpgme_error_t gpg_data_mail_quote (gpgme_data_t *r_dh); |
79 |
|
|
gpgme_error_t gpg_data_extract_plaintext (gpgme_data_t sig, gpgme_data_t *r_plain); |
80 |
|
|
|
81 |
|
|
/* Key caching */ |
82 |
twoaday |
25 |
gpgme_error_t gpg_keycache_new (gpgme_keycache_t * r_ctx); |
83 |
|
|
void gpg_keycache_release (gpgme_keycache_t ctx); |
84 |
|
|
void gpg_keycache_set_cb (gpgme_keycache_t ctx, |
85 |
twoaday |
23 |
void (*cb)(void *, const char *, int, int, int), |
86 |
|
|
void * cb_value1, int cb_value2); |
87 |
twoaday |
25 |
void gpg_keycache_rewind (gpgme_keycache_t ctx); |
88 |
|
|
int gpg_keycache_get_size (gpgme_keycache_t ctx); |
89 |
|
|
gpgme_error_t gpg_keycache_add_key (gpgme_keycache_t ctx, gpgme_key_t key, |
90 |
twoaday |
23 |
void **opaque); |
91 |
twoaday |
25 |
gpgme_error_t gpg_keycache_update_key (gpgme_keycache_t ctx, int is_sec, |
92 |
twoaday |
23 |
void *opaque, const char *keyid); |
93 |
twoaday |
25 |
gpgme_error_t gpg_keycache_find_key (gpgme_keycache_t ctx, const char * pattern, |
94 |
twoaday |
23 |
int flags, gpgme_key_t * r_key); |
95 |
twoaday |
25 |
gpgme_error_t gpg_keycache_find_key2 (gpgme_keycache_t ctx, const char *pattern, int flags, |
96 |
twoaday |
23 |
gpgme_key_t *r_key, struct keycache_s **r_item); |
97 |
twoaday |
25 |
gpgme_error_t gpg_keycache_delete_key (gpgme_keycache_t ctx, |
98 |
twoaday |
23 |
const char * pattern); |
99 |
twoaday |
25 |
gpgme_error_t gpg_keycache_init (gpgme_keycache_t ctx, const char * pattern, |
100 |
twoaday |
23 |
int secret); |
101 |
twoaday |
25 |
gpgme_error_t gpg_keycache_next_key (gpgme_keycache_t ctx, int flags, |
102 |
twoaday |
23 |
gpgme_key_t * r_key); |
103 |
twoaday |
25 |
gpgme_error_t gpg_keycache_prepare (gpgme_keycache_t ctx, |
104 |
twoaday |
23 |
const char *pubring, const char * secring); |
105 |
twoaday |
25 |
gpgme_error_t gpg_keycache_prepare_single (gpgme_keycache_t ctx, |
106 |
twoaday |
23 |
const char *keyid, |
107 |
|
|
const char *pubr, |
108 |
|
|
const char *secr); |
109 |
twoaday |
25 |
gpgme_error_t gpg_keycache_sync (gpgme_keycache_t pub, gpgme_keycache_t sec); |
110 |
twoaday |
23 |
|
111 |
|
|
/* XXX */ |
112 |
|
|
gpgme_error_t |
113 |
twoaday |
25 |
_gpg_keycache_find_key2 (gpgme_keycache_t ctx, const char *pattern, int flags, |
114 |
twoaday |
23 |
gpgme_key_t *r_key, struct keycache_s **r_item); |
115 |
|
|
|
116 |
|
|
/* Clipboard interface */ |
117 |
twoaday |
25 |
gpgme_error_t gpg_clip_istext_avail (int *r_rc); |
118 |
|
|
gpgme_error_t gpg_clip_is_secured (gpg_pgptype_t *r_type, int *r_rc); |
119 |
|
|
gpgme_error_t gpg_clip_get_pgptype (gpg_pgptype_t *r_type); |
120 |
|
|
gpgme_error_t gpg_clip_parse_pgpid (const char *data, gpg_pgptype_t *r_type); |
121 |
|
|
gpgme_error_t gpg_clip_do_check (int *r_rc); |
122 |
twoaday |
23 |
|
123 |
twoaday |
24 |
#ifdef __cplusplus |
124 |
|
|
} |
125 |
|
|
#endif |
126 |
|
|
|
127 |
twoaday |
23 |
/* helpers */ |
128 |
|
|
char* strsep (char **stringp, const char *delim); |
129 |
|
|
const char *stristr (const char *buf, const char *sub); |
130 |
|
|
|
131 |
|
|
#endif /*W32_GPGME_H*/ |