352 |
|
|
353 |
case IDC_ADDPHOTO_SELFILE: |
case IDC_ADDPHOTO_SELFILE: |
354 |
s = get_fileopen_dlg (dlg, _("Select Image File"), |
s = get_fileopen_dlg (dlg, _("Select Image File"), |
355 |
_("JPEG Files (*.jpg, *.jpeg)\0*.jpg;*.jpeg\0\0"), |
"JPEG Files (*.jpg, *.jpeg)\0*.jpg;*.jpeg\0\0", |
356 |
NULL); |
NULL); |
357 |
if (s && !is_jpg_file (s)) { |
if (s && !is_jpg_file (s)) { |
358 |
log_box (_("Add Photo"), MB_ERR, |
log_box (_("Add Photo"), MB_ERR, |
892 |
keyedit_add_photo (winpt_key_t k, HWND dlg) |
keyedit_add_photo (winpt_key_t k, HWND dlg) |
893 |
{ |
{ |
894 |
if (!k->key_pair) { |
if (!k->key_pair) { |
895 |
msg_box (dlg, _("There is no secret key available!"), _("Add Photo"), MB_ERR); |
msg_box (dlg, _("There is no secret key available!"), |
896 |
|
_("Add Photo"), MB_ERR); |
897 |
return FALSE; |
return FALSE; |
898 |
} |
} |
899 |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYEDIT_ADDPHOTO, dlg, |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYEDIT_ADDPHOTO, dlg, |
935 |
} |
} |
936 |
|
|
937 |
|
|
938 |
|
/* Check if the given key is supposed to have IDEA |
939 |
|
for secret key protection. */ |
940 |
static int |
static int |
941 |
is_idea_protect_algo (const char * keyid) |
is_idea_protect_algo (const char *keyid) |
942 |
{ |
{ |
943 |
winpt_key_s k; |
winpt_key_s k; |
944 |
const unsigned char *sym_prefs; |
const unsigned char *sym_prefs; |
946 |
|
|
947 |
memset (&k, 0, sizeof (k)); |
memset (&k, 0, sizeof (k)); |
948 |
if (winpt_get_pubkey (keyid, &k)) |
if (winpt_get_pubkey (keyid, &k)) |
949 |
BUG (NULL); |
BUG (0); |
950 |
sym_prefs = k.ext->sym_prefs; |
sym_prefs = k.ext->sym_prefs; |
951 |
|
if (!k.is_v3) |
952 |
|
return 0; |
953 |
if (!sym_prefs) |
if (!sym_prefs) |
954 |
return 1; /* assume that only v3 keys have no symmetric cipher preferences |
return 1; /* assume that only v3 keys have no symmetric cipher preferences |
955 |
and thus IDEA is explicit. */ |
and thus IDEA is explicit. */ |
958 |
if ((n == 0 || n == 1) && *sym_prefs == 0x01) |
if ((n == 0 || n == 1) && *sym_prefs == 0x01) |
959 |
return 1; |
return 1; |
960 |
return 0; |
return 0; |
961 |
} /* is_idea_protect_algo */ |
} |
962 |
|
|
963 |
|
|
964 |
BOOL |
BOOL |
976 |
return FALSE; |
return FALSE; |
977 |
} |
} |
978 |
|
|
979 |
if( !idea_available && is_idea_protect_algo( k->keyid ) ) { |
if (!idea_available && is_idea_protect_algo (k->keyid)) { |
980 |
msg_box( dlg, _("Cannot change passphrase because the key\n" |
msg_box (dlg, _("Cannot change passphrase because the key\n" |
981 |
"is protected with the IDEA encryption algorithm."), |
"is protected with the IDEA encryption algorithm."), |
982 |
_("Key Edit"), MB_ERR ); |
_("Key Edit"), MB_ERR); |
983 |
return FALSE; |
return FALSE; |
984 |
} |
} |
985 |
|
|