Add test on data decryption

This commit is contained in:
Laurent Destailleur
2025-11-11 01:32:17 +01:00
parent 78cb2e0294
commit 2df6fa0237

View File

@@ -219,6 +219,11 @@ function dolDecrypt($chain, $key = '')
} else {
$newchain = openssl_decrypt((string) $tmpexplode[0], $ciphering, $key, 0, '');
}
// Test validity of decryption
if (!ascii_check($newchain)) {
dol_syslog("Error dolDecrypt failed: The key dolibarr_main_dolcrypt or dolibarr_main_instance_unique_id, found in conf.php file, is the the one used to encrypt this encrypted string", LOG_ERR);
return $chain;
}
} else {
dol_syslog("Error dolDecrypt openssl_decrypt is not available", LOG_ERR);
return $chain;