52 |
CMD_DELKEY, |
CMD_DELKEY, |
53 |
CMD_EXPIRE, |
CMD_EXPIRE, |
54 |
CMD_SHOWPREF, |
CMD_SHOWPREF, |
55 |
//CMD_SETPREF, |
CMD_SETPREF, |
56 |
CMD_PASSWD, |
CMD_PASSWD, |
57 |
CMD_PRIMARY, |
CMD_PRIMARY, |
58 |
CMD_TRUST, |
CMD_TRUST, |
80 |
{"DELKEY", 1, CMD_DELKEY}, |
{"DELKEY", 1, CMD_DELKEY}, |
81 |
{"EXPIRE", 1, CMD_EXPIRE}, |
{"EXPIRE", 1, CMD_EXPIRE}, |
82 |
{"SHOWPREF", 0, CMD_SHOWPREF}, |
{"SHOWPREF", 0, CMD_SHOWPREF}, |
83 |
/*{"SETPREF", 1, CMD_SETPREF},*/ |
{"SETPREF", 1, CMD_SETPREF}, |
84 |
{"PASSWD", 1, CMD_PASSWD}, |
{"PASSWD", 1, CMD_PASSWD}, |
85 |
{"PRIMARY", 1, CMD_PRIMARY}, |
{"PRIMARY", 1, CMD_PRIMARY}, |
86 |
{"TRUST", 0, CMD_TRUST}, |
{"TRUST", 0, CMD_TRUST}, |
120 |
|
|
121 |
/* Key edit callback context. */ |
/* Key edit callback context. */ |
122 |
struct keyedit_cb_s { |
struct keyedit_cb_s { |
123 |
const char *keyid; |
HWND parent; /* parent window handle. */ |
124 |
const char *pass; |
const char *keyid; /* key ID of the key. */ |
125 |
|
const char *pass; /* pointer to the passphrase. */ |
126 |
listview_ctrl_t lv; |
listview_ctrl_t lv; |
127 |
int lv_pos; |
int lv_pos; |
128 |
void *opaque; |
void *opaque; |
134 |
|
|
135 |
/* Key generation callback context. */ |
/* Key generation callback context. */ |
136 |
struct keygen_cb_s { |
struct keygen_cb_s { |
137 |
int bits; |
int bits; |
138 |
int algo; |
int algo; |
139 |
u32 expire; |
DWORD expire; |
140 |
char *fpr; |
char *fpr; |
141 |
char *name; |
char *name; |
142 |
char *comment; |
char *comment; |
143 |
char *email; |
char *email; |
144 |
}; |
}; |
145 |
typedef struct keygen_cb_s *keygen_cb_t; |
typedef struct keygen_cb_s *keygen_cb_t; |
146 |
|
|
151 |
static subclass_s keyedit_uid_proc; |
static subclass_s keyedit_uid_proc; |
152 |
|
|
153 |
int keygen_check_date (SYSTEMTIME *st); |
int keygen_check_date (SYSTEMTIME *st); |
154 |
void get_userid_preflist (char **r_prefs, int * r_flags); |
void get_userid_preflist (const char *old_prefs, char **r_prefs, int *r_flags); |
155 |
char* get_subkey_keyid (const char *keyid); |
char* get_subkey_keyid (const char *keyid); |
|
|
|
156 |
void ComboBox_AddString_utf8 (HWND cb, const char *txt); |
void ComboBox_AddString_utf8 (HWND cb, const char *txt); |
157 |
|
|
158 |
|
|
159 |
|
/* Safe wrapper for allocation. */ |
160 |
static GpgKeyEdit* |
static GpgKeyEdit* |
161 |
create_GpgKeyEdit (const char *keyid) |
create_GpgKeyEdit (const char *keyid) |
162 |
{ |
{ |
180 |
int i, n; |
int i, n; |
181 |
|
|
182 |
pub = keycache_get_ctx (1); |
pub = keycache_get_ctx (1); |
|
if (!pub) |
|
|
BUG (0); |
|
|
|
|
183 |
gpg_keycache_rewind (pub); |
gpg_keycache_rewind (pub); |
184 |
while( !gpg_keycache_next_key (pub, 0, &key)) { |
while (!gpg_keycache_next_key (pub, 0, &key)) { |
185 |
if (key->expired || key->revoked || |
if (key->expired || key->revoked || |
186 |
key->disabled || key->invalid) |
key->disabled || key->invalid) |
187 |
continue; |
continue; |
208 |
const char *utf8_name, const char *email, |
const char *utf8_name, const char *email, |
209 |
const char *utf8_comment) |
const char *utf8_comment) |
210 |
{ |
{ |
211 |
char *p; |
char *p, *native; |
212 |
size_t n; |
size_t n; |
213 |
|
|
214 |
n = strlen (utf8_name) + strlen (email) + 16; |
n = strlen (utf8_name) + strlen (email) + 16; |
217 |
p = new char[n+1]; |
p = new char[n+1]; |
218 |
if (!p) |
if (!p) |
219 |
BUG (NULL); |
BUG (NULL); |
220 |
if (utf8_comment) { |
if (utf8_comment) |
221 |
sprintf (p, "%s (%s)", utf8_name, utf8_comment); |
sprintf (p, "%s (%s)", utf8_name, utf8_comment); |
|
} |
|
222 |
else |
else |
223 |
sprintf (p, "%s", utf8_name); |
sprintf (p, "%s", utf8_name); |
224 |
|
native = utf8_to_native (p); |
225 |
|
free_if_alloc (p); |
226 |
|
|
227 |
listview_add_item (lv, ""); |
listview_add_item (lv, ""); |
228 |
listview_add_sub_item (lv, 0, 0, _("Ultimate" )); |
listview_add_sub_item (lv, 0, UID_COL_VALID, _("Ultimate" )); |
229 |
listview_add_sub_item (lv, 0, 1, p); |
listview_add_sub_item (lv, 0, UID_COL_NAME, native); |
230 |
listview_add_sub_item (lv, 0, 2, email && *email? email : ""); |
listview_add_sub_item (lv, 0, UID_COL_EMAIL, email && *email? email : ""); |
231 |
listview_add_sub_item (lv, 0, 3, get_key_created (time (NULL))); |
listview_add_sub_item (lv, 0, UID_COL_CREATION, get_key_created (time (NULL))); |
232 |
free_if_alloc (p); |
free_if_alloc (native); |
233 |
} |
} |
234 |
|
|
235 |
|
|
237 |
do_add_new_subkey (listview_ctrl_t lv, keygen_cb_t keygen, unsigned int flags) |
do_add_new_subkey (listview_ctrl_t lv, keygen_cb_t keygen, unsigned int flags) |
238 |
{ |
{ |
239 |
char info[128], keyid[32]; |
char info[128], keyid[32]; |
240 |
const char *expdate, *s; |
const char *expdate, *s, *kid; |
241 |
int n; |
int n; |
242 |
|
|
243 |
expdate = keygen->expire? get_key_expire_date (keygen->expire) : _("Never"); |
expdate = keygen->expire? get_key_expire_date (keygen->expire) : _("Never"); |
244 |
_snprintf (info, sizeof info-1, "%d-bit %s", |
_snprintf (info, sizeof (info)-1, "%d-bit %s", |
245 |
keygen->bits, |
keygen->bits, |
246 |
get_key_pubalgo ((gpgme_pubkey_algo_t)keygen->algo)); |
get_key_pubalgo ((gpgme_pubkey_algo_t)keygen->algo)); |
247 |
_snprintf (keyid, sizeof keyid-1, "0x%s", keygen->fpr+8); |
kid = get_keyid_from_fpr (keygen->fpr); |
248 |
|
_snprintf (keyid, sizeof (keyid)-1, "0x%s", kid); |
249 |
s = get_key_created (time (NULL)); |
s = get_key_created (time (NULL)); |
250 |
n = listview_count_items (lv, 0); |
n = listview_count_items (lv, 0); |
251 |
listview_add_item_pos (lv, n); |
listview_add_item_pos (lv, n); |
281 |
delete ke; |
delete ke; |
282 |
if (err) { |
if (err) { |
283 |
log_box (_("user ID"), MB_ERR, |
log_box (_("user ID"), MB_ERR, |
284 |
_("Could not get key information for: \"%s\":\n%s"), |
_("Could not get key information for: \"%s\":\n%s"), |
285 |
name, gpgme_strerror (err)); |
name, gpgme_strerror (err)); |
286 |
return -1; |
return -1; |
287 |
} |
} |
288 |
|
|
353 |
cb = (keyedit_cb_t)lparam; |
cb = (keyedit_cb_t)lparam; |
354 |
if (!cb) |
if (!cb) |
355 |
BUG (NULL); |
BUG (NULL); |
356 |
SetDlgItemText (dlg, IDC_ADDPHOTO_INF, _("Remember that the image is stored within your public key. If you use a very large picture, your key will become very large as well! Keeping the image close to 240x288 is a good size to use.")); |
SetDlgItemText (dlg, IDC_ADDPHOTO_INF, _("Remember that the image is stored within your public key. If you use a very large picture, your key will become very large as well! Keeping the image close to 240x288 is advised.")); |
357 |
SetDlgItemText (dlg, IDC_ADDPHOTO_FILEINF, _("Pick an image to use for your photo ID.\nThe image must be a JPEG file.")); |
SetDlgItemText (dlg, IDC_ADDPHOTO_FILEINF, _("Pick an image to use for your photo ID.\nThe image must be a JPEG file.")); |
358 |
SetDlgItemText (dlg, IDC_ADDPHOTO_PWDINF, _("Passphrase")); |
SetDlgItemText (dlg, IDC_ADDPHOTO_PWDINF, _("Passphrase")); |
359 |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
361 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
362 |
break; |
break; |
363 |
|
|
|
case WM_DESTROY: |
|
|
break; |
|
|
|
|
|
case WM_SYSCOMMAND: |
|
|
if (LOWORD (wparam) == SC_CLOSE) |
|
|
EndDialog (dlg, TRUE); |
|
|
break; |
|
|
|
|
364 |
case WM_COMMAND: |
case WM_COMMAND: |
365 |
switch( LOWORD (wparam)) { |
switch( LOWORD (wparam)) { |
366 |
case IDC_ADDPHOTO_SELFILE: |
case IDC_ADDPHOTO_SELFILE: |
378 |
|
|
379 |
case IDOK: |
case IDOK: |
380 |
if (!GetDlgItemText (dlg, IDC_ADDPHOTO_FILE, file, sizeof (file)-1)){ |
if (!GetDlgItemText (dlg, IDC_ADDPHOTO_FILE, file, sizeof (file)-1)){ |
381 |
msg_box( dlg, _("Please enter a file name."), _("Add Photo"), MB_ERR); |
msg_box (dlg, _("Please enter a file name."), |
382 |
|
_("Add Photo"), MB_ERR); |
383 |
return FALSE; |
return FALSE; |
384 |
} |
} |
385 |
if (get_file_size (file) == 0 || get_file_size (file) > 6144 ) { |
if (get_file_size (file) == 0 || get_file_size (file) > 6144) { |
386 |
id = msg_box (dlg, _("The JPEG is really large.\n" |
id = msg_box (dlg, _("The JPEG is really large.\n" |
387 |
"Are you sure you want to use it?"), |
"Are you sure you want to use it?"), |
388 |
_("Add Photo"), MB_YESNO|MB_INFO); |
_("Add Photo"), MB_YESNO|MB_INFO); |
440 |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
441 |
SetWindowText (dlg, _("Add Revoker")); |
SetWindowText (dlg, _("Add Revoker")); |
442 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
443 |
break; |
center_window (dlg, cb->parent); |
|
|
|
|
case WM_SYSCOMMAND: |
|
|
if (LOWORD (wparam) == SC_CLOSE) |
|
|
EndDialog (dlg, FALSE); |
|
444 |
break; |
break; |
445 |
|
|
446 |
case WM_COMMAND: |
case WM_COMMAND: |
505 |
SetDlgItemText (dlg, IDC_ADDUID_INFCOMMENT, _("&Comment")); |
SetDlgItemText (dlg, IDC_ADDUID_INFCOMMENT, _("&Comment")); |
506 |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
507 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
508 |
return FALSE; |
center_window (dlg, ctx->parent); |
|
|
|
|
case WM_SYSCOMMAND: |
|
|
if (LOWORD (wparam) == SC_CLOSE) |
|
|
EndDialog(dlg, TRUE); |
|
509 |
return FALSE; |
return FALSE; |
510 |
|
|
511 |
case WM_COMMAND: |
case WM_COMMAND: |
522 |
if (strchr (utf8_name, '@')) { |
if (strchr (utf8_name, '@')) { |
523 |
msg_box (dlg, _("Please enter the email address in the email field and not in the name field"), |
msg_box (dlg, _("Please enter the email address in the email field and not in the name field"), |
524 |
_("UserID"), MB_INFO); |
_("UserID"), MB_INFO); |
525 |
|
free_if_alloc (utf8_name); |
526 |
return FALSE; |
return FALSE; |
527 |
} |
} |
528 |
|
|
529 |
if( !GetDlgItemText (dlg, IDC_ADDUID_EMAIL, email, sizeof (email) -1)) { |
if( !GetDlgItemText (dlg, IDC_ADDUID_EMAIL, email, sizeof (email) -1)) { |
530 |
msg_box( dlg, _("Please enter an email address."), _("UserID"), MB_ERR ); |
msg_box (dlg, _("Please enter an email address."), _("UserID"), MB_ERR); |
531 |
|
free_if_alloc (utf8_name); |
532 |
return FALSE; |
return FALSE; |
533 |
} |
} |
534 |
if (check_email_address (email)) { |
if (check_email_address (email)) { |
535 |
msg_box (dlg, _("Invalid email address."), _("UserID"), MB_ERR); |
msg_box (dlg, _("Invalid email address."), _("UserID"), MB_ERR); |
536 |
|
free_if_alloc (utf8_name); |
537 |
return FALSE; |
return FALSE; |
538 |
} |
} |
539 |
|
|
550 |
else { |
else { |
551 |
msg_box (dlg, _("user ID successfully added."), _("GnuPG Status"), MB_OK); |
msg_box (dlg, _("user ID successfully added."), _("GnuPG Status"), MB_OK); |
552 |
ctx->finished = 1; |
ctx->finished = 1; |
553 |
|
/* The caller releases this items later. */ |
554 |
keygen->name = utf8_name; |
keygen->name = utf8_name; |
555 |
keygen->comment = utf8_comment; |
keygen->comment = utf8_comment; |
556 |
keygen->email = m_strdup (email); |
keygen->email = m_strdup (email); |
570 |
} |
} |
571 |
|
|
572 |
|
|
573 |
|
/* Initalize a combo box with default key sizes (1024-4096). */ |
574 |
static void |
static void |
575 |
init_keysize_box (HWND dlg, int ctlid) |
init_keysize_box (HWND dlg, int ctlid) |
576 |
{ |
{ |
631 |
switch (msg) { |
switch (msg) { |
632 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
633 |
ctx = (keyedit_cb_t)lparam; |
ctx = (keyedit_cb_t)lparam; |
634 |
if (!ctx) |
if (!ctx) |
635 |
dlg_fatal_error (dlg, "Could not get dialog param!"); |
BUG (NULL); |
|
|
|
636 |
SetWindowText (dlg, _("Add new Subkey")); |
SetWindowText (dlg, _("Add new Subkey")); |
637 |
SetDlgItemText (dlg, IDC_ADDSUBKEY_INFALGO, _("Key type")); |
SetDlgItemText (dlg, IDC_ADDSUBKEY_INFALGO, _("Key type")); |
638 |
SetDlgItemText (dlg, IDC_ADDSUBKEY_INFSIZE, _("Size in bits")); |
SetDlgItemText (dlg, IDC_ADDSUBKEY_INFSIZE, _("Size in bits")); |
649 |
EnableWindow (GetDlgItem (dlg, IDC_ADDSUBKEY_EXPDATE), FALSE); |
EnableWindow (GetDlgItem (dlg, IDC_ADDSUBKEY_EXPDATE), FALSE); |
650 |
init_keysize_box (dlg, IDC_ADDSUBKEY_SIZE); |
init_keysize_box (dlg, IDC_ADDSUBKEY_SIZE); |
651 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
652 |
return FALSE; |
center_window (dlg, ctx->parent); |
|
|
|
|
case WM_SYSCOMMAND: |
|
|
if (LOWORD (wparam) == SC_CLOSE) |
|
|
EndDialog (dlg, TRUE); |
|
653 |
return FALSE; |
return FALSE; |
654 |
|
|
655 |
case WM_COMMAND: |
case WM_COMMAND: |
663 |
if (HIWORD (wparam) == LBN_SELCHANGE && |
if (HIWORD (wparam) == LBN_SELCHANGE && |
664 |
LOWORD (wparam) == IDC_ADDSUBKEY_ALGO) { |
LOWORD (wparam) == IDC_ADDSUBKEY_ALGO) { |
665 |
index = SendMessage ((HWND)lparam, LB_GETCURSEL, 0, 0); |
index = SendMessage ((HWND)lparam, LB_GETCURSEL, 0, 0); |
666 |
if (index == 0) |
SendDlgItemMessage (dlg, IDC_ADDSUBKEY_SIZE, CB_SETCURSEL, |
667 |
SendDlgItemMessage (dlg, IDC_ADDSUBKEY_SIZE, CB_SETCURSEL, 0, 0); |
index==0? 0 : 2, 0); |
668 |
} |
} |
669 |
|
|
670 |
switch (LOWORD (wparam)) { |
switch (LOWORD (wparam)) { |
752 |
} |
} |
753 |
|
|
754 |
if (k->is_protected) { |
if (k->is_protected) { |
755 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
756 |
if (cancel) |
if (cancel) |
757 |
return FALSE; |
return FALSE; |
758 |
} |
} |
759 |
|
|
760 |
memset (&keygen, 0, sizeof (keygen)); |
memset (&keygen, 0, sizeof (keygen)); |
761 |
memset (&cb, 0, sizeof cb); |
memset (&cb, 0, sizeof cb); |
762 |
|
cb.parent = dlg; |
763 |
cb.opaque = &keygen; |
cb.opaque = &keygen; |
764 |
cb.is_protected = k->is_protected; |
cb.is_protected = k->is_protected; |
765 |
cb.pass = pass; |
cb.pass = pass; |
820 |
return FALSE; |
return FALSE; |
821 |
} |
} |
822 |
if (k->is_protected) { |
if (k->is_protected) { |
823 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
824 |
if (cancel) |
if (cancel) |
825 |
return FALSE; |
return FALSE; |
826 |
} |
} |
846 |
} |
} |
847 |
|
|
848 |
|
|
849 |
|
/* Set the preferred keyserver of the given key @k. */ |
850 |
BOOL |
BOOL |
851 |
keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg) |
keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg) |
852 |
{ |
{ |
861 |
return FALSE; |
return FALSE; |
862 |
} |
} |
863 |
|
|
864 |
pass = request_passphrase (_("Key Edit"), 1, &url->cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &url->cancel); |
865 |
if (url->cancel) { |
if (url->cancel) { |
866 |
delete url; |
delete url; |
867 |
return FALSE; |
return FALSE; |
902 |
|
|
903 |
memset (&cb, 0, sizeof (cb)); |
memset (&cb, 0, sizeof (cb)); |
904 |
if (k->is_protected) { |
if (k->is_protected) { |
905 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
906 |
if (cancel) |
if (cancel) |
907 |
return FALSE; |
return FALSE; |
908 |
} |
} |
909 |
|
cb.parent = dlg; |
910 |
cb.pass = pass; |
cb.pass = pass; |
911 |
cb.keyid = k->keyid; |
cb.keyid = k->keyid; |
|
|
|
912 |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYEDIT_ADDPHOTO, dlg, |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYEDIT_ADDPHOTO, dlg, |
913 |
keyedit_addphoto_dlg_proc, (LPARAM)&cb); |
keyedit_addphoto_dlg_proc, (LPARAM)&cb); |
914 |
|
|
932 |
} |
} |
933 |
|
|
934 |
if (k->is_protected) { |
if (k->is_protected) { |
935 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
936 |
if (cancel) |
if (cancel) |
937 |
return FALSE; |
return FALSE; |
938 |
} |
} |
939 |
|
|
940 |
memset (&cb, 0, sizeof (cb)); |
memset (&cb, 0, sizeof (cb)); |
941 |
|
cb.parent = dlg; |
942 |
cb.is_protected = k->is_protected; |
cb.is_protected = k->is_protected; |
943 |
cb.keyid = k->keyid; |
cb.keyid = k->keyid; |
944 |
cb.pass = pass; |
cb.pass = pass; |
983 |
|
|
984 |
memset (&k, 0, sizeof (k)); |
memset (&k, 0, sizeof (k)); |
985 |
if (winpt_get_pubkey (keyid, &k)) |
if (winpt_get_pubkey (keyid, &k)) |
986 |
BUG (0); |
BUG (NULL); |
|
sym_prefs = k.ext->sym_prefs; |
|
987 |
if (!k.is_v3) |
if (!k.is_v3) |
988 |
return 0; |
return 0; |
989 |
|
sym_prefs = k.ext->sym_prefs; |
990 |
if (!sym_prefs) |
if (!sym_prefs) |
991 |
return 1; /* assume that only v3 keys have no symmetric cipher preferences |
return 1; /* assume that only v3 keys have no symmetric cipher preferences |
992 |
and thus IDEA is explicit. */ |
and thus IDEA is explicit. */ |
1021 |
} |
} |
1022 |
|
|
1023 |
if (k->is_protected) { |
if (k->is_protected) { |
1024 |
old_pass = request_passphrase (_("Current (old) Passphrase"), 1, &cancel); |
old_pass = request_passphrase (_("Current (old) Passphrase"), |
1025 |
|
PASSDLG_INIT, &cancel); |
1026 |
if (cancel) |
if (cancel) |
1027 |
return FALSE; |
return FALSE; |
1028 |
} |
} |
1029 |
new_pass = request_passphrase2 (_("New Passphrase" ), 1, &cancel); |
new_pass = request_passphrase2 (_("New Passphrase" ), |
1030 |
|
PASSDLG_INIT|PASSDLG_WARN_UTF8, &cancel); |
1031 |
if (cancel) { |
if (cancel) { |
1032 |
free_if_alloc (old_pass); |
sfree_if_alloc (old_pass); |
1033 |
return FALSE; |
return FALSE; |
1034 |
} |
} |
1035 |
|
|
1036 |
if (is_8bit_string (new_pass)) { |
if (strlen (new_pass) == 0) { |
1037 |
msg_box (dlg, _("The passphrase contains 8-bit characters.\n" |
cancel = msg_box (dlg, _("Are you sure that you really don't want a passphrase?\n" |
1038 |
"It is not suggested to use charset specific characters."), |
"This is propably a bad idea, continue?"), |
1039 |
_("Key Edit"), MB_ERR); |
_("Key Edit"), MB_WARN_ASK); |
1040 |
free_if_alloc (old_pass); |
if (cancel != IDYES) { |
1041 |
free_if_alloc (new_pass); |
sfree_if_alloc (old_pass); |
1042 |
return FALSE; |
sfree_if_alloc (new_pass); |
1043 |
|
return FALSE; |
1044 |
|
} |
1045 |
} |
} |
1046 |
|
|
1047 |
ke = create_GpgKeyEdit (k->keyid); |
ke = create_GpgKeyEdit (k->keyid); |
1048 |
ke->setPassphrase (k->is_protected? old_pass : NULL); |
ke->setPassphrase (k->is_protected? old_pass : NULL); |
1049 |
err = ke->changePassphrase (new_pass, 0); |
if (!k->is_protected) |
1050 |
|
ke->setNoPassphrase (true); |
1051 |
|
err = ke->changePassphrase (new_pass, 1); |
1052 |
if (err) |
if (err) |
1053 |
msg_box (dlg, gpgme_strerror (err), _("Change Passwd"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Change Password"), MB_ERR); |
1054 |
else |
else |
1055 |
msg_box (dlg, _("Passphrase successfully changed."), _("GnuPG status"), MB_OK); |
msg_box (dlg, _("Passphrase successfully changed."), _("GnuPG status"), MB_OK); |
1056 |
sfree_if_alloc (old_pass); |
sfree_if_alloc (old_pass); |
1059 |
return TRUE; |
return TRUE; |
1060 |
} |
} |
1061 |
|
|
1062 |
|
|
1063 |
/* Initialize sub key list from key @k and return |
/* Initialize sub key list from key @k and return |
1064 |
the new listview control. */ |
the new listview control. */ |
1065 |
listview_ctrl_t |
listview_ctrl_t |
1082 |
listview_ctrl_t lv; |
listview_ctrl_t lv; |
1083 |
char buf[256], tmp[128]; |
char buf[256], tmp[128]; |
1084 |
const char *t; |
const char *t; |
1085 |
int nkeys = 0, i, bits; |
int nkeys = 0, i; |
1086 |
|
|
1087 |
nkeys = count_subkeys (k->ctx); |
nkeys = count_subkeys (k->ctx); |
1088 |
if( !nkeys ) { |
if (!nkeys) |
1089 |
msg_box (dlg, _("No subkey(s) found."), _("Key Edit"), MB_ERR); |
BUG (NULL); /* should never happen. */ |
|
return NULL; |
|
|
} |
|
1090 |
|
|
1091 |
listview_new (&lv, GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST)); |
listview_new (&lv, GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST)); |
1092 |
for (i = 0; cols[i].fieldname != NULL; i++) |
for (i = 0; cols[i].fieldname != NULL; i++) |
1093 |
listview_add_column (lv, &cols[i]); |
listview_add_column (lv, &cols[i]); |
1094 |
|
|
1095 |
for( i = 0; i < nkeys; i++ ) { |
for (i = 0, sub = k->ctx->subkeys; i < nkeys; i++, sub = sub->next) { |
1096 |
listview_add_item( lv, "" ); |
listview_add_item (lv, ""); |
1097 |
listview_add_sub_item( lv, 0, 1, "" ); |
listview_add_sub_item (lv, 0, 1, ""); |
1098 |
memset( &lvi, 0, sizeof lvi ); |
memset (&lvi, 0, sizeof (lvi)); |
1099 |
lvi.mask = LVIF_PARAM; |
lvi.mask = LVIF_PARAM; |
1100 |
lvi.lParam = (LPARAM)k->ctx; |
lvi.lParam = (LPARAM)sub; |
1101 |
if( ListView_SetItem( lv->ctrl, &lvi ) == FALSE ) |
if (ListView_SetItem (lv->ctrl, &lvi) == FALSE) |
1102 |
return NULL; |
BUG (NULL); |
1103 |
} |
} |
1104 |
|
|
1105 |
listview_set_ext_style( lv ); |
listview_set_ext_style (lv); |
1106 |
for( i = 0, sub = k->ctx->subkeys; i < nkeys; i++, sub = sub->next ) { |
for (i = 0, sub = k->ctx->subkeys; i < nkeys; i++, sub = sub->next) { |
1107 |
memset( buf, 0, sizeof buf ); |
_snprintf (buf, sizeof buf-1, "%d-bit %s", sub->length, |
1108 |
|
get_key_pubalgo (sub->pubkey_algo)); |
1109 |
bits = sub->length; |
listview_add_sub_item (lv, i, SUBK_COL_DESC, buf); |
|
_snprintf( tmp, sizeof tmp-1, "%d-bit ", bits ); |
|
|
strcat( buf, tmp ); |
|
|
|
|
|
_snprintf( tmp, sizeof tmp-1, "%s", get_key_pubalgo (sub->pubkey_algo)); |
|
|
strcat( buf, tmp ); |
|
|
|
|
|
listview_add_sub_item( lv, i, 0, buf ); |
|
1110 |
t = sub->keyid; |
t = sub->keyid; |
1111 |
if( !t ) |
assert (t != NULL); |
1112 |
t = "DEADBEEFDEADBEEF"; |
_snprintf (tmp, sizeof tmp-1, "0x%s", t+8); |
1113 |
_snprintf( tmp, sizeof tmp-1, "0x%s", t+8 ); |
listview_add_sub_item (lv, i, SUBK_COL_KEYID, tmp); |
|
listview_add_sub_item( lv, i, 1, tmp ); |
|
1114 |
|
|
1115 |
t = get_key_created (sub->timestamp); |
t = get_key_created (sub->timestamp); |
1116 |
if( !t ) |
if (!t) |
1117 |
t = "????" "-??" "-??"; |
t = "????" "-??" "-??"; |
1118 |
listview_add_sub_item( lv, i, 2, t ); |
listview_add_sub_item (lv, i, SUBK_COL_CREATION, t); |
1119 |
|
|
1120 |
if( sub->expires ) { |
if (sub->expires) { |
1121 |
t = get_key_created (sub->expires); |
t = get_key_created (sub->expires); |
1122 |
listview_add_sub_item( lv, i, 3, t ); |
listview_add_sub_item (lv, i, SUBK_COL_EXPIRES, t); |
1123 |
} |
} |
1124 |
else |
else |
1125 |
listview_add_sub_item( lv, i, 3, _("Never") ); |
listview_add_sub_item (lv, i, SUBK_COL_EXPIRES, _("Never")); |
1126 |
|
if (sub->expired) |
|
if( sub->expired ) |
|
1127 |
t = _("Expired"); |
t = _("Expired"); |
1128 |
else if( sub->revoked ) |
else if (sub->revoked) |
1129 |
t = _("Revoked"); |
t = _("Revoked"); |
1130 |
else |
else |
1131 |
t = _("OK"); |
t = _("OK"); |
1132 |
listview_add_sub_item( lv, i, 4, t ); |
listview_add_sub_item (lv, i, SUBK_COL_STATUS, t); |
1133 |
|
|
1134 |
if (sub->can_certify) t = "*"; else t = ""; |
if (sub->can_certify) t = "*"; else t = ""; |
1135 |
listview_add_sub_item (lv, i, 5, t); |
listview_add_sub_item (lv, i, SUBK_COL_C_FLAG, t); |
1136 |
if (sub->can_sign) t = "*"; else t = ""; |
if (sub->can_sign) t = "*"; else t = ""; |
1137 |
listview_add_sub_item( lv, i, 6, t ); |
listview_add_sub_item( lv, i, SUBK_COL_S_FLAG, t ); |
1138 |
if (sub->can_encrypt) t = "*"; else t = ""; |
if (sub->can_encrypt) t = "*"; else t = ""; |
1139 |
listview_add_sub_item( lv, i, 7, t ); |
listview_add_sub_item( lv, i, SUBK_COL_E_FLAG, t ); |
1140 |
if (sub->can_authenticate) t = "*"; else t = ""; |
if (sub->can_authenticate) t = "*"; else t = ""; |
1141 |
listview_add_sub_item (lv, i, 8, t); |
listview_add_sub_item (lv, i, SUBK_COL_A_FLAG, t); |
1142 |
} |
} |
1143 |
return lv; |
return lv; |
1144 |
} |
} |
1161 |
const char *attr; |
const char *attr; |
1162 |
|
|
1163 |
nuids = count_userids (k->ctx); |
nuids = count_userids (k->ctx); |
1164 |
if (!nuids) { |
if (!nuids) |
1165 |
msg_box (dlg, _("No user ID(s) found."), _("Key Edit"), MB_ERR); |
BUG (NULL); /* should never happen. */ |
|
return NULL; |
|
|
} |
|
1166 |
|
|
1167 |
listview_new (&lv, GetDlgItem (dlg, IDC_KEYEDIT_UIDLIST)); |
listview_new (&lv, GetDlgItem (dlg, IDC_KEYEDIT_UIDLIST)); |
1168 |
for( j = 0; cols[j].fieldname != NULL; j++ ) |
for (j = 0; cols[j].fieldname != NULL; j++) |
1169 |
listview_add_column (lv, &cols[j]); |
listview_add_column (lv, &cols[j]); |
1170 |
|
|
1171 |
for (j = 0; j < nuids; j++) { |
for (j = 0; j < nuids; j++) { |
1193 |
listview_add_sub_item (lv, j, UID_COL_CREATION, |
listview_add_sub_item (lv, j, UID_COL_CREATION, |
1194 |
get_key_created (ks->timestamp)); |
get_key_created (ks->timestamp)); |
1195 |
} |
} |
1196 |
if( !k->key_pair ) { |
if (!k->key_pair) { |
1197 |
CheckDlgButton (dlg, IDC_KEYUID_ADD, BST_INDETERMINATE); |
CheckDlgButton (dlg, IDC_KEYUID_ADD, BST_INDETERMINATE); |
1198 |
CheckDlgButton (dlg, IDC_KEYUID_REVOKE, BST_INDETERMINATE); |
CheckDlgButton (dlg, IDC_KEYUID_REVOKE, BST_INDETERMINATE); |
1199 |
} |
} |
1227 |
case CMD_ADDKEY: |
case CMD_ADDKEY: |
1228 |
case CMD_ADDPHOTO: |
case CMD_ADDPHOTO: |
1229 |
case CMD_ADDREVOKER: |
case CMD_ADDREVOKER: |
1230 |
//case CMD_SETPREF: |
case CMD_SETPREF: |
1231 |
return 1; |
return 1; |
1232 |
} |
} |
1233 |
return 0; |
return 0; |
1238 |
static void |
static void |
1239 |
do_show_help (HWND dlg) |
do_show_help (HWND dlg) |
1240 |
{ |
{ |
1241 |
char helptext[2048]; |
const char *help; |
1242 |
|
|
1243 |
_snprintf (helptext, sizeof (helptext)-1, |
help = |
1244 |
_( |
_( |
1245 |
"ADDUID \t\tadd a user ID\r\n" |
"ADDUID add a user ID\r\n" |
1246 |
"ADDPHOTO \t\tadd a photo ID\r\n" |
"ADDPHOTO add a photo ID\r\n" |
1247 |
"DELUID \t\tdelete a user ID\r\n" |
"DELUID delete a user ID\r\n" |
1248 |
"ADDKEY \t\tadd a secondard key\r\n" |
"ADDKEY add a secondary key\r\n" |
1249 |
"DELKEY \t\tdelete a secondary key\r\n" |
"DELKEY delete a secondary key\r\n" |
1250 |
"ADDREVOKER\t\tadd a revocation key\r\n" |
"ADDREVOKER add a revocation key\r\n" |
1251 |
"EXPIRE \t\tchange the expire date\r\n" |
"EXPIRE change the expire date\r\n" |
1252 |
"SHOWPREF \t\tlist preferences (verbose)\r\n" |
"SHOWPREF list preferences (verbose)\r\n" |
1253 |
"SETPREF \t\tset preference list\r\n" |
"SETPREF set preference list\r\n" |
1254 |
"UPDPREF \t\tupdated preferences\r\n" |
"UPDPREF updated preferences\r\n" |
1255 |
"PASSWD \t\tchange the passphrase\r\n" |
"PASSWD change the passphrase\r\n" |
1256 |
"PRIMARY \t\tflag user ID as primary\r\n" |
"PRIMARY flag user ID as primary\r\n" |
1257 |
"TRUST \t\tchange the ownertrust\r\n" |
"TRUST change the ownertrust\r\n" |
1258 |
"REVUID \t\trevoke a user ID\r\n" |
"REVUID revoke a user ID\r\n" |
1259 |
"REVKEY \t\trevoke a secondary key\r\n" |
"REVKEY revoke a secondary key\r\n" |
1260 |
"DISABLE \t\tdisable a key\r\n" |
"DISABLE disable a key\r\n" |
1261 |
"ENABLE \t\tenable a key\r\n" |
"ENABLE enable a key\r\n" |
1262 |
"SIGN \t\tsign a user-id (exportable)\r\n" |
"SIGN sign a user-id (exportable)\r\n" |
1263 |
"LSIGN \t\tsign a user-id (non-exportable)\r\n" |
"LSIGN sign a user-id (non-exportable)\r\n" |
1264 |
"CLEAN \t\tremove unusable signatures from key\r\n" |
"CLEAN remove unusable signatures from key\r\n" |
1265 |
"MINIMIZE \t\tremove all signatures from key\r\n" |
"MINIMIZE remove all signatures from key\r\n" |
1266 |
)); |
); |
1267 |
msg_box (dlg, helptext, _("Key Edit Help"), MB_OK); |
msg_box (dlg, help, _("Key Edit Help"), MB_OK); |
1268 |
} |
} |
1269 |
|
|
1270 |
|
|
1273 |
{ |
{ |
1274 |
gpgme_error_t err; |
gpgme_error_t err; |
1275 |
GpgKeyEdit *ke; |
GpgKeyEdit *ke; |
1276 |
int j, id; |
int pos, id; |
1277 |
char tmp[64]; |
char tmp[64]; |
1278 |
|
|
1279 |
if (!k->key_pair) |
if (!k->key_pair) |
1280 |
return FALSE; /* XXX: shall we allow to modify non-secret keys?? */ |
return FALSE; |
1281 |
|
|
1282 |
if( listview_count_items( lv, 0 ) == 1 ) { |
if (listview_count_items (lv, 0) == 1) { |
1283 |
msg_box( dlg, _("Primary key can not be deleted!"), _("Key Edit"), MB_ERR); |
msg_box (dlg, _("Primary key can not be deleted!"), _("Key Edit"), MB_ERR); |
1284 |
return FALSE; |
return FALSE; |
1285 |
} |
} |
1286 |
if( (j = listview_get_curr_pos( lv )) == -1 ) { |
pos = listview_get_curr_pos (lv); |
1287 |
msg_box( dlg, _("Please select a key."), _("Key Edit"), MB_ERR ); |
if (pos == -1) { |
1288 |
|
msg_box (dlg, _("Please select a key."), _("Key Edit"), MB_ERR); |
1289 |
return FALSE; |
return FALSE; |
1290 |
} |
} |
1291 |
if( j == 0 ) { |
if (pos == 0) { |
1292 |
msg_box( dlg, _("Primary subkey can not be deleted!"), _("Key Edit"), MB_ERR ); |
msg_box (dlg, _("Primary key can not be deleted!"), _("Key Edit"), MB_ERR); |
1293 |
return FALSE; |
return FALSE; |
1294 |
} |
} |
1295 |
|
|
1296 |
/* XXX: change the warning to make clear that verification won't work |
/* XXX: change the warning to make clear that verification won't work |
1297 |
any longer if this is a sign-only key. */ |
any longer if this is a sign-only key. */ |
1298 |
listview_get_item_text (lv, j, 0, tmp, sizeof (tmp) -1); |
listview_get_item_text (lv, pos, 0, tmp, sizeof (tmp) -1); |
1299 |
id = log_box (_("Key Edit"), MB_YESNO|MB_ICONWARNING, |
id = log_box (_("Key Edit"), MB_YESNO|MB_ICONWARNING, |
1300 |
_("\"Subkey %s.\"\n\n" |
_("\"Subkey %s.\"\n\n" |
1301 |
"Anything encrypted to the selected subkey will no longer\n" |
"Anything encrypted to the selected subkey will no longer\n" |
1304 |
if (id == IDNO) |
if (id == IDNO) |
1305 |
return FALSE; |
return FALSE; |
1306 |
|
|
1307 |
ke = new GpgKeyEdit (k->keyid); |
ke = create_GpgKeyEdit (k->keyid); |
1308 |
if (!ke) |
err = ke->delKey (pos); |
|
BUG (NULL); |
|
|
err = ke->delKey (j); |
|
1309 |
if (err) |
if (err) |
1310 |
msg_box (dlg, gpgme_strerror (err), _("Delete Subkey"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Delete Subkey"), MB_ERR); |
1311 |
else { |
else { |
1312 |
listview_del_item (lv, j); |
listview_del_item (lv, pos); |
1313 |
k->update = 1; |
k->update = 1; |
1314 |
status_box (dlg, _("Subkey successfully deleted."), _("GnuPG status")); |
status_box (dlg, _("Subkey successfully deleted."), _("GnuPG status")); |
1315 |
} |
} |
1327 |
GpgKeyEdit *ke; |
GpgKeyEdit *ke; |
1328 |
date_s udd = {0}; |
date_s udd = {0}; |
1329 |
char buf[256], * pass = NULL; |
char buf[256], * pass = NULL; |
1330 |
int j, cancel = 0; |
time_t exp; |
1331 |
|
int pos, cancel = 0; |
1332 |
|
|
1333 |
if (!k->key_pair) { |
if (!k->key_pair) { |
1334 |
msg_box (dlg, _("There is no secret key available!"), _("Key Edit"), MB_ERR); |
msg_box (dlg, _("There is no secret key available!"), _("Key Edit"), MB_ERR); |
1335 |
return FALSE; |
return FALSE; |
1336 |
} |
} |
1337 |
if ((j = listview_get_curr_pos (lv)) == -1) { |
pos = listview_get_curr_pos (lv); |
1338 |
msg_box( dlg, _("Please select a key."), _("Key Edit"), MB_ERR ); |
if (pos == -1) { |
1339 |
|
msg_box (dlg, _("Please select a key."), _("Key Edit"), MB_ERR); |
1340 |
return FALSE; |
return FALSE; |
1341 |
} |
} |
1342 |
|
|
1343 |
/* If a key already expired, it is possible the user wants to |
/* If a key already expired, it is possible the user wants to |
1344 |
set a new expiration date.. */ |
set a new expiration date.. */ |
1345 |
listview_get_item_text (lv, j, SUBK_COL_STATUS, buf, sizeof buf -1); |
listview_get_item_text (lv, pos, SUBK_COL_STATUS, buf, sizeof (buf)-1); |
1346 |
if (!strcmp (buf, _("Expired"))) { |
if (!strcmp (buf, _("Expired"))) { |
1347 |
cancel = msg_box (dlg, _("Key already expired.\n\n" |
cancel = msg_box (dlg, _("Key already expired.\n\n" |
1348 |
"Do you want to change the expiration date?"), |
"Do you want to change the expiration date?"), |
1360 |
if (udd.cancel == 1) |
if (udd.cancel == 1) |
1361 |
return FALSE; |
return FALSE; |
1362 |
if (!keygen_check_date (&udd.st)) { |
if (!keygen_check_date (&udd.st)) { |
1363 |
msg_box (dlg, _("The date you have chosen lies in the past."), |
msg_box (dlg, _("The date you have chosen has already passed."), |
1364 |
_("Key Edit"), MB_ERR); |
_("Key Edit"), MB_ERR); |
1365 |
return FALSE; |
return FALSE; |
1366 |
} |
} |
1367 |
if( k->is_protected ) { |
if (k->is_protected) { |
1368 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
1369 |
if (cancel) |
if (cancel) |
1370 |
return FALSE; |
return FALSE; |
1371 |
} |
} |
1372 |
|
exp = w32_mktime (&udd.st); |
1373 |
ke = new GpgKeyEdit (k->keyid); |
ke = create_GpgKeyEdit (k->keyid); |
|
if (!ke) |
|
|
BUG (NULL); |
|
1374 |
if (k->is_protected) |
if (k->is_protected) |
1375 |
ke->setPassphrase (pass); |
ke->setPassphrase (pass); |
1376 |
else |
else |
1377 |
ke->setNoPassphrase (true); |
ke->setNoPassphrase (true); |
1378 |
err = ke->setKeyExpireDate (j, w32_mktime (&udd.st), false); |
err = ke->setKeyExpireDate (pos, exp, false); |
1379 |
if (err) |
if (err) |
1380 |
msg_box (dlg, gpgme_strerror (err), _("Expire Subkey"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Expire Subkey"), MB_ERR); |
1381 |
else { |
else { |
1382 |
_snprintf (buf, sizeof buf - 1, "%04d-%02d-%02d", |
_snprintf (buf, sizeof (buf)-1, "%s", get_key_created (exp)); |
1383 |
udd.st.wYear, udd.st.wMonth, udd.st.wDay); |
listview_add_sub_item (lv, pos, SUBK_COL_EXPIRES, buf); |
|
listview_add_sub_item (lv, j, SUBK_COL_EXPIRES, buf); |
|
1384 |
k->update = 1; |
k->update = 1; |
1385 |
msg_box (dlg, _("Subkey expire date successfully set."), |
msg_box (dlg, _("Subkey expire date successfully set."), |
1386 |
_("GnuPG status"), MB_OK); |
_("GnuPG status"), MB_OK); |
1427 |
} |
} |
1428 |
|
|
1429 |
if (k->is_protected) { |
if (k->is_protected) { |
1430 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
1431 |
if (cancel) |
if (cancel) |
1432 |
return FALSE; |
return FALSE; |
1433 |
} |
} |
1434 |
|
|
1435 |
ke = new GpgKeyEdit (k->keyid); |
ke = create_GpgKeyEdit (k->keyid); |
|
if (!ke) |
|
|
BUG (NULL); |
|
1436 |
if (k->is_protected) |
if (k->is_protected) |
1437 |
ke->setPassphrase (pass); |
ke->setPassphrase (pass); |
1438 |
else |
else |
1492 |
if (msg_box (dlg, inf, _("Key Edit"), MB_WARN_ASK) == IDNO) |
if (msg_box (dlg, inf, _("Key Edit"), MB_WARN_ASK) == IDNO) |
1493 |
return FALSE; |
return FALSE; |
1494 |
if (k->is_protected) { |
if (k->is_protected) { |
1495 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
1496 |
if (cancel) |
if (cancel) |
1497 |
return FALSE; |
return FALSE; |
1498 |
} |
} |
1502 |
if (id == -1) |
if (id == -1) |
1503 |
BUG (NULL); |
BUG (NULL); |
1504 |
|
|
1505 |
ke = new GpgKeyEdit (k->keyid); |
ke = create_GpgKeyEdit (k->keyid); |
|
if (!ke) |
|
|
BUG (NULL); |
|
1506 |
if (k->is_protected) |
if (k->is_protected) |
1507 |
ke->setPassphrase (pass); |
ke->setPassphrase (pass); |
1508 |
else |
else |
1524 |
static int |
static int |
1525 |
do_editkey_setpref (winpt_key_t k, HWND dlg, listview_ctrl_t lv) |
do_editkey_setpref (winpt_key_t k, HWND dlg, listview_ctrl_t lv) |
1526 |
{ |
{ |
1527 |
gpgme_error_t rc; |
gpgme_error_t err; |
1528 |
GpgKeyEdit *ke; |
GpgKeyEdit *ke; |
1529 |
char buf[256], * pass = NULL, * prefs; |
gpg_uid_info_t uidinf = NULL; |
1530 |
int j, id, cancel=0, flags=0; |
char buf[256], *pass = NULL, *prefs = NULL; |
1531 |
|
int pos, id, cancel=0, flags=0; |
1532 |
|
|
1533 |
if ((j = listview_get_curr_pos (lv)) == -1) { |
pos = listview_get_curr_pos (lv); |
1534 |
|
if (pos == -1) { |
1535 |
msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR); |
msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR); |
1536 |
return FALSE; |
return FALSE; |
1537 |
} |
} |
1538 |
listview_get_item_text (lv, j, 2, buf, sizeof buf-1); |
listview_get_item_text (lv, pos, 2, buf, sizeof buf-1); |
1539 |
id = do_find_userid (k->keyid, buf, NULL, NULL); |
id = do_find_userid (k->keyid, buf, NULL, &uidinf); |
1540 |
if (id == -1) |
if (id == -1) |
1541 |
BUG (dlg); |
BUG (NULL); |
1542 |
if (k->is_protected) { |
if (k->is_protected) { |
1543 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
1544 |
|
gpg_uid_info_release (uidinf); |
1545 |
if (cancel) |
if (cancel) |
1546 |
return FALSE; |
return FALSE; |
1547 |
} |
} |
1548 |
|
|
1549 |
ke = new GpgKeyEdit (k->keyid); |
get_userid_preflist (uidinf->prefs, &prefs, &flags); |
1550 |
if (!ke) |
gpg_uid_info_release (uidinf); |
1551 |
BUG (NULL); |
if (!prefs) { |
1552 |
|
sfree_if_alloc (pass); |
1553 |
|
return FALSE; |
1554 |
|
} |
1555 |
|
|
1556 |
|
ke = create_GpgKeyEdit (k->keyid); |
1557 |
if (k->is_protected) |
if (k->is_protected) |
1558 |
ke->setPassphrase (pass); |
ke->setPassphrase (pass); |
1559 |
else |
else |
1560 |
ke->setNoPassphrase (true); |
ke->setNoPassphrase (true); |
1561 |
|
err = ke->setUseridPreferences (id, prefs); |
1562 |
get_userid_preflist (&prefs, &flags); |
if (err) |
1563 |
|
msg_box (dlg, gpgme_strerror (err), _("Set user ID preferences"), MB_ERR); |
1564 |
rc = ke->setUseridPreferences (id, prefs); |
else { |
1565 |
if (rc) |
k->update = 1; |
1566 |
msg_box (dlg, _("Could not set user ID preferences"), _("Key Edit"), MB_ERR); |
status_box (dlg, _("User ID preferences successfully updated"), _("GnuPG Status")); |
1567 |
|
} |
1568 |
|
|
1569 |
sfree_if_alloc (pass); |
sfree_if_alloc (pass); |
1570 |
free_if_alloc (prefs); |
free_if_alloc (prefs); |
1571 |
delete ke; |
delete ke; |
1572 |
return 0; |
return err? FALSE: TRUE; |
1573 |
} |
} |
1574 |
|
|
1575 |
|
|
1579 |
gpgme_error_t err; |
gpgme_error_t err; |
1580 |
GpgKeyEdit *ke; |
GpgKeyEdit *ke; |
1581 |
int j, id, cancel=0; |
int j, id, cancel=0; |
1582 |
|
char valid[32]; |
1583 |
char buf[256], *pass = NULL; |
char buf[256], *pass = NULL; |
1584 |
|
|
1585 |
if (listview_count_items (lv, 0) == 1) |
if (listview_count_items (lv, 0) == 1) |
1586 |
return TRUE; |
return TRUE; |
1587 |
if ((j = listview_get_curr_pos (lv)) == -1) { |
if ((j = listview_get_curr_pos (lv)) == -1) { |
1588 |
msg_box( dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR ); |
msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR); |
1589 |
return FALSE; |
return FALSE; |
1590 |
} |
} |
1591 |
listview_get_item_text (lv, j, 2, buf, sizeof buf-1); |
listview_get_item_text (lv, j, UID_COL_VALID, valid, sizeof (valid)-1); |
1592 |
|
if (!strcmp (valid, _("Revoked"))) |
1593 |
|
return FALSE; |
1594 |
|
listview_get_item_text (lv, j, UID_COL_EMAIL, buf, sizeof (buf)-1); |
1595 |
id = do_find_userid (k->keyid, buf, NULL, NULL); |
id = do_find_userid (k->keyid, buf, NULL, NULL); |
1596 |
if (id == -1) |
if (id == -1) |
1597 |
BUG (0); |
BUG (NULL); |
1598 |
if (k->is_protected) { |
if (k->is_protected) { |
1599 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel); |
1600 |
if (cancel) |
if (cancel) |
1601 |
return FALSE; |
return FALSE; |
1602 |
} |
} |
1603 |
|
|
1604 |
ke = new GpgKeyEdit (k->keyid); |
ke = create_GpgKeyEdit (k->keyid); |
1605 |
if (k->is_protected) |
if (k->is_protected) |
1606 |
ke->setPassphrase (pass); |
ke->setPassphrase (pass); |
1607 |
else |
else |
1714 |
SetDlgItemText (dlg, IDC_SHOWPREF_UIDHINT, _("user ID:")); |
SetDlgItemText (dlg, IDC_SHOWPREF_UIDHINT, _("user ID:")); |
1715 |
SetWindowText (dlg, _("Key Preferences")); |
SetWindowText (dlg, _("Key Preferences")); |
1716 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
1717 |
|
center_window (dlg, cb->parent); |
1718 |
break; |
break; |
1719 |
|
|
1720 |
case WM_COMMAND: |
case WM_COMMAND: |
1747 |
return FALSE; |
return FALSE; |
1748 |
} |
} |
1749 |
memset (&cb, 0, sizeof (cb)); |
memset (&cb, 0, sizeof (cb)); |
1750 |
|
cb.parent = dlg; |
1751 |
cb.opaque = k->ctx; |
cb.opaque = k->ctx; |
1752 |
cb.keyid = k->keyid; |
cb.keyid = k->keyid; |
1753 |
cb.lv = lv; |
cb.lv = lv; |
1771 |
GpgKeyEdit *ke; |
GpgKeyEdit *ke; |
1772 |
char email[128], name[128]; |
char email[128], name[128]; |
1773 |
char inf[384]; |
char inf[384]; |
1774 |
int j, id = 0; |
int pos, id = 0; |
1775 |
|
|
1776 |
if (!k->key_pair) |
if (!k->key_pair) |
1777 |
return FALSE; /* XXX: see do_editkey_delsubkey */ |
return FALSE; |
1778 |
|
|
1779 |
if (listview_count_items (lv, 0) == 1) { |
if (listview_count_items (lv, 0) == 1) { |
1780 |
msg_box (dlg, _("Primary user ID can not be deleted!"), |
msg_box (dlg, _("Primary user ID can not be deleted!"), |
1781 |
_("Key Edit"), MB_ERR); |
_("Key Edit"), MB_ERR); |
1782 |
return FALSE; |
return FALSE; |
1783 |
} |
} |
1784 |
if ((j = listview_get_curr_pos (lv)) == -1) { |
pos = listview_get_curr_pos (lv); |
1785 |
|
if (pos == -1) { |
1786 |
msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR); |
msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR); |
1787 |
return FALSE; |
return FALSE; |
1788 |
} |
} |
1789 |
|
|
1790 |
/* XXX: add a hint that also all signatures will be deleted? */ |
listview_get_item_text (lv, pos, UID_COL_NAME, name, DIM(name) -1); |
|
listview_get_item_text (lv, j, UID_COL_NAME, name, DIM(name) -1); |
|
1791 |
_snprintf (inf, DIM (inf)-1, _("user ID \"%s\".\n\n" |
_snprintf (inf, DIM (inf)-1, _("user ID \"%s\".\n\n" |
1792 |
"All signatures on this user ID will be also deleted." |
"All signatures on this user ID will be also deleted." |
1793 |
"\n\n" |
"\n\n" |
1796 |
if (msg_box (dlg, inf, _("Key Edit"), MB_YESNO|MB_ICONWARNING) == IDNO) |
if (msg_box (dlg, inf, _("Key Edit"), MB_YESNO|MB_ICONWARNING) == IDNO) |
1797 |
return FALSE; |
return FALSE; |
1798 |
|
|
1799 |
listview_get_item_text (lv, j, UID_COL_EMAIL, email, DIM (email)-1); |
listview_get_item_text (lv, pos, UID_COL_EMAIL, email, DIM (email)-1); |
1800 |
listview_get_item_text (lv, j, UID_COL_NAME, name, DIM (name)-1); |
listview_get_item_text (lv, pos, UID_COL_NAME, name, DIM (name)-1); |
1801 |
id = do_find_userid (k->keyid, email, name, NULL); |
id = do_find_userid (k->keyid, email, name, NULL); |
1802 |
if (id == -1) |
if (id == -1) |
|
BUG (dlg); |
|
|
|
|
|
ke = new GpgKeyEdit (k->keyid); |
|
|
if (!ke) |
|
1803 |
BUG (NULL); |
BUG (NULL); |
1804 |
|
|
1805 |
|
ke = create_GpgKeyEdit (k->keyid); |
1806 |
err = ke->delUserid (id); |
err = ke->delUserid (id); |
1807 |
if (err) |
if (err) |
1808 |
msg_box (dlg, gpgme_strerror (err), _("Delete user ID"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Delete User ID"), MB_ERR); |
1809 |
else { |
else { |
1810 |
listview_del_item (lv, j); |
listview_del_item (lv, pos); |
1811 |
k->update = 1; |
k->update = 1; |
1812 |
status_box (dlg, _("User ID successfully deleted"), _("GnuPG Status")); |
status_box (dlg, _("User ID successfully deleted"), _("GnuPG Status")); |
1813 |
} |
} |
1889 |
} |
} |
1890 |
|
|
1891 |
|
|
|
/* Return default secret key. */ |
|
|
static gpgme_key_t |
|
|
get_default_key (void) |
|
|
{ |
|
|
gpgme_key_t def_sk; |
|
|
char *keyid = get_gnupg_default_key (); |
|
|
|
|
|
get_seckey (keyid, &def_sk); |
|
|
free_if_alloc (keyid); |
|
|
return def_sk; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
1892 |
static void |
static void |
1893 |
do_editkey_minimize (winpt_key_t k, HWND dlg) |
do_editkey_minimize (winpt_key_t k, HWND dlg) |
1894 |
{ |
{ |
1943 |
do_editkey_sign_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv, int mode) |
do_editkey_sign_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv, int mode) |
1944 |
{ |
{ |
1945 |
gpgme_error_t err; |
gpgme_error_t err; |
1946 |
|
winpt_key_s signer; |
1947 |
GpgKeyEdit *ke; |
GpgKeyEdit *ke; |
1948 |
char *pass = NULL; |
char *pass = NULL; |
1949 |
char email[64], name[128]; |
char *defkey; |
1950 |
|
char email[64], name[128], valid[32]; |
1951 |
int uid_index; |
int uid_index; |
1952 |
int cancel = 0; |
int cancel = 0; |
1953 |
|
|
1956 |
msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR); |
msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR); |
1957 |
return FALSE; |
return FALSE; |
1958 |
} |
} |
1959 |
|
listview_get_item_text (lv, uid_index, UID_COL_VALID, valid, sizeof (valid)-1); |
1960 |
|
if (!strcmp (valid, _("Revoked"))) |
1961 |
|
return TRUE; |
1962 |
if (mode == CMD_SIGN) { |
if (mode == CMD_SIGN) { |
1963 |
cancel = msg_box (dlg, _("Do you really want to make this sig exportable?"), |
cancel = msg_box (dlg, _("Do you really want to make this sig exportable?"), |
1964 |
_("Key Edit"), MB_QUEST_ASK); |
_("Key Edit"), MB_QUEST_ASK); |
1965 |
if (cancel == IDNO) |
if (cancel == IDNO) |
1966 |
return FALSE; |
return FALSE; |
1967 |
} |
} |
|
|
|
1968 |
listview_get_item_text (lv, uid_index, UID_COL_EMAIL, email, sizeof (email)-1); |
listview_get_item_text (lv, uid_index, UID_COL_EMAIL, email, sizeof (email)-1); |
1969 |
listview_get_item_text (lv, uid_index, UID_COL_NAME, name, sizeof (name)-1); |
listview_get_item_text (lv, uid_index, UID_COL_NAME, name, sizeof (name)-1); |
1970 |
uid_index = do_find_userid (k->keyid, email, name, NULL); |
uid_index = do_find_userid (k->keyid, email, name, NULL); |
1971 |
if (k->is_protected) { |
|
1972 |
pass = request_passphrase (_("Key Edit"), 1, &cancel); |
defkey = get_gnupg_default_key (); |
1973 |
|
memset (&signer, 0, sizeof (signer)); |
1974 |
|
if (winpt_get_seckey (defkey, &signer)) { |
1975 |
|
log_debug ("do_editkey_sign_userid: no default secret key.\r\n"); |
1976 |
|
free_if_alloc (defkey); |
1977 |
|
return FALSE; |
1978 |
|
} |
1979 |
|
if (signer.is_protected) { |
1980 |
|
pass = request_key_passphrase (signer.ctx, _("Key Edit"), &cancel); |
1981 |
if (cancel) |
if (cancel) |
1982 |
return FALSE; |
return FALSE; |
1983 |
} |
} |
1984 |
ke = create_GpgKeyEdit (k->keyid); |
ke = create_GpgKeyEdit (k->keyid); |
1985 |
if (k->is_protected) |
if (signer.is_protected) |
1986 |
ke->setPassphrase (pass); |
ke->setPassphrase (pass); |
1987 |
else |
else |
1988 |
ke->setNoPassphrase (true); |
ke->setNoPassphrase (true); |
1989 |
ke->setLocalUser (get_default_key ()); |
ke->setLocalUser (signer.ctx); |
1990 |
err = ke->signUserid (uid_index, |
err = ke->signUserid (uid_index, |
1991 |
mode == CMD_SIGN? GPG_EDITKEY_SIGN : GPG_EDITKEY_LSIGN, |
mode == CMD_SIGN? GPG_EDITKEY_SIGN : GPG_EDITKEY_LSIGN, |
1992 |
0, NULL); |
0, NULL); |
2057 |
warn = _("Your keys is listed as a designated revoker for the key\n\n" |
warn = _("Your keys is listed as a designated revoker for the key\n\n" |
2058 |
"%s\n\n" |
"%s\n\n" |
2059 |
"Are you sure you want to create a revocation certificate\n" |
"Are you sure you want to create a revocation certificate\n" |
2060 |
"which allow to revoke the key listed above?"); |
"which allows you to revoke the key listed above?"); |
2061 |
p = new char[strlen (inf)+1+strlen (warn)+1]; |
p = new char[strlen (inf)+1+strlen (warn)+1]; |
2062 |
sprintf (p, warn, inf); |
sprintf (p, warn, inf); |
2063 |
free_if_alloc (inf); |
free_if_alloc (inf); |
2073 |
} |
} |
2074 |
|
|
2075 |
|
|
2076 |
|
/* Create tooltip control for the listview header. */ |
2077 |
|
static HWND |
2078 |
|
create_header_tooltip (HWND dlg) |
2079 |
|
{ |
2080 |
|
TOOLINFO ti; |
2081 |
|
HWND tt; |
2082 |
|
|
2083 |
|
tt = CreateWindow (TOOLTIPS_CLASS, (LPSTR) NULL, TTS_ALWAYSTIP, |
2084 |
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
2085 |
|
CW_USEDEFAULT, |
2086 |
|
NULL, (HMENU) NULL, glob_hinst, NULL); |
2087 |
|
if (!tt) |
2088 |
|
BUG (NULL); |
2089 |
|
memset (&ti, 0, sizeof (ti)); |
2090 |
|
ti.cbSize = sizeof(TOOLINFO); |
2091 |
|
ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS; |
2092 |
|
ti.hwnd = dlg; |
2093 |
|
ti.uId = (UINT) ListView_GetHeader (GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST)); |
2094 |
|
ti.hinst = 0; |
2095 |
|
ti.lpszText = (char*)_("Capabilties: C = Certify, S = Sign, E = Encrypt, A = Authenticate"); |
2096 |
|
SendMessage(tt, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); |
2097 |
|
return tt; |
2098 |
|
} |
2099 |
|
|
2100 |
|
|
2101 |
/* Dialog box procedure for the edit key dialog. */ |
/* Dialog box procedure for the edit key dialog. */ |
2102 |
BOOL CALLBACK |
BOOL CALLBACK |
2103 |
keyedit_main_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
keyedit_main_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
2104 |
{ |
{ |
2105 |
static winpt_key_t k; |
static winpt_key_t k; |
2106 |
static listview_ctrl_t lvsub = NULL, lvuid = NULL; |
static listview_ctrl_t lvsub = NULL, lvuid = NULL; |
2107 |
|
static HWND tt; |
2108 |
int cmd; |
int cmd; |
2109 |
HWND item; |
HWND item; |
2110 |
|
|
2115 |
BUG (NULL); |
BUG (NULL); |
2116 |
do_init_cmdlist (dlg, k->key_pair); |
do_init_cmdlist (dlg, k->key_pair); |
2117 |
lvsub = subkey_list_init (dlg, k); |
lvsub = subkey_list_init (dlg, k); |
|
if (!lvsub) |
|
|
BUG (0); |
|
2118 |
lvuid = userid_list_init (dlg, k); |
lvuid = userid_list_init (dlg, k); |
|
if (!lvuid) |
|
|
BUG (0); |
|
2119 |
item = GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST); |
item = GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST); |
2120 |
keyedit_subkey_proc.opaque = (void*)k; |
keyedit_subkey_proc.opaque = (void*)k; |
2121 |
keyedit_subkey_proc.dlg = dlg; |
keyedit_subkey_proc.dlg = dlg; |
2122 |
keyedit_subkey_proc.current = (WNDPROC)subkey_subclass_proc; |
keyedit_subkey_proc.current = (WNDPROC)subkey_subclass_proc; |
2123 |
keyedit_subkey_proc.old = (WNDPROC)GetWindowLong (item, GWL_WNDPROC); |
keyedit_subkey_proc.old = (WNDPROC)GetWindowLong (item, GWL_WNDPROC); |
2124 |
if (keyedit_subkey_proc.old) { |
if (keyedit_subkey_proc.old) { |
2125 |
if( !SetWindowLong (item, GWL_WNDPROC, |
if (!SetWindowLong (item, GWL_WNDPROC, |
2126 |
(LONG)keyedit_subkey_proc.current)) { |
(LONG)keyedit_subkey_proc.current)) { |
2127 |
msg_box (dlg, _("Could not set subkey window procedure."), |
msg_box (dlg, "Could not set subkey window procedure.", |
2128 |
_("Key Edit"), MB_ERR); |
_("Key Edit"), MB_ERR); |
2129 |
BUG (0); |
BUG (NULL); |
2130 |
} |
} |
2131 |
} |
} |
2132 |
|
tt = create_header_tooltip (dlg); |
2133 |
item = GetDlgItem (dlg, IDC_KEYEDIT_UIDLIST); |
item = GetDlgItem (dlg, IDC_KEYEDIT_UIDLIST); |
2134 |
keyedit_uid_proc.opaque = (void*)k; |
keyedit_uid_proc.opaque = (void*)k; |
2135 |
keyedit_uid_proc.dlg = dlg; |
keyedit_uid_proc.dlg = dlg; |
2138 |
if (keyedit_uid_proc.old) { |
if (keyedit_uid_proc.old) { |
2139 |
if (!SetWindowLong (item, GWL_WNDPROC, |
if (!SetWindowLong (item, GWL_WNDPROC, |
2140 |
(LONG)keyedit_uid_proc.current)) { |
(LONG)keyedit_uid_proc.current)) { |
2141 |
msg_box (dlg, _("Could not set user ID window procedure."), |
msg_box (dlg, "Could not set user ID window procedure.", |
2142 |
_("Key Edit"), MB_ERR); |
_("Key Edit"), MB_ERR); |
2143 |
BUG (0); |
BUG (NULL); |
2144 |
} |
} |
2145 |
} |
} |
2146 |
if (k->ctx->revoked) { |
if (k->ctx->revoked) { |
2151 |
SetDlgItemText (dlg, IDCANCEL, _("&Close")); |
SetDlgItemText (dlg, IDCANCEL, _("&Close")); |
2152 |
SetDlgItemText (dlg, IDC_KEYEDIT_HELP, _("&Help")); |
SetDlgItemText (dlg, IDC_KEYEDIT_HELP, _("&Help")); |
2153 |
SetDlgItemText (dlg, IDC_KEYEDIT_REVOKE, _("&Revoke...")); |
SetDlgItemText (dlg, IDC_KEYEDIT_REVOKE, _("&Revoke...")); |
2154 |
|
SetDlgItemText (dlg, IDOK, _("&OK")); |
2155 |
if (!check_desig_rev (k)) |
if (!check_desig_rev (k)) |
2156 |
ShowWindow (GetDlgItem (dlg, IDC_KEYEDIT_REVOKE), SW_HIDE); |
ShowWindow (GetDlgItem (dlg, IDC_KEYEDIT_REVOKE), SW_HIDE); |
2157 |
SetWindowText (dlg, _("Key Edit")); |
SetWindowText (dlg, _("Key Edit")); |
2171 |
break; |
break; |
2172 |
|
|
2173 |
case WM_NOTIFY: |
case WM_NOTIFY: |
2174 |
NMHDR * notify; |
NMHDR *notify; |
2175 |
notify = (NMHDR *)lparam; |
notify = (NMHDR *)lparam; |
2176 |
if (notify && notify->code == NM_DBLCLK && |
if (!notify || notify->idFrom != IDC_KEYEDIT_UIDLIST) |
2177 |
notify->idFrom == IDC_KEYEDIT_UIDLIST) |
break; |
2178 |
|
if (notify->code == NM_DBLCLK) |
2179 |
do_editkey_showpref (k, dlg, lvuid); |
do_editkey_showpref (k, dlg, lvuid); |
2180 |
|
else if (notify->code == NM_RCLICK && k->key_pair) { |
2181 |
|
HMENU hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT_KEYEDIT)); |
2182 |
|
HMENU popup = GetSubMenu (hm, 0); |
2183 |
|
POINT p; |
2184 |
|
|
2185 |
|
GetCursorPos (&p); |
2186 |
|
TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, dlg, NULL); |
2187 |
|
DestroyMenu (hm); |
2188 |
|
DestroyMenu (popup); |
2189 |
|
} |
2190 |
break; |
break; |
2191 |
|
|
2192 |
case WM_COMMAND: |
case WM_COMMAND: |
2193 |
switch( LOWORD( wparam ) ) { |
switch (LOWORD (wparam)) { |
2194 |
case IDOK: |
case IDOK: |
2195 |
cmd = lookup_cmd (dlg); |
cmd = lookup_cmd (dlg); |
2196 |
if (cmd == LB_ERR) { |
if (cmd == LB_ERR) { |
2208 |
case CMD_ADDKEY: keyedit_add_subkey (k, dlg, lvsub); break; |
case CMD_ADDKEY: keyedit_add_subkey (k, dlg, lvsub); break; |
2209 |
case CMD_EXPIRE: do_editkey_expire (k, dlg, lvsub); break; |
case CMD_EXPIRE: do_editkey_expire (k, dlg, lvsub); break; |
2210 |
case CMD_REVKEY: do_editkey_revoke (k, dlg, lvsub); break; |
case CMD_REVKEY: do_editkey_revoke (k, dlg, lvsub); break; |
2211 |
/*case CMD_SETPREF:do_editkey_setpref( k, dlg, lvuid ); break;*/ |
case CMD_SETPREF:/*do_editkey_setpref (k, dlg, lvuid);*/ break; |
2212 |
case CMD_ADDUID: keyedit_add_userid( k, dlg, lvuid ); break; |
case CMD_ADDUID: keyedit_add_userid( k, dlg, lvuid ); break; |
2213 |
case CMD_ADDREVOKER: keyedit_add_revoker( k, dlg ); break; |
case CMD_ADDREVOKER: keyedit_add_revoker( k, dlg ); break; |
2214 |
case CMD_ADDPHOTO: keyedit_add_photo( k, dlg ); break; |
case CMD_ADDPHOTO: keyedit_add_photo( k, dlg ); break; |
2224 |
case CMD_LSIGN: do_editkey_sign_userid (k, dlg, |
case CMD_LSIGN: do_editkey_sign_userid (k, dlg, |
2225 |
lvuid, cmd); |
lvuid, cmd); |
2226 |
break; |
break; |
2227 |
case CMD_CLEAN: do_editkey_clean (k, dlg); |
case CMD_CLEAN: do_editkey_clean (k, dlg); break; |
2228 |
case CMD_MINIMIZE: do_editkey_minimize (k, dlg); |
case CMD_MINIMIZE: do_editkey_minimize (k, dlg); break; |
2229 |
} |
} |
2230 |
break; |
break; |
2231 |
|
|
2232 |
case IDCANCEL: |
case IDCANCEL: |
2233 |
EndDialog (dlg, FALSE); |
EndDialog (dlg, FALSE); |
2234 |
break; |
break; |
2240 |
case IDC_KEYEDIT_REVOKE: |
case IDC_KEYEDIT_REVOKE: |
2241 |
gen_desig_revoke_cert (k, dlg); |
gen_desig_revoke_cert (k, dlg); |
2242 |
break; |
break; |
2243 |
|
|
2244 |
|
case ID_KEYEDIT_UID_PRIM: |
2245 |
|
do_editkey_primary (k, dlg, lvuid); |
2246 |
|
break; |
2247 |
|
|
2248 |
|
case ID_KEYEDIT_UID_DEL: |
2249 |
|
do_editkey_deluid (k, dlg, lvuid); |
2250 |
|
break; |
2251 |
|
|
2252 |
|
case ID_KEYEDIT_UID_REV: |
2253 |
|
do_editkey_revuid (k, dlg, lvuid); |
2254 |
|
break; |
2255 |
} |
} |
2256 |
break; |
break; |
2257 |
} |
} |