fix(crypto): guard decryptHex against malformed hex input
This commit is contained in:
@@ -41,6 +41,10 @@ class Crypto
|
||||
*/
|
||||
public static function decryptHex(string $data, string $password = PRIVATE_KEY): string
|
||||
{
|
||||
if ($data === '' || !ctype_xdigit($data) || strlen($data) % 2 !== 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return static::decrypt(hex2bin($data), $password);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user