CodeIgniter Forums

Full Version: CI 2.1.0 to CI 3.0.x upgrade - Replacing "encrypt" with the "encryption" library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

I am a newbie in CodeIgniter but have a fair amount of PHP knowledge and other frameworks. 

First hand, looks like an awesome framework that if fairly straightforward and well-written. Well done!

I have inherited an application written in CI 2.1.0 and I have been going through the painstaking path of upgrading it to CI 3.x

Fortunately your documentation is well-written and I am able to follow through most of the instructions. Well done!

I am now on a major upgrade from CI 2.2.6 to CI 3.0.x on the Encrypt Library section

Specifically it says:


Quote:Following numerous vulnerability reports, the Encrypt Library has been deprecated and a new, Encryption Library is added to take its place.

The Encrypt Library is still available for the purpose of keeping backwards compatibility.

You are strongly encouraged to switch to the new Encryption Library as soon as possible!

I have gone through the Encryption library documentation and I see no equivalent to

PHP Code:
$this->encrypt->encode() 

Most of the upgrade documentation takes you through what was deprecated or what new methods to call, but in the Encrypt Library section, there is no mention on what we do to replace $this->encrypt->encode()  

There is no mention of it in the new Encryption Library.

Any help or pointers would be most appreciated!
See https://www.codeigniter.com/user_guide/l...pting-data

$plain_text = 'This is a plain-text message!';
$ciphertext = $this->encryption->encrypt($plain_text);
...
echo $this->encryption->decrypt($ciphertext);
Thank-you for the quick help, ciadmin.

So, to be specific:

  1. What was encode() in the Encrypt Library is now encrypt() in the Encryption Library?
  2. What was decode() in the Encrypt Library is now decrypt() in the Encryption Library?
Also what are the implications on already stored data? Are the algorithms identically implemented?

So after switching, there will be no failure in the Encryption Library 'decrypting' the old data that was 'encoded' using the Encrypt Library?
Your understanding is correct.

Compatibility implications depend on the algorithms used, and the seed for any given piuece of encrypted data.

In the worst case, you would need a small script to decode() data using Encrypt and then encrypt() it using Encryption.
I am not sure if anyone in the community has been through this, and might offer additional insight.
Yes, it is my worry that we will have issues with our existing data due to potentially differing algorithms.

I am not sure I get what you say here or how to implement it interchanging between the two libraries:

(05-03-2018, 11:21 AM)ciadmin Wrote: [ -> ]In the worst case, you would need a small script to decode() data using Encrypt and then encrypt() it using Encryption.