CodeIgniter Forums
Is there an Encryption class? What am I missing? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forum-31.html)
+--- Thread: Is there an Encryption class? What am I missing? (/thread-71530.html)

Pages: 1 2


Is there an Encryption class? What am I missing? - skunkbad - 08-25-2018

I decided that I'd take a look at CI4 tonight. Based on the docs I found, I first tried to install it through composer:


Code:
composer create-project codeigniter4/framework


That didn't work out so well. Seemed like I was missing files or something. I just wanted to create a new encryption key, but couldn't load the service, and couldn't even find a file named Encryption anywhere.

Next I went over to github and downloaded the develop branch, unpacked it and tried again. Still don't see a encryption class. Can't find it anywhere, so I gave up.

I'm disappointed. I've been working on a new authentication package for any PHP project, and was going to start in on a CI4 adapter. Can't get past step 1. I'm not shy about composer usage, and I can normally figure out the basics of a framework in a couple hours. Not happy, so I'm going to bed.


RE: Is there an Encryption class? What am I missing? - ciadmin - 08-25-2018

Long story short - encryption isn't there at the moment.
It is done & tested, but relies on php7.2.
Once the minimum version for CI4 gets bumped to 7.2, it can slide in.


RE: Is there an Encryption class? What am I missing? - skunkbad - 08-25-2018

(08-25-2018, 01:05 AM)ciadmin Wrote: Long story short - encryption isn't there at the moment.
It is done & tested, but relies on php7.2.
Once the minimum version for CI4 gets bumped to 7.2, it can slide in.

OK, thanks. I suppose I'll start with a CI3 adapter just for practice.


RE: Is there an Encryption class? What am I missing? - Leo - 09-27-2018

Hello, if encryption relies on PHP 7.2 maybe provide a simple fall-back alternative for those with 7.1 or hosting that just doesn't have the module? I decided to use Open SSL encryption, with examples from this guy
https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data
...or maybe....by the time CI4 comes out 7.2 will be more widespread and available. Is Sodium the encryption module that CI4 will use?


RE: Is there an Encryption class? What am I missing? - ciadmin - 09-27-2018

Encryption is now not planned as part of CI4 - suggesting instead https://paragonie.com/project/halite
It does everything we were going to do, and has the advantage of being proven.
Why re-invent the wheel when we don't have to Smile


RE: Is there an Encryption class? What am I missing? - Leo - 09-27-2018

Thanks, I'll try it out. Will there be a forum/recommended list of extensions/plugins for CI4?


RE: Is there an Encryption class? What am I missing? - kilishan - 09-27-2018

@Leo - what are using encryption for? I've almost never used that library myself so trying to understand use cases.


RE: Is there an Encryption class? What am I missing? - ignitedcms - 09-27-2018

(09-27-2018, 01:39 PM)kilishan Wrote: @Leo - what are using encryption for? I've almost never used that library myself so trying to understand use cases.


Hi Kilishan, this is a good point, one such use for encryption, well a practical one, is say storing a SMTP password, encrypting it storing it in the database and then decrypting it to use again for email transport.

This means if a hacker got your database, they would also need the encryption key as well to uncover the SMTP password which is stored in the config file. I think it is a two layer safety net. They would need to hack your db and get access to your server code.


RE: Is there an Encryption class? What am I missing? - ciadmin - 09-27-2018

@Leo There will be a "Curated list of compatible addins, details to be announced later", from https://forum.codeigniter.com/thread-71705.html


RE: Is there an Encryption class? What am I missing? - ciadmin - 09-27-2018

I agree there are lots of uses for Encryption, but there is no need to re-invent the wheel Undecided