I am trying to encrypt a string in php using AES-128 and CBC, but when I call mcrypt_generic_init() it returns false.
$cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '',MCRYPT_MODE_CBC, '');
$iv_size = mcrypt_enc_get_iv_size($cipher);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$res = mcrypt_generic_init($cipher, 'aaaa', $iv); //'aaaa' is a test key
Can someone tell me why is returning 0/false? I read the php documentation and seems correct
(http://us.php.net/manual/en/mcrypt.examples.php)