Using PHP encryption

Hi!

I would like to encrypt and decrypt a SQLite3 database using PHP Mcrypt (so that it can only be used with my webpage) - the database and table are created using PHP - however I can’t find a stupidly simple tutorial.

Could anyone help me with this please. Thank you.

Encryption is hardly the right approach to this problem. If only the webserver should have access to the database, then simply set the file permissions accordingly (e. g. 0600 with the webserver being the file owner). If you need fine-grained access control for multiple websites, use a “real” database system like PostgreSQL or MySQL; SQLite wasn’t made for this scenario.

Mcrypt is also a bad choice, because it’s a low-level library with dozens of pitfalls. Unless you’re an expert cryptographer (which you obviously aren’t), you should stay away from it. Use a high-level library like libsodium. But again: Encryption isn’t the right approach to begin with.

Thank for the information and the link for libsodium.

At last I got an answer instead of reading article after article to become even more confused.

Sponsor our Newsletter | Privacy Policy | Terms of Service