Welcome Guest, Not a member yet? Register   Sign In
decrypt() returning incorrect result
#4

@kenjis

I applied the workaround that @ardimardiana referenced here https://forum.codeigniter.com/showthread...#pid406963 and got it working. In doing so I discovered the problem. CI4 is incorrectly guessing the cipher to use in decrypting the CI3 data as aes-256-ctr, when at least in my case, it is the CI3 standard aes-128-cbc cipher. As soon as I changed @ardimardiana's workaround code to:

PHP Code:
$ci3 = new Ci3encrypt();
$ci3->initialize(array(
    
'cipher' => 'aes-128',
    
'mode' => 'cbc',
    
'driver' => 'openssl',
    
'key' => config('Encryption')->key
));
$plain_text $ci3->decrypt($config['mailchimp_api_key']); 

The CI3 encryption library decrypted the input properly. I tried forcing the CI4 encryption to use aes-128-cbc and even though the documentation (https://codeigniter.com/user_guide/libra...initialize) shows a cipher option, I'm not seeing cipher or mode in \Config\Encryption.php. Were they removed from CI4 at some point after that documentation?
Reply


Messages In This Thread
RE: decrypt() returning incorrect result - by objecttothis - 02-18-2023, 02:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB