Welcome Guest, Not a member yet? Register   Sign In
decrypt() returning incorrect result

I'm converting an app from CI 3.1.13 to CI 4.3.1

In CI3 I had:
PHP Code:
$CI =& get_instance();
$this->api_key $CI->encryption->decrypt($CI->Appconfig->get('mailchimp_api_key')); 

In CI4 I have:
PHP Code:
$encrypter Services::encrypter();
$this->api_key $encrypter->decrypt($config['mailchimp_api_key']) 

In Config/Encryption.php I have:
PHP Code:
public string $key REDACTED//32 Character encryption key
public string $driver 'OpenSSL';
int $blockSize 16;
string $digest 'SHA512';
bool $rawData false;
string $encryptKeyInfo 'encryption';
string $authKeyInfo 'authentication'

Between the two version the key has not changed and the digest value hasn't changed. When I step through the code I see that the decrypted result is garbage characters. I see that it's identifying the encryption algorithm as aes-256-ctr. I don't know if that's the correct algorithm or not from what CI3 was using, but something is off. From reading another forum post, I thought this was CI3 compatible as of CI 4.3.0.

Messages In This Thread
decrypt() returning incorrect result - by objecttothis - 02-17-2023, 06:17 AM

Theme © iAndrew 2016 - Forum software by © MyBB