Commit d973f55b authored by Henning Leutz's avatar Henning Leutz 🥋

feat: #361

parent da88fcb6
......@@ -22,9 +22,11 @@ class Encryption
*/
public static function encrypt($data)
{
$salt = QUI::conf('globals', 'salt');
$sl = QUI::conf('globals', 'saltlength');
$iv = QUI::conf('openssl', 'iv');
$Config = QUI::getConfig('etc/conf.ini.php');
$salt = $Config->getValue('globals', 'salt');
$sl = $Config->getValue('globals', 'saltlength');
$iv = $Config->getValue('openssl', 'iv');
if ($iv === false) {
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
......@@ -59,10 +61,15 @@ class Encryption
*/
public static function decrypt($data)
{
$salt = QUI::conf('globals', 'salt');
$sl = QUI::conf('globals', 'saltlength');
$Config = QUI::getConfig('etc/conf.ini.php');
$salt = $Config->getValue('globals', 'salt');
$sl = $Config->getValue('globals', 'saltlength');
if (!$Config->getValue('openssl', 'iv')) {
self::encrypt('');
}
$iv = QUI::conf('openssl', 'iv');
$iv = $Config->getValue('openssl', 'iv');
$iv = hex2bin($iv);
$data = openssl_decrypt($data, 'aes-256-cbc', $salt, 0, $iv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment