17 |
* along with WinPT; if not, write to the Free Software Foundation, |
* along with WinPT; if not, write to the Free Software Foundation, |
18 |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
19 |
*/ |
*/ |
|
|
|
20 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
21 |
#include <config.h> |
#include <config.h> |
22 |
#endif |
#endif |
23 |
|
|
24 |
#include <windows.h> |
#include <windows.h> |
|
#include <windows.h> |
|
25 |
|
|
26 |
#include "../resource.h" |
#include "resource.h" |
27 |
#include "wptErrors.h" |
#include "wptErrors.h" |
28 |
#include "wptGPG.h" |
#include "wptGPG.h" |
29 |
#include "wptCommonCtl.h" |
#include "wptCommonCtl.h" |
36 |
#include "wptVersion.h" |
#include "wptVersion.h" |
37 |
#include "wptKeyEdit.h" |
#include "wptKeyEdit.h" |
38 |
|
|
|
static void |
|
|
do_change_ownertrust (winpt_key_t k, const char *s) |
|
|
{ |
|
|
char ot[64]; |
|
|
|
|
|
if( strstr( s, "ultimate" ) ) { |
|
|
listview_get_item_text (k->callback.ctl, k->callback.idx, 5, ot, DIM (ot)-1); |
|
|
strcpy (ot, "Ultimate"); |
|
|
listview_add_sub_item (k->callback.ctl, k->callback.idx, 5, ot); |
|
|
/* fixme: If we switch back from Ultimate to a lower level */ |
|
|
} |
|
|
} |
|
|
|
|
39 |
|
|
40 |
/* Check that the key is not expired or revoked. */ |
/* Check that the key is not expired or revoked. */ |
41 |
static int |
static int |
53 |
static const char* |
static const char* |
54 |
ownertrust_to_string (int val) |
ownertrust_to_string (int val) |
55 |
{ |
{ |
56 |
const char * inf; |
const char *inf; |
57 |
int id = val; |
int id = val; |
58 |
|
|
59 |
switch (id) { |
switch (id) { |
60 |
case 1: inf = _("Don't know"); break; |
case 1: inf = _("Don't know"); break; |
61 |
case 2: inf = _("I do NOT trust"); break; |
case 2: inf = _("I do NOT trust"); break; |
144 |
val = key->revoked; |
val = key->revoked; |
145 |
if (val) |
if (val) |
146 |
return _("Revoked"); |
return _("Revoked"); |
147 |
|
val = key->disabled; |
148 |
|
if (val) |
149 |
|
return _("Disabled"); |
150 |
return get_key_trust2 (NULL, key->uids->validity, 0, 0); |
return get_key_trust2 (NULL, key->uids->validity, 0, 0); |
151 |
} |
} |
152 |
|
|
155 |
static const char* |
static const char* |
156 |
get_pref_cipher (winpt_key_t k) |
get_pref_cipher (winpt_key_t k) |
157 |
{ |
{ |
|
const char *sym_prefs=NULL; |
|
|
|
|
158 |
if (k->is_v3) |
if (k->is_v3) |
159 |
return "IDEA"; |
return "IDEA"; |
160 |
if (!k->ext->sym_prefs) |
if (!k->ext->sym_prefs) |
207 |
gpgme_key_t sk, key; |
gpgme_key_t sk, key; |
208 |
char info[512]; |
char info[512]; |
209 |
const char *inf; |
const char *inf; |
210 |
u32 created, expires; |
u32 created, expires; |
211 |
|
|
212 |
memset (&k2, 0, sizeof (k2)); |
memset (&k2, 0, sizeof (k2)); |
213 |
if (k->key_pair) |
if (k->key_pair) |
214 |
winpt_get_seckey (k->keyid, &k2); |
winpt_get_seckey (k->keyid, &k2); |
215 |
else |
else |
216 |
winpt_get_pubkey (k->keyid, &k2); |
winpt_get_pubkey (k->keyid, &k2); |
217 |
sk = k2.ctx; |
sk = k2.ctx; |
218 |
if (sk) |
if (sk) |
219 |
k->is_protected = k2.is_protected; |
k->is_protected = k2.is_protected; |
220 |
if (get_pubkey (k->keyid, &key)) |
if (get_pubkey (k->keyid, &key)) |
225 |
_("Type: %s\r\n" |
_("Type: %s\r\n" |
226 |
"Key ID: %s\r\n" |
"Key ID: %s\r\n" |
227 |
"Algorithm: %s\r\n" |
"Algorithm: %s\r\n" |
228 |
"Size: %s\r\n" |
"Size: %s bits\r\n" |
229 |
"Created: %s\r\n" |
"Created: %s\r\n" |
230 |
"Expires: %s\r\n" |
"Expires: %s\r\n" |
231 |
"Validity: %s\r\n" |
"Validity: %s\r\n" |
259 |
gpgme_validity_t valid; |
gpgme_validity_t valid; |
260 |
refresh_cache_s rcs = {0}; |
refresh_cache_s rcs = {0}; |
261 |
const char *inf; |
const char *inf; |
|
int cancel = 0; |
|
262 |
int rc; |
int rc; |
263 |
|
|
264 |
/* XXX: static variable (k) prevent that the dialog can |
/* XXX: static variable (k) prevent that the dialog can |
268 |
if (!lparam) |
if (!lparam) |
269 |
dlg_fatal_error (dlg, "Could not get dialog param!"); |
dlg_fatal_error (dlg, "Could not get dialog param!"); |
270 |
k = (winpt_key_t)lparam; |
k = (winpt_key_t)lparam; |
|
#ifndef LANG_DE |
|
271 |
SetWindowText (dlg, _("Key Properties")); |
SetWindowText (dlg, _("Key Properties")); |
272 |
SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change")); |
SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change")); |
273 |
SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers")); |
SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers")); |
274 |
SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Passwd")); |
SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Passwd")); |
275 |
SetDlgItemText (dlg, IDC_KEYPROPS_OTINF, _("Ownertrust")); |
SetDlgItemText (dlg, IDC_KEYPROPS_OTINF, _("Ownertrust")); |
|
#endif |
|
276 |
|
|
277 |
display_key_info (dlg, k, &key); |
display_key_info (dlg, k, &key); |
278 |
if (!keyprops_load_photo (dlg, key, &valid)) { |
if (!keyprops_load_photo (dlg, key, &valid)) { |
289 |
return TRUE; |
return TRUE; |
290 |
|
|
291 |
case WM_DESTROY: |
case WM_DESTROY: |
292 |
unlink (get_photo_tmpname (dlg)); |
remove (get_photo_tmpname (dlg)); |
293 |
break; |
break; |
294 |
|
|
295 |
case WM_PAINT: |
case WM_PAINT: |
323 |
if (rc == IDNO) |
if (rc == IDNO) |
324 |
return TRUE; |
return TRUE; |
325 |
} |
} |
|
//GetDlgItemText (dlg, IDC_KEYPROPS_OT, info, sizeof info -1); |
|
326 |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYEDIT_OWNERTRUST, |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYEDIT_OWNERTRUST, |
327 |
dlg, (DLGPROC)keyedit_ownertrust_dlg_proc, |
dlg, (DLGPROC)keyedit_ownertrust_dlg_proc, |
328 |
(LPARAM)k, _("Change Ownertrust"), |
(LPARAM)k, _("Change Ownertrust"), |
333 |
} |
} |
334 |
|
|
335 |
inf = ownertrust_to_string (k->callback.new_val); |
inf = ownertrust_to_string (k->callback.new_val); |
|
do_change_ownertrust (k, inf); |
|
336 |
SetDlgItemText (dlg, IDC_KEYPROPS_OT, inf); |
SetDlgItemText (dlg, IDC_KEYPROPS_OT, inf); |
337 |
msg_box (dlg, _("Ownertrust successfully changed."), |
msg_box (dlg, _("Ownertrust successfully changed."), |
338 |
_("GnuPG Status"), MB_OK); |
_("GnuPG Status"), MB_OK); |
339 |
|
|
340 |
/* reload only the keylist */ |
/* XXX: modified ownertrust values can effect the entire |
341 |
rcs.kr_reload = 1; rcs.kr_update = 1; |
WoT so we reload the cache. But this is very slow. */ |
342 |
rcs.tr_update = 0; |
memset (&rcs, 0, sizeof (rcs)); |
343 |
|
rcs.kr_reload = 1; rcs.kr_update = 1; /* reload only keylist */ |
344 |
DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, dlg, |
DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, dlg, |
345 |
keycache_dlg_proc, (LPARAM)&rcs); |
keycache_dlg_proc, (LPARAM)&rcs); |
346 |
return TRUE; |
return TRUE; |
351 |
|
|
352 |
case IDC_KEYPROPS_REVOKERS: |
case IDC_KEYPROPS_REVOKERS: |
353 |
dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYREVOKERS, dlg, |
dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYREVOKERS, dlg, |
354 |
key_revokers_dlg_proc, (LPARAM)key, _("Key Revokers"), |
key_revokers_dlg_proc, (LPARAM)key, |
355 |
IDS_WINPT_KEY_REVOKERS); |
_("Key Revokers"), IDS_WINPT_KEY_REVOKERS); |
356 |
break; |
break; |
357 |
} |
} |
358 |
} |
} |