Server: Remove old v1 crypto functions & compatibility
This commit is contained in:
parent
7f95b19264
commit
736d717676
|
@ -79,10 +79,4 @@ $REQUESTS_MIN_DELAY=1000;
|
||||||
*/
|
*/
|
||||||
$CLEAR_TIME=15*60*1000;
|
$CLEAR_TIME=15*60*1000;
|
||||||
|
|
||||||
/*
|
|
||||||
The first crypto schema use an AES-ECB process to encrypt logins.
|
|
||||||
It's used until version 0.7.
|
|
||||||
Since version 0.8, we use AES-CBC + SHA256.
|
|
||||||
*/
|
|
||||||
$CRYPTO_V1_COMPATIBLE=1;
|
|
||||||
?>
|
?>
|
|
@ -79,7 +79,6 @@ else
|
||||||
<?php
|
<?php
|
||||||
echo "pbkdf2_level=$PBKDF2_LEVEL; use_shadow_logins=$USE_SHADOW_LOGINS;\n";
|
echo "pbkdf2_level=$PBKDF2_LEVEL; use_shadow_logins=$USE_SHADOW_LOGINS;\n";
|
||||||
echo "CLEAR_TIME=$CLEAR_TIME; // Clear master key after 15 minutes\n";
|
echo "CLEAR_TIME=$CLEAR_TIME; // Clear master key after 15 minutes\n";
|
||||||
echo "CRYPTO_V1_COMPATIBLE=$CRYPTO_V1_COMPATIBLE;\n";
|
|
||||||
?>
|
?>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
window.onscroll = function(ev) {
|
window.onscroll = function(ev) {
|
||||||
|
|
|
@ -226,7 +226,6 @@ function PasswordEntry (ciphered_login, ciphered_password, salt, shadow_login) {
|
||||||
if (masterkey == this.masterkey)
|
if (masterkey == this.masterkey)
|
||||||
return (this.unciphered == true);
|
return (this.unciphered == true);
|
||||||
|
|
||||||
var old = false;
|
|
||||||
var iv = await global_iv;
|
var iv = await global_iv;
|
||||||
iv = iv.slice(0, 16);
|
iv = iv.slice(0, 16);
|
||||||
var login = await decrypt_cbc(masterkey, iv, hex2a(this.ciphered_login));
|
var login = await decrypt_cbc(masterkey, iv, hex2a(this.ciphered_login));
|
||||||
|
@ -238,38 +237,16 @@ function PasswordEntry (ciphered_login, ciphered_password, salt, shadow_login) {
|
||||||
{
|
{
|
||||||
login = login.slice(0, login.length-16).replace(/\0*$/, "");
|
login = login.slice(0, login.length-16).replace(/\0*$/, "");
|
||||||
}
|
}
|
||||||
else if (CRYPTO_V1_COMPATIBLE)
|
|
||||||
{
|
|
||||||
login = await decrypt_ecb(masterkey, hex2a(this.ciphered_login));
|
|
||||||
if (login.indexOf("@@") != 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
login = login.replace(/\0*$/, "");
|
|
||||||
// Remove @@
|
|
||||||
login = login.substring(2);
|
|
||||||
old = true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
infos = login.split(";");
|
infos = login.split(";");
|
||||||
this.clear_url = infos[0];
|
this.clear_url = infos[0];
|
||||||
this.clear_login = infos[1];
|
this.clear_login = infos[1];
|
||||||
if (old)
|
this.clear_password = await decrypt_cbc(masterkey, iv, hex2a(this.ciphered_password));
|
||||||
{
|
// Remove salt
|
||||||
this.clear_password = await decrypt_ecb(masterkey, hex2a(this.ciphered_password));
|
this.clear_password = this.clear_password.replace(/\0*$/, "");
|
||||||
// Remove salt
|
this.clear_password = this.clear_password.substr(3, this.clear_password.length);
|
||||||
this.clear_password = this.clear_password.replace(/\0*$/, "");
|
|
||||||
this.clear_password = this.clear_password.substr(0, this.clear_password.length-3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.clear_password = await decrypt_cbc(masterkey, iv, hex2a(this.ciphered_password));
|
|
||||||
// Remove salt
|
|
||||||
this.clear_password = this.clear_password.replace(/\0*$/, "");
|
|
||||||
this.clear_password = this.clear_password.substr(3, this.clear_password.length);
|
|
||||||
}
|
|
||||||
this.unciphered = true;
|
this.unciphered = true;
|
||||||
this.masterkey = masterkey;
|
this.masterkey = masterkey;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user