21 |
#include <windows.h> |
#include <windows.h> |
22 |
#include <commctrl.h> |
#include <commctrl.h> |
23 |
#include <stdio.h> |
#include <stdio.h> |
|
#include <io.h> |
|
24 |
|
|
25 |
|
#include "gpgme.h" |
26 |
#include "../resource.h" |
#include "../resource.h" |
|
#include "w32gpgme.h" |
|
27 |
#include "wptTypes.h" |
#include "wptTypes.h" |
28 |
#include "wptW32API.h" |
#include "wptW32API.h" |
29 |
#include "wptVersion.h" |
#include "wptVersion.h" |
43 |
#include "wptImport.h" |
#include "wptImport.h" |
44 |
|
|
45 |
|
|
46 |
/* Return a user friendly key representation in @buf from |
/* Return a user friendly key representation in @buf of |
47 |
the key given by @keyid. */ |
the key given by @keyid. */ |
48 |
static void |
static void |
49 |
key_get_clip_info (const char *keyid, char *buf, size_t buflen) |
key_get_clip_info (const char *keyid, char *buf, size_t buflen) |
51 |
gpgme_key_t pk; |
gpgme_key_t pk; |
52 |
|
|
53 |
if (get_pubkey (keyid, &pk)) |
if (get_pubkey (keyid, &pk)) |
54 |
BUG (0); |
BUG (NULL); |
55 |
_snprintf (buf, buflen-1, |
_snprintf (buf, buflen-1, |
56 |
"pub %04d%s/%s %s %s\r\n" |
"pub %04d%s/%s %s %s\r\n" |
57 |
" Primary key fingerprint: %s\r\n", |
" Primary key fingerprint: %s\r\n", |
64 |
} |
} |
65 |
|
|
66 |
|
|
67 |
|
#if 0 |
68 |
/* Quoted the user-id given by @uid. If @uid is already |
/* Quoted the user-id given by @uid. If @uid is already |
69 |
quoted @uid is returned without any modifications. |
quoted @uid is returned without any modifications. |
70 |
Return value: quoted @uid. */ |
Return value: quoted @uid. */ |
81 |
_snprintf (q, strlen (uid) + 3, "\"%s\"", uid); |
_snprintf (q, strlen (uid) + 3, "\"%s\"", uid); |
82 |
return q; |
return q; |
83 |
} |
} |
84 |
|
#endif |
85 |
|
|
86 |
|
|
87 |
|
/* Check if list view @lv contains a secret key at position @pos. |
88 |
|
If utrust is valid, set it to 1 if the key is valid -1 otherwise. |
89 |
|
Return value: 1 normal key, 2 smart card key. */ |
90 |
int |
int |
91 |
km_check_for_seckey (listview_ctrl_t lv, int pos, int *utrust) |
km_check_for_seckey (listview_ctrl_t lv, int pos, int *utrust) |
92 |
{ |
{ |
106 |
else if (stristr (t, "Ultimate") && utrust) |
else if (stristr (t, "Ultimate") && utrust) |
107 |
*utrust = 1; |
*utrust = 1; |
108 |
return type; |
return type; |
109 |
} /* km_check_for_seckey */ |
} |
110 |
|
|
111 |
|
|
112 |
|
/* Check if the key at position @pos is protected with a passwd. */ |
113 |
int |
int |
114 |
km_check_if_protected (listview_ctrl_t lv, int pos) |
km_check_if_protected (listview_ctrl_t lv, int pos) |
115 |
{ |
{ |
121 |
return 1; /* assume yes */ |
return 1; /* assume yes */ |
122 |
winpt_get_pubkey (key->subkeys->keyid, &k); |
winpt_get_pubkey (key->subkeys->keyid, &k); |
123 |
return k.is_protected; |
return k.is_protected; |
124 |
} /* km_check_if_protected */ |
} |
125 |
|
|
126 |
|
|
127 |
int |
int |
181 |
if (!ke) |
if (!ke) |
182 |
BUG (NULL); |
BUG (NULL); |
183 |
|
|
184 |
if (enable) |
err = enable? ke->enable () : ke->disable (); |
|
err = ke->enable (); |
|
|
else |
|
|
err = ke->disable (); |
|
185 |
if (!err) { |
if (!err) { |
186 |
show_msg (dlg, 1500, _("Key status changed.")); |
show_msg (dlg, 1500, _("Key status changed.")); |
187 |
keycache_set_reload (1); /* XXX: set update flag */ |
keycache_set_reload (1); /* XXX: set update flag */ |
188 |
} |
} |
189 |
else |
else |
190 |
msg_box (dlg, gpgme_strerror( err ), _("Key Manager"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
191 |
delete ke; |
delete ke; |
192 |
return err? WPTERR_GENERAL : 0; |
return err? WPTERR_GENERAL : 0; |
193 |
} |
} |
197 |
/* Create a string that contain all keyids from |
/* Create a string that contain all keyids from |
198 |
the key list @rset separated by a space. */ |
the key list @rset separated by a space. */ |
199 |
char* |
char* |
200 |
gpg_keylist_to_pattern (gpgme_key_t *rset) |
gpg_keylist_to_pattern (gpgme_key_t *rset, int n) |
201 |
{ |
{ |
|
int i, n=0; |
|
202 |
char *p; |
char *p; |
203 |
|
int i; |
204 |
|
|
|
for (i=0; rset[i] != NULL; i++) |
|
|
n++; |
|
205 |
if (!n) |
if (!n) |
206 |
return NULL; |
return NULL; |
207 |
p = (char *)calloc (1, n*(16+1)+n+2); |
p = (char *)calloc (1, n*(16+1)+n+2); |
208 |
if (!p) |
if (!p) |
209 |
return NULL; |
BUG (NULL); |
210 |
for (i=0; rset[i] != NULL; i++) { |
for (i=0; i < n; i++) { |
211 |
strcat (p, rset[i]->subkeys->keyid); |
strcat (p, rset[i]->subkeys->keyid); |
212 |
strcat (p, " "); |
strcat (p, " "); |
213 |
} |
} |
217 |
|
|
218 |
/* Export the keys given in @rset to the clipboard. |
/* Export the keys given in @rset to the clipboard. |
219 |
Return value: 0 on success. */ |
Return value: 0 on success. */ |
220 |
gpgme_error_t |
static gpgme_error_t |
221 |
gpg_clip_export (gpgme_key_t *rset) |
gpg_clip_export (gpgme_key_t *rset, int n) |
222 |
{ |
{ |
223 |
gpgme_error_t err = 0; |
gpgme_error_t err = 0; |
224 |
gpgme_ctx_t ctx = NULL; |
gpgme_ctx_t ctx = NULL; |
233 |
if (err) |
if (err) |
234 |
goto leave; |
goto leave; |
235 |
|
|
236 |
patt = gpg_keylist_to_pattern (rset); |
patt = gpg_keylist_to_pattern (rset, n); |
237 |
if (!patt) { |
if (!patt) { |
238 |
err = gpg_error (GPG_ERR_ENOMEM); |
err = gpg_error (GPG_ERR_ENOMEM); |
239 |
goto leave; |
goto leave; |
259 |
{ |
{ |
260 |
gpgme_error_t err; |
gpgme_error_t err; |
261 |
gpgme_key_t *rset; |
gpgme_key_t *rset; |
262 |
int rc, id = 0, n = 0; |
char buf[256]; |
263 |
|
int n=0; |
264 |
|
int rc=0; |
265 |
|
|
266 |
rset = keylist_enum_recipients (lv, KEYLIST_LIST, &n); |
rset = keylist_enum_recipients (lv, KEYLIST_LIST, &n); |
267 |
if (!n) { |
if (!n) { |
270 |
goto leave; |
goto leave; |
271 |
} |
} |
272 |
|
|
273 |
err = gpg_clip_export (rset); |
err = gpg_clip_export (rset, n); |
274 |
if (err) { |
if (err) { |
275 |
msg_box( dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
msg_box( dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
276 |
rc = WPTERR_GENERAL; |
rc = WPTERR_GENERAL; |
277 |
goto leave; |
goto leave; |
278 |
} |
} |
279 |
if (n == 1) { |
if (n == 1) { |
280 |
char buf[256]; |
key_get_clip_info (rset[0]->subkeys->keyid, buf, sizeof (buf)-1); |
|
key_get_clip_info (rset[0]->subkeys->keyid, buf, 255); |
|
281 |
set_clip_text2 (NULL, buf, strlen (buf), 0); |
set_clip_text2 (NULL, buf, strlen (buf), 0); |
282 |
} |
} |
283 |
|
|
300 |
|
|
301 |
rset = keylist_enum_recipients (lv, KEYLIST_LIST, &n); |
rset = keylist_enum_recipients (lv, KEYLIST_LIST, &n); |
302 |
if (!n) { |
if (!n) { |
303 |
msg_box( dlg, _("No key was selected for export."), _("Key Manager"), MB_ERR ); |
msg_box (dlg, _("No key was selected for export."), |
304 |
|
_("Key Manager"), MB_ERR); |
305 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
306 |
} |
} |
307 |
if (n > 1) { |
if (n > 1) { |
308 |
msg_box (dlg, _("Only one secret key can be exported."), _("Key Manager"), MB_ERR); |
msg_box (dlg, _("Only one secret key can be exported."), |
309 |
|
_("Key Manager"), MB_ERR); |
310 |
free (rset); |
free (rset); |
311 |
return 0; /* we checked this before, so we just quit */ |
return 0; /* we checked this before, so we just quit */ |
312 |
} |
} |
315 |
if (err) |
if (err) |
316 |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
317 |
else |
else |
318 |
log_box (_("Key Manager"), MB_OK, |
log_box (_("Key Manager"), MB_OK, |
319 |
_("Secret key successfully saved in '%s'."), fname); |
_("Secret key successfully saved in '%s'."), fname); |
320 |
|
|
|
|
|
321 |
free (rset); |
free (rset); |
322 |
return err? WPTERR_GENERAL : 0; |
return err? WPTERR_GENERAL : 0; |
323 |
} |
} |
333 |
char *patt; |
char *patt; |
334 |
int n; |
int n; |
335 |
|
|
336 |
rset = keylist_enum_recipients( lv, KEYLIST_LIST, &n ); |
rset = keylist_enum_recipients (lv, KEYLIST_LIST, &n); |
337 |
if (!n) { |
if (!n) { |
338 |
msg_box( dlg, _("No key was selected for export."), _("Key Manager"), MB_ERR ); |
msg_box (dlg, _("No key was selected for export."), |
339 |
|
_("Key Manager"), MB_ERR); |
340 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
341 |
} |
} |
342 |
|
|
343 |
err = gpgme_data_new (&keydata); |
err = gpgme_data_new (&keydata); |
344 |
if( err ) |
if (err) |
345 |
BUG( dlg ); |
BUG (NULL); |
346 |
err = gpgme_new (&ctx); |
err = gpgme_new (&ctx); |
347 |
if( err ) |
if (err) |
348 |
BUG( dlg ); |
BUG (NULL); |
349 |
gpgme_set_armor (ctx, 1); |
gpgme_set_armor (ctx, 1); |
350 |
|
|
351 |
/*gpgme_set_comment (ctx, "Generated by WinPT "PGM_VERSION);*/ |
/*gpgme_set_comment (ctx, "Generated by WinPT "PGM_VERSION);*/ |
352 |
patt = gpg_keylist_to_pattern (rset); |
patt = gpg_keylist_to_pattern (rset, n); |
353 |
|
|
354 |
err = gpgme_op_export( ctx, patt, 0, keydata); |
err = gpgme_op_export( ctx, patt, 0, keydata); |
355 |
if( err ) { |
if( err ) { |
390 |
} /* extract_dash_escaped_key */ |
} /* extract_dash_escaped_key */ |
391 |
|
|
392 |
|
|
393 |
|
/* Import keys from the clipboard. */ |
394 |
int |
int |
395 |
km_clip_import( HWND dlg ) |
km_clip_import (HWND dlg) |
396 |
{ |
{ |
397 |
gpgme_error_t err; |
gpgme_error_t err; |
398 |
gpgme_pgptype_t pgptype; |
gpg_pgptype_t pgptype; |
399 |
int id; |
int id; |
400 |
int has_data = 0; |
int has_data = 0; |
401 |
|
|
402 |
if( !gpgme_clip_istext_avail( &has_data ) && !has_data ) { |
if (!gpg_clip_istext_avail (&has_data) && !has_data) { |
403 |
msg_box( dlg, winpt_strerror( WPTERR_CLIP_ISEMPTY ), _("Key Manager"), MB_ERR ); |
msg_box( dlg, winpt_strerror (WPTERR_CLIP_ISEMPTY), _("Key Manager"), MB_ERR); |
404 |
return WPTERR_CLIP_ISEMPTY; |
return WPTERR_CLIP_ISEMPTY; |
405 |
} |
} |
406 |
err = gpgme_clip_is_secured( &pgptype, &has_data ); |
err = gpg_clip_is_secured (&pgptype, &has_data); |
407 |
if( err ) |
if (err) |
408 |
msg_box( dlg, gpgme_strerror( err ), _("Key Manager"), MB_ERR ); |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
409 |
if( !has_data ) { |
if (!has_data) { |
410 |
msg_box( dlg, _("No valid OpenPGP data found."), _("Key Manager"), MB_ERR ); |
msg_box (dlg, _("No valid OpenPGP data found."), _("Key Manager"), MB_ERR); |
411 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
412 |
} |
} |
413 |
if( !(pgptype & PGP_PUBKEY) && !(pgptype & PGP_SECKEY) ) { |
if (!(pgptype & PGP_PUBKEY) && !(pgptype & PGP_SECKEY)) { |
414 |
msg_box( dlg, _("No valid OpenPGP keys found."), _("Key Manager"), MB_ERR ); |
msg_box (dlg, _("No valid OpenPGP keys found."), _("Key Manager"), MB_ERR); |
415 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
416 |
} |
} |
417 |
if( pgptype & PGP_DASH_ESCAPED ) { |
if (pgptype & PGP_DASH_ESCAPED) { |
418 |
id = msg_box( dlg, _("The key you want to import is dash escacped.\n" |
id = msg_box (dlg, _("The key you want to import is dash escacped.\n" |
419 |
"Do you want to extract the key?"), |
"Do you want to extract the key?"), |
420 |
_("Key Manager"), MB_YESNO ); |
_("Key Manager"), MB_YESNO); |
421 |
if (id == IDYES) |
if (id == IDYES) |
422 |
extract_dash_escaped_key (); |
extract_dash_escaped_key (); |
423 |
else |
else |
424 |
msg_box( dlg, _("Cannot import dash escaped OpenPGP keys."), _("Key Manager"), MB_INFO ); |
msg_box (dlg, _("Cannot import dash escaped OpenPGP keys."), |
425 |
|
_("Key Manager"), MB_INFO); |
426 |
} |
} |
427 |
|
|
428 |
dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg, |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg, |
429 |
clip_import_dlg_proc, NULL, |
clip_import_dlg_proc, NULL, |
430 |
_("Key Import"), IDS_WINPT_IMPORT ); |
_("Key Import"), IDS_WINPT_IMPORT); |
431 |
|
|
432 |
return 0; |
return 0; |
433 |
} /* km_clip_import */ |
} |
434 |
|
|
435 |
|
|
436 |
|
/* Import a key from the http URL @url. */ |
437 |
int |
int |
438 |
km_http_import (HWND dlg, const char * url) |
km_http_import (HWND dlg, const char *url) |
439 |
{ |
{ |
|
FILE * fp; |
|
|
char * p; |
|
|
char tmpdir[500]; |
|
440 |
http_hd_t hd; |
http_hd_t hd; |
441 |
|
FILE *fp; |
442 |
|
char *p; |
443 |
|
char tmpfile[500]; |
444 |
int statcode; |
int statcode; |
445 |
int rc = 0; |
int rc = 0; |
446 |
|
|
449 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
450 |
} |
} |
451 |
|
|
452 |
GetTempPath (sizeof (tmpdir)-1, tmpdir); |
GetTempPath (sizeof (tmpfile)-128, tmpfile); |
453 |
p = make_filename (tmpdir, "winpt_file_http", "tmp"); |
p = make_filename (tmpfile, "winpt_file_http", "tmp"); |
454 |
if (!p) |
if (!p) |
455 |
BUG (0); |
BUG (0); |
456 |
fp = fopen (p, "wb"); |
fp = fopen (p, "wb"); |
457 |
if (fp == NULL) { |
if (!fp) { |
458 |
free_if_alloc (p); |
free_if_alloc (p); |
459 |
log_box (_("Key Import HTTP"), MB_ERR, "%s: %s", p, winpt_strerror (WPTERR_FILE_CREAT)); |
log_box (_("Key Import HTTP"), MB_ERR, "%s: %s", p, winpt_strerror (WPTERR_FILE_CREAT)); |
460 |
return WPTERR_FILE_CREAT; |
return WPTERR_FILE_CREAT; |
461 |
} |
} |
462 |
|
|
463 |
/* parse URL */ |
/* parse URL */ |
464 |
rc = http_send_request2 (url, &hd); |
rc = http_send_request2 (url, &hd); |
465 |
if (!rc) |
if (!rc) |
468 |
rc = http_parse_data (hd, fp); |
rc = http_parse_data (hd, fp); |
469 |
http_hd_free (hd); |
http_hd_free (hd); |
470 |
fclose (fp); |
fclose (fp); |
471 |
if (rc) { |
if (rc) { |
|
free_if_alloc (p); |
|
472 |
msg_box (dlg, winpt_strerror (rc), _("Key Import HTTP"), MB_ERR); |
msg_box (dlg, winpt_strerror (rc), _("Key Import HTTP"), MB_ERR); |
473 |
return WPTERR_GENERAL; |
rc = WPTERR_GENERAL; |
474 |
} |
} |
475 |
km_file_import (dlg, p); |
km_file_import (dlg, p); |
476 |
// XXX: delete file |
unlink (p); |
477 |
free_if_alloc (p); |
free_if_alloc (p); |
478 |
return 0; |
return rc; |
479 |
} |
} |
480 |
|
|
481 |
|
|
487 |
gpgme_data_t keydata = NULL; |
gpgme_data_t keydata = NULL; |
488 |
gpgme_ctx_t ctx; |
gpgme_ctx_t ctx; |
489 |
gpgme_error_t err; |
gpgme_error_t err; |
|
gpgme_key_t *keys = NULL; |
|
490 |
fm_state_s fm_stat; |
fm_state_s fm_stat; |
491 |
gpgme_import_result_t res; |
gpgme_import_result_t res; |
492 |
|
|
501 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
502 |
} |
} |
503 |
|
|
504 |
err = gpgme_new( &ctx ); |
err = gpgme_new (&ctx); |
505 |
if( err ) |
if (err) |
506 |
BUG( dlg ); |
BUG (NULL); |
|
/*XXX gpgme_control( ctx, GPGME_CTRL_FORCETRUST, 1 );*/ |
|
507 |
err = gpgme_data_new_from_file (&keydata, fname, 1); |
err = gpgme_data_new_from_file (&keydata, fname, 1); |
508 |
if( err ) { |
if (err) { |
509 |
msg_box( dlg, _("Could not read key-data from file."), _("Key Manager"), MB_ERR ); |
msg_box (dlg, _("Could not read key-data from file."), |
510 |
|
_("Key Manager"), MB_ERR); |
511 |
goto leave; |
goto leave; |
512 |
} |
} |
513 |
|
|
514 |
err = gpgme_op_import (ctx, keydata); |
err = gpgme_op_import (ctx, keydata); |
515 |
if (err) { |
if (err) { |
516 |
msg_box( dlg, gpgme_strerror( err ), _("Key Manager"), MB_ERR ); |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
517 |
goto leave; |
goto leave; |
518 |
} |
} |
519 |
|
|
520 |
res = gpgme_op_import_result (ctx); |
res = gpgme_op_import_result (ctx); |
521 |
|
if (res->new_revocations == 0 && fm_stat.import.revcert == 1) |
522 |
|
res->new_revocations = 1; |
523 |
|
if (res->secret_imported == 0 && fm_stat.import.has_seckey == 1) |
524 |
|
res->secret_imported = 1; |
525 |
|
|
526 |
print_import_status (res); |
print_import_status (res); |
527 |
if (res->no_user_id > 0) { |
if (res->no_user_id > 0) { |
528 |
msg_box (dlg, _("Key without a self signature was dectected!\n" |
msg_box (dlg, _("Key without a self signature was dectected!\n" |
532 |
} |
} |
533 |
|
|
534 |
leave: |
leave: |
|
free (keys); |
|
535 |
gpgme_data_release (keydata); |
gpgme_data_release (keydata); |
536 |
gpgme_release (ctx); |
gpgme_release (ctx); |
537 |
free_if_alloc (fm_stat.opaque); |
free_if_alloc (fm_stat.opaque); |
543 |
static void |
static void |
544 |
delete_keys_from_cache (gpgme_key_t *rset, size_t n) |
delete_keys_from_cache (gpgme_key_t *rset, size_t n) |
545 |
{ |
{ |
546 |
gpgme_keycache_t pub = keycache_get_ctx (1); |
gpg_keycache_t pub = keycache_get_ctx (1); |
547 |
int i=0; |
int i=0; |
548 |
|
|
549 |
while (n-- > 0) |
while (n-- > 0) |
550 |
gpgme_keycache_delete_key (pub, rset[i++]->subkeys->keyid); |
gpg_keycache_delete_key (pub, rset[i++]->subkeys->keyid); |
551 |
} |
} |
552 |
|
|
553 |
|
|
554 |
|
/* Delete all selected keys from the list view @lv. */ |
555 |
int |
int |
556 |
km_delete_keys (listview_ctrl_t lv, HWND dlg) |
km_delete_keys (listview_ctrl_t lv, HWND dlg) |
557 |
{ |
{ |
568 |
} |
} |
569 |
|
|
570 |
if (listview_count_items (lv, 1) > 8) { |
if (listview_count_items (lv, 1) > 8) { |
571 |
i = msg_box (NULL, _("Do you really want to confirm each key?"), _("Delete Confirmation"), MB_YESNOCANCEL|MB_ICONQUESTION); |
i = msg_box (NULL, _("Do you really want to confirm each key?"), |
572 |
|
_("Delete Confirmation"), MB_YESNOCANCEL|MB_ICONQUESTION); |
573 |
if (i == IDCANCEL) |
if (i == IDCANCEL) |
574 |
return 0; |
return 0; |
575 |
if (i != IDNO) |
if (i != IDNO) |
609 |
"pub/sec %s %s %s\n" |
"pub/sec %s %s %s\n" |
610 |
" \"%s\""), keylen, keyid, date, uid ); |
" \"%s\""), keylen, keyid, date, uid ); |
611 |
if( rc == IDYES ) { |
if( rc == IDYES ) { |
612 |
if( seckey_type == 2 ) |
if (seckey_type == 2) |
613 |
msg_box( dlg, _("The actual secret key is stored on a smartcard.\n" |
msg_box( dlg, _("The actual secret key is stored on a smartcard.\n" |
614 |
"Only the public key and the secret key \n" |
"Only the public key and the secret key \n" |
615 |
"placeholder will be deleted.\n"), _("Key Manager"), MB_OK ); |
"placeholder will be deleted.\n"), _("Key Manager"), MB_OK ); |
634 |
err = gpgme_new (&ctx); |
err = gpgme_new (&ctx); |
635 |
if (err) |
if (err) |
636 |
BUG (NULL); |
BUG (NULL); |
637 |
|
n=k_pos; |
638 |
for (i=0; i < k_pos; i++) { |
for (i=0; i < k_pos; i++) { |
639 |
err = gpgme_op_delete (ctx, rset[i], with_seckey); |
err = gpgme_op_delete (ctx, rset[i], with_seckey); |
640 |
if (err) |
if (err) |
641 |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
642 |
else |
else |
643 |
show_msg (dlg, 1500, _("GnuPG Status: Finished")); |
n--; |
|
/* XXX: somethings 'conflict use' when k_pos > 3 */ |
|
644 |
} |
} |
645 |
|
if (n == 0) |
646 |
|
show_msg (dlg, 1500, _("GnuPG Status: Finished")); |
647 |
gpgme_release (ctx); |
gpgme_release (ctx); |
648 |
listview_del_items (lv); |
listview_del_items (lv); |
649 |
delete_keys_from_cache (rset, k_pos); |
delete_keys_from_cache (rset, k_pos); |
650 |
free (rset); |
free (rset); |
651 |
|
|
652 |
return (int)err; |
return (int)err; |
653 |
} /* km_delete_keys */ |
} |
654 |
|
|
655 |
|
|
656 |
int |
int |
940 |
int |
int |
941 |
km_groupdb_expand_recipients( const char *name, gpgme_recipients_t rset ) |
km_groupdb_expand_recipients( const char *name, gpgme_recipients_t rset ) |
942 |
{ |
{ |
943 |
gpgme_keycache_t kc; |
gpg_keycache_t kc; |
944 |
gpgme_key_t pk; |
gpgme_key_t pk; |
945 |
gpg_optfile_t opt; |
gpg_optfile_t opt; |
946 |
gpg_group_t grp; |
gpg_group_t grp; |