1046 |
} |
} |
1047 |
new_pass = request_passphrase2 (_("New Passphrase" ), 1, &cancel); |
new_pass = request_passphrase2 (_("New Passphrase" ), 1, &cancel); |
1048 |
if (cancel) { |
if (cancel) { |
1049 |
free_if_alloc (old_pass); |
sfree_if_alloc (old_pass); |
1050 |
return FALSE; |
return FALSE; |
1051 |
} |
} |
1052 |
|
|
1053 |
|
if (strlen (new_pass) == 0) { |
1054 |
|
cancel = msg_box (dlg, _("Are you sure that you really don't want a passphrase?\n" |
1055 |
|
"This is propably a bad idea, still proceed?"), |
1056 |
|
_("Key Edit"), MB_WARN_ASK); |
1057 |
|
if (cancel != IDYES) { |
1058 |
|
sfree_if_alloc (old_pass); |
1059 |
|
sfree_if_alloc (new_pass); |
1060 |
|
return FALSE; |
1061 |
|
} |
1062 |
|
} |
1063 |
|
|
1064 |
if (is_8bit_string (new_pass)) { |
if (is_8bit_string (new_pass)) { |
1065 |
msg_box (dlg, _("The passphrase contains 8-bit characters.\n" |
msg_box (dlg, _("The passphrase contains 8-bit characters.\n" |
1066 |
"It is not suggested to use charset specific characters."), |
"It is not suggested to use charset specific characters."), |
1067 |
_("Key Edit"), MB_ERR); |
_("Key Edit"), MB_ERR); |
1068 |
free_if_alloc (old_pass); |
sfree_if_alloc (old_pass); |
1069 |
free_if_alloc (new_pass); |
sfree_if_alloc (new_pass); |
1070 |
return FALSE; |
return FALSE; |
1071 |
} |
} |
1072 |
|
|
1073 |
ke = create_GpgKeyEdit (k->keyid); |
ke = create_GpgKeyEdit (k->keyid); |
1074 |
ke->setPassphrase (k->is_protected? old_pass : NULL); |
ke->setPassphrase (k->is_protected? old_pass : NULL); |
1075 |
err = ke->changePassphrase (new_pass, 0); |
if (!k->is_protected) |
1076 |
|
ke->setNoPassphrase (true); |
1077 |
|
err = ke->changePassphrase (new_pass, 1); |
1078 |
if (err) |
if (err) |
1079 |
msg_box (dlg, gpgme_strerror (err), _("Change Passwd"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Change Passwd"), MB_ERR); |
1080 |
else |
else |