CodeIgniter Forums
Encrypt password in database.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Encrypt password in database.php (/thread-32700.html)



Encrypt password in database.php - El Forum - 08-01-2010

[eluser]bgougent[/eluser]
I assume that everybody know the database section under the config.
Code:
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "";
$db['default']['password'] = "";
$db['default']['database'] = "";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
I would like to make a portable website as some kind of demo. Is there a way to encrypt my password in this section?


Encrypt password in database.php - El Forum - 08-01-2010

[eluser]WanWizard[/eluser]
Short answer: no.

And in my opinion pretty pointless, as the database is accessable via lots of other ways as well. Or is your demo connecting to a secured database over the internet?

If you want to encrypt it, you will need an encryption key, otherwise you will not be able to decrypt it. And where are you going to store that? Kind of chicken-and-egg problem. At some point, someone has to enter a password to make it secure. Or you have to come up with a way to do encryption with a certificate.


Encrypt password in database.php - El Forum - 08-01-2010

[eluser]bgougent[/eluser]
Correct. Because it is taking from a larger project. Will change the password for this demo. Will be easier I think.