Не срабатывает openssl_decrypt()
Я хочу расшифровать текст переменной $plaintext который я зашифровал с ключами переменных $cipher $key $iv, но получаю пустую строку. Если же я раз комментирую строку $ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag); , заменю на $original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag); рашифровка происхоит. Как мне расшифровать входные данные из переменной $plaintext
$plaintext = 'VDDWCeNyIwRDXCAMwPbHs9xlQng=';
$cipher = "aes-128-gcm";
$key = "4dhjskfhv";
$iv = 'Ӄp��ji�?�';
if (in_array($cipher, openssl_get_cipher_methods()))
{
// $ivlen = openssl_cipher_iv_length($cipher);
//$iv = openssl_random_pseudo_bytes($ivlen);
//$ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag);
}
$original_plaintext = openssl_decrypt($plaintext, $cipher, $key, $options=0, $iv, $tag);
echo $original_plaintext ;