Welcome Guest, Not a member yet? Register   Sign In
Encryption Exception error
#1

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.
Reply
#2

Have you enabled OpenSSL in your PHP.ini?
Reply
#3

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB