Allow for encryption scheme upgrade

This commit is contained in:
Marcus Hill
2022-01-11 14:03:34 +00:00
parent 1dd55dbfe2
commit 951b03f712
5 changed files with 144 additions and 3 deletions

View File

@@ -411,6 +411,16 @@ function encryptLoginEntry($login_password_cleartext){
return $login_password_ciphertext;
}
//For migrating/upgrading to the new encryption scheme
//Have to supply the master key as the cookie might not be set properly (generally requires a refresh)
function encryptUpgradeLoginEntry($login_password_cleartext, $site_encryption_master_key){
$iv = keygen();
//Encrypt the website/asset login using the master key
$ciphertext = openssl_encrypt($login_password_cleartext, 'aes-128-cbc', $site_encryption_master_key, 0, $iv);
$login_password_ciphertext = $iv . $ciphertext;
return $login_password_ciphertext;
}
?>