mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 17:13:03 +01:00
Merge pull request #24925 from ATM-Consulting/FIX_openssl_iv_truncation_shouldnt_rely_on_dol_trunc
FIX: use dol_substr instead of dol_trunc for truncating openssl initialization vector
This commit is contained in:
@@ -152,7 +152,7 @@ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed =
|
||||
if (empty($forceseed)) {
|
||||
$ivseed = dolGetRandomBytes($ivlen);
|
||||
} else {
|
||||
$ivseed = dol_trunc(md5($forceseed), $ivlen, 'right', 'UTF-8', 1);
|
||||
$ivseed = dol_substr(md5($forceseed), 0, $ivlen, 'ascii', 1);
|
||||
}
|
||||
|
||||
$newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed);
|
||||
|
||||
Reference in New Issue
Block a user