fix(crypto): reject malformed nonce in check()

This commit is contained in:
kj
2026-11-22 13:25:48 -03:00
parent 5a28e37998
commit 9c80f13748
+4
View File
@@ -42,6 +42,10 @@ class Nonce
*/
public static function check(string $nonce, string $passphrase = ''): bool
{
if ($nonce === '' || !ctype_xdigit($nonce) || strlen($nonce) % 2 !== 0) {
return false;
}
$decripted = openssl_decrypt(
hex2bin($nonce),
'aes-128-ecb',