I have a problem with my function that encrypts the data. There's my function that encrypt the data:
$key = "tHeApAcHe6410111";
function encrypt($text,$key){
$block = mcrypt_get_block_size('rijndael_128', 'ecb');
$pad = $block - (strlen($text) % $block);
$text .= str_repeat(chr($pad), $pad);
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_ECB));
}
In the end, I output what was encrypted:
$enc = encrypt("test",$GLOBALS['key']);
echo "Encrypt: " . $enc . "</br>";
But, what I get as output is the following:
Fatal error: Uncaught Error: Call to undefined function openssl_cipher_iv_length() in C:\ServidorWeb\htdocs\encriptacao.php:8 Stack trace: #0 C:\ServidorWeb\htdocs\encriptacao.php(60): openssl_cipher_block_length('rijndael_128', 'ecb') #1 C:\ServidorWeb\htdocs\encriptacao.php(92): encrypt('test', 'tHeApAcHe641011...') #2 {main} thrown in C:\ServidorWeb\htdocs\encriptacao.php on line 8
Does anyone know what may be happening?