php - php8 openssl openssl_cipher_iv_length returns 0
one text
I'm using a payment gateway for WordPress and it has below code to generate an encryption for bank:
private static function encrypt_tripledes($data, $secret)
{
$method = 'DES-EDE3';
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($method));
$encrypted = openssl_encrypt($data, $method, $secret, 0, $iv);
return $encrypted;
}
The problem is that openssl_cipher_iv_length
returns 0 and the whole plugin & WordPress crashes when it wants to redirect to the bank payment website. how can I solve this problem?
Here is the error message when it wants to redirect to the bank:
Fatal error: Uncaught Error: Length must be greater than 0
Source