183 |
|
|
184 |
|
|
185 |
static char * |
static char * |
186 |
default_key_from_cache (int * ret_no_useable) |
default_key_from_cache (int *ret_no_useable) |
187 |
{ |
{ |
188 |
const char * s; |
const char * s; |
189 |
char * keyid = NULL; |
char * keyid = NULL; |
190 |
gpgme_key_t key; |
gpgme_key_t key; |
191 |
gpgme_keycache_t sec = keycache_get_ctx (0); |
gpg_keycache_t sec = keycache_get_ctx (0); |
192 |
|
|
193 |
if (!sec) |
if (!sec) |
194 |
BUG (0); |
BUG (0); |
195 |
gpgme_keycache_rewind (sec); |
gpg_keycache_rewind (sec); |
196 |
while (!gpgme_keycache_next_key (sec, 1, &key)) { |
while (!gpg_keycache_next_key (sec, 1, &key)) { |
197 |
if (key_is_useable (key)) { |
if (key_is_useable (key)) { |
198 |
s = key->subkeys->keyid; |
s = key->subkeys->keyid; |
199 |
if (s) |
if (s) |
246 |
return keyid; |
return keyid; |
247 |
} /* get_gnupg_default_key */ |
} /* get_gnupg_default_key */ |
248 |
|
|
249 |
/* |
|
250 |
* Check if the gpg application (exe file) is available. |
/* Check if the gpg application (exe file) is available. */ |
|
*/ |
|
251 |
int |
int |
252 |
check_gnupg_prog( void ) |
check_gnupg_prog (void) |
253 |
{ |
{ |
254 |
char *pgm = NULL; |
char *pgm = NULL; |
255 |
int rc = 0; |
int rc = 0; |
256 |
|
|
257 |
pgm = get_gnupg_prog( ); |
pgm = get_gnupg_prog (); |
258 |
if( pgm == NULL ) |
if (!pgm) |
259 |
rc = WPTERR_GPG_EXEFILE; |
rc = WPTERR_GPG_EXEFILE; |
260 |
if( file_exist_check( pgm ) ) |
if (file_exist_check (pgm)) |
261 |
rc = WPTERR_GPG_EXEFILE; |
rc = WPTERR_GPG_EXEFILE; |
262 |
free_if_alloc( pgm ); |
free_if_alloc (pgm); |
263 |
return rc; |
return rc; |
264 |
} /* check_gpg_prog */ |
} |
265 |
|
|
266 |
|
|
267 |
static int |
static int |
289 |
} |
} |
290 |
|
|
291 |
|
|
292 |
|
/* Check if the gnupg engine fullfills the minimum requirement |
293 |
|
version given in @r_major.@r_minor.@r_patch. On success these |
294 |
|
variables contain the GPG version which is installed. */ |
295 |
int |
int |
296 |
check_gnupg_engine (int * r_major, int * r_minor, int * r_patch) |
check_gnupg_engine (int *r_major, int *r_minor, int *r_patch) |
297 |
{ |
{ |
298 |
gpgme_ctx_t ctx; |
gpgme_ctx_t ctx; |
299 |
gpgme_engine_info_t inf; |
gpgme_engine_info_t inf; |
329 |
*r_minor = minor; |
*r_minor = minor; |
330 |
*r_patch = patch; |
*r_patch = patch; |
331 |
return rc; |
return rc; |
332 |
} /* check_gnupg_engine */ |
} |
333 |
|
|
334 |
|
|
335 |
int |
int |