![]() |
Decrypting: authentication error when using the encryption library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Decrypting: authentication error when using the encryption library (/showthread.php?tid=77280) |
Decrypting: authentication error when using the encryption library - ebuoe - 08-10-2020 Hello friends, I am currently trying to use the encryption library on Codeigniter 4 (I am not using it for passwords ![]() However , when I fetch the encrypted data and try to decrypt I get this error : "Decrypting: authentication error" . Below are my codes. Encryption config file Code: public $key = 'secret key'; Constructor to initialize service Code: public function __construct() Decrypting: authentication failedDecrypting: authentication failed Encrypting data Code: $this->encrypter->encrypt($var) Decrypting: authentication failed Decrypt data I tried both Code: <?=$encrypter->decrypt($var);?> and Code: <?=$encrypter($var,$key);?> Yet I was still getting errors, Any help is appreciated. Regards. Decrypting: authentication failedDecrypting: authentication failed RE: Decrypting: authentication error when using the encryption library - InsiteFX - 08-11-2020 You should use base64_encode() and base64_decode() methods. PHP Code: $this->encrypter->encrypt(base64_encode($var)); RE: Decrypting: authentication error when using the encryption library - ebuoe - 08-12-2020 (08-11-2020, 04:03 AM)InsiteFX Wrote: You should use base64_encode() and base64_decode() methods. Hello InsiteFx , I have tried this method and i'm still getting the same Decrypting: authentication failed. error. Regards. Hello Everyone I was able to solve the problem, I was loading the encryption service without loading the and passing the default configuration first, so instead of : Code: public function __construct(){ I did this : Code: public function __construct(){ RE: Decrypting: authentication error when using the encryption library - ebuoe - 08-12-2020 Just to add , using base64_encode and base64_decode does not work for me |