Welcome Guest, Not a member yet? Register   Sign In
Problem in AES
#1

(This post was last modified: 04-01-2020, 10:25 AM by jreklund.)

Hi
Why when i use below code for decryption,result is empty
PHP Code:
$this->load->library('encryption');
        
$this->encryption->initialize(
            array(
                
'cipher' => 'aes-256',
                
'mode' => 'cbc',
                
'key' => 'RfUjXn2r5u8x!A%D*G-KaPdSgVkYp3s6'
            
)
        );
        echo 
$this->encryption->decrypt('R0gyV2NwQEJ5ZVZKODVnaHYEbS37syFYTcQNdwMXMQo='); 

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);

            return 
$iv $ciphertext;
      } 
Result must be omid
You can decrypt it in https://www.devglan.com/online-tools/aes...decryption
Thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB