I have a PHP script that will encrypt data to store in a database, but when I run the script, the openssl_encrypt returns false with the error: “error:1C800066:Provider routines::cipher operation failed”.
$cipher = str_replace("n", "", file_get_contents("/key/cipher"));
$iv_length = openssl_cipher_iv_length($cipher);
$options = 0;
$iv = str_replace("n", "", file_get_contents("/key/iv"));
$key = str_replace("n", "", file_get_contents("/key/key"));
$firstName = openssl_encrypt($data["firstName"], $cipher, $key, $options, $iv);
I have verified that all of these files exist on my pc, as well as $data["firstName"]
is actually received.
The data that fails is a first name about 6 characters long, but when I type in an email, which is about 19 characters long, it works perfectly fine.