Use old passwords decryption for protocols < 4

This commit is contained in:
Grégory Soutadé 2017-04-17 20:39:53 +02:00
parent 6dfcab813d
commit 416a4d9581

View File

@ -175,7 +175,7 @@ async function ask_server(form, field, logins, domain, wdomain, mkey, submit)
case 3:
// Version 3 : nothing special to do
case 4:
// Version 3 : nothing special to do
// Version 4 : nothing special to do
break;
}
}
@ -216,13 +216,7 @@ async function ask_server(form, field, logins, domain, wdomain, mkey, submit)
if (ciphered_password != "")
{
debug("Ciphered password : " + ciphered_password);
if (matched_key < logins.length)
{
clear_password = await decrypt_cbc(mkey, global_iv, hex2a(ciphered_password));
clear_password = clear_password.replace(/\0*$/, "");
clear_password = clear_password.substr(3, clear_password.length);
}
else
if (matched_key >= logins.logins || server_protocol_version < 4)
// Crypto v1
{
clear_password = await decrypt_ecb(mkey, hex2a(ciphered_password));
@ -230,6 +224,12 @@ async function ask_server(form, field, logins, domain, wdomain, mkey, submit)
clear_password = clear_password.replace(/\0*$/, "");
clear_password = clear_password.substr(0, clear_password.length-3);
}
else
{
clear_password = await decrypt_cbc(mkey, global_iv, hex2a(ciphered_password));
clear_password = clear_password.replace(/\0*$/, "");
clear_password = clear_password.substr(3, clear_password.length);
}
debug("Clear password " + clear_password);
field.value = clear_password;
// Remove gPass event listener and submit again with clear password