CodeIgniter Forums

Full Version: Problem in AES
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Why when i use below code for decryption,result is empty
PHP Code:
'cipher' => 'aes-256',
'mode' => 'cbc',
'key' => 'RfUjXn2r5u8x!A%D*G-KaPdSgVkYp3s6'

But when i use below code,it return correct result:
PHP Code:
function EncryptAES($message$key){
$ivsize openssl_cipher_iv_length('aes-256-cbc');
$iv openssl_random_pseudo_bytes($ivsize);
$ciphertext openssl_encrypt($message,'aes-256-cbc',$key,OPENSSL_RAW_DATA,$iv);

$iv $ciphertext;
Result must be omid
You can decrypt it in