Welcome Guest, Not a member yet? Register   Sign In
Encrypter class error
#1

I have used encrypter class:

Code:
$this->encrypter = \Config\Services::encrypter();

$abc = 'abc/def/ghi';
$encrypt = $this->encrypter->encrypt($abc);
$decrypt = $this->encrypter->decrypt($encrypt);
There is an error "authentication failed".
Reply
#2

You should use base_64 encode and decode for that.

Other wise illegal characters can cause it to crash.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(07-20-2020, 12:16 AM)zoom360 Wrote: I have used encrypter class:

Code:
$this->encrypter = \Config\Services::encrypter();

$abc = 'abc/def/ghi';
$encrypt = $this->encrypter->encrypt($abc);
$decrypt = $this->encrypter->decrypt($encrypt);
There is an error "authentication failed".


Hi , I had a similar problem , you have to load the default encryption configuration in the config folder this way:



PHP Code:
public function __construct(){

  $this->config    = new \Config\Encryption();      // load the configuration for the encryption service
  $this->encrypter = \Config\Services::encrypter($this->config); // start the encryption service



And then you can use $this->encrypter to encrcypt and decrypt, also ensure that OpenSSL is enabled in php.ini , I asked and found the solution to the same problem here
Reply
#4

(08-12-2020, 05:22 AM)ebuoe Wrote:
(07-20-2020, 12:16 AM)zoom360 Wrote: I have used encrypter class:

Code:
$this->encrypter = \Config\Services::encrypter();

$abc = 'abc/def/ghi';
$encrypt = $this->encrypter->encrypt($abc);
$decrypt = $this->encrypter->decrypt($encrypt);
There is an error "authentication failed".


Hi , I had a similar problem , you have to load the default encryption configuration in the config folder this way:



PHP Code:
public function __construct(){

  $this->config    = new \Config\Encryption();      // load the configuration for the encryption service
  $this->encrypter = \Config\Services::encrypter($this->config); // start the encryption service



And then you can use $this->encrypter to encrcypt and decrypt, also ensure that OpenSSL is enabled in php.ini , I asked and found the solution to the same problem here
Thanks !
Reply




Theme © iAndrew 2016 - Forum software by © MyBB