CodeIgniter Forums
Encryption Exception error - 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: Encryption Exception error (/showthread.php?tid=77145)



Encryption Exception error - ViniciusLima - 07-24-2020

Hello, I'm new using Codeigniter 4, I started to learn, when I tried to use the encryption library with the example in the manual it returns the error below.

this is the code, the same code as the manual.

PHP Code:
$config        = new \Config\Encryption();
 
$config->key    'aBigsecret_ofAtleast32Characters';
$config->driver 'OpenSSL';

$encrypter = \Config\Services::encrypter($config);
$ciphertext $encrypter->encrypt($plainText);

// Outputs: This is a plain-text message!
echo $encrypter->decrypt($ciphertext); 

this is the error.

CodeIgniter\Encryption\Exceptions\EncryptionException

Unable to find an available {0} encryption handler.

SYSTEMPATH\Encryption\Exceptions\EncryptionException.php at line 19

PHP Code:
public static function forNoDriverRequested()
13    {
14        return new static(lang('Encryption.noDriverRequested'));
15    }
16 
17    
public static function forNoHandlerAvailable()
18    {
19        return new static(lang('Encryption.noHandlerAvailable'));
20    }
21 
22    
public static function forUnKnownHandler(string $driver null)
23    {
24        return new static(lang('Encryption.unKnownHandler', [$driver]));
25    

sorry, but i have no idea what causes this error.


RE: Encryption Exception error - jreklund - 07-25-2020

Have you enabled OpenSSL in your PHP.ini?


RE: Encryption Exception error - ViniciusLima - 07-26-2020

(07-25-2020, 12:11 AM)jreklund Wrote: Have you enabled OpenSSL in your PHP.ini?


That was the problem, now it works normally, thank you very much.