CodeIgniter Encryption Library
Clash Royale CLAN TAG#URR8PPP
CodeIgniter Encryption Library
I'm building a quick site with CodeIgniter and currently I'm making use of the CI 'encrypt' library. Reading through here it sounds like I just throw on a quick:
$this->encrypt->encode($secret_data);
and do this when you want to use it:
$this->encrypt->decode($encripted_string);
Then the magic of CI and Mcrypt do the rest.
Well I'm not sure I can sleep without knowing what is going on in the background. So I have two questions...
How is this working? Or is there a good resource to explain to me how this is working that I can read up on it?
Is this generally thought of as a safe way to encrypt data? If not where else should I be looking.
Thanks for the pointer.
– Miles
Mar 22 '16 at 18:48
I've updated the comment into an answer, hope it gives you some more info...
– Vickel
Mar 22 '16 at 19:10
The best resource that explains how its working is the source (old and new). It is code with small bite size (easy to understand) and documented functions.
– Artjom B.
Mar 22 '16 at 20:44
Question 1 is off-topic, because you're asking for an off-site resource. Question 2 is somewhat opinion-based. You would need to define your security margin for question 2.
– Artjom B.
Mar 22 '16 at 20:46
2 Answers
2
1. How is it working:
codeigniter 2.x
The CodeIgniter Encryption Class provides a two-way keyed encoding using XOR Hashing and Mcrypt.
interesting about XOR Hashing: https://stackoverflow.com/a/27952689/2275490
the php manual about Mcrypt: http://php.net/manual/en/book.mcrypt.php
Also you might want to check in system->libraries for the encrypt.php file and discover what it does.
codeigniter 3.x
Provides two-way keyed encoding using Mcrypt
the php manual about Mcrypt: http://php.net/manual/en/book.mcrypt.php
the CI manual: http://www.codeigniter.com/userguide3/libraries/encryption.html
2. thought as safe way to encrypt data:
that's opinion based, I think definitely yes for a "quick site"
Thanks for being willing to delve into opinion. I know asking for it is a risky proposition, but sometimes it's useful to get other's opinions.
– Miles
Mar 22 '16 at 20:26
No, CI_Encrypt uses AES through Mcrypt by default. There is no "XOR Hashing" going on in there (yes, there is key hashing with XOR, but is not like the answer you linked to).
– Artjom B.
Mar 22 '16 at 20:41
@ArtjomB.: edited the answer, please check...
– Vickel
Mar 22 '16 at 21:04
You're reading the "wrong" thing ...
The CodeIgniter documentation on EllisLab's website is outdated and no longer the official one. It's also for CodeIgniter 2.x, which is itself no longer supported.
The official documentation is on codeigniter.com, and you should be using CodeIgniter 3.x, which deprecates that old CI_Encrypt
library and replaces it with a new one, which is far better and more well-documented, here:
CI_Encrypt
http://www.codeigniter.com/userguide3/libraries/encryption.html
Great point. Based on what I read, I may upgrade it from CI 2 to 3.
– Miles
Mar 22 '16 at 20:19
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
The CodeIgniter Encryption Class provides two-way keyed encoding using XOR Hashing and Mcrypt. Check in system -> libraries for the encrypt.php file and descover what the class does....
– Vickel
Mar 22 '16 at 18:44