![]() |
I have 1 app for SSO, use CI 3. Now i am creating new app with CI 4. code in CI 3 for encryption :
Code: $otp = 123; code in CI 4 for decryption : Code: $otp = '54322c75199be967a78c4d65906dd1d6a41c54027ddb2ff1a295c5646728f435cf4c3b5e793b57b6a6ecef34de7b7c1ed809632adeb02c5fabdf5f76befe4440PFRX6XAktE/jZXJKjL8fhCcqQw=='; i have try with different option : Code: $config = new \Config\Encryption(); Still getting message authentication failed. but in this documentation states that my CI 3 configuration it same with CI 4 even with default. i noticed some different between CI3 and CI4 on Encryption Lib. There is something about BASE64 decode and encode in CI3 for encrypt or decrypt. i have red in this Github Issue, something aboout bin2hex and hex2bin. and try it at my decrypt like : Code: echo $this->encryption->encrypt(base64_decode($otp)); but still getting authentication failed. note: i cant rewrite my CI3 SSO because it has many another app using CI3.
Unfortunately there seems no compatibility between CI3 and CI4 Encryption.
The raw_data option in CI3 is missing in CI4. https://www.codeigniter.com/userguide3/l...parameters
The PR https://github.com/codeigniter4/CodeIgniter4/pull/6277 was merged into 4.3 branch.
The enhancement will be included in v4.3.0.
i have figure it out hot to resolve this problem. so. what i am doing is. take / copy Codeigniter 3 encryption class from
PHP Code: system/libraries/Encryption.php PHP Code: app/libraries/Ci3encrypt.php Code: <?php to call new class. in CI4 on the controller i put PHP Code: namespace App\Controllers; and on the function in controller ci4 PHP Code: $ci3 = new Ci3encrypt(); and my problem is resolve for now. but if in CI 4.3 will be supported. i will be glad
nothing and everything is possimpible
02-18-2023, 01:31 PM
(This post was last modified: 02-18-2023, 01:51 PM by objecttothis. Edit Reason: clarity ) (07-24-2022, 04:54 AM)ardimardiana Wrote: i have figure it out hot to resolve this problem. so. what i am doing is. take / copy Codeigniter 3 encryption class @ardimardiana I'm trying to do the same thing you've described here, but the CI3 Encryption class has a number of dependencies on functions in the CI3 \system\core\common.php library that don't exist in CI4 in the same way... Are there other files you brought over as well? It seems that copy over and rename isn't doing it. Nevermind... your instructions are missing a key change though. In the constructor you need to change PHP Code: if ( ! isset($this->_key) && self::strlen($key = config_item('encryption_key')) > 0) to PHP Code: if ( ! isset($this->_key) && self::strlen($key = config('Encryption')->key) > 0) Then it will work. |
Welcome Guest, Not a member yet? Register Sign In |