Sqlite encryption mcrypt key



Using MCRYPT_RIJNDAEL_256 in php 5.6 you may encounter an issue with key length.
To resolve it add ./0 to your key:
$key = "123456";
Add :
$key = $key."/0";



Thank you for the feedback!


@Gilmichel I am struggling with finding solution for encrypting sqlite3 database. Do you have any links that may explain more about your methods?

Thanks in advance.



Hello SuSan,

I am now using openssl.
if you tape the words, php openssl sample, in google search you will find a lot of information and samples about it.



Good deal, thank you!

Got to educate myself on SQLite3 and PHP7+. Never used sqlite much in past so hitting the books : )


Hello Susan,

Based on my experience, using SQLite3 to build desktop software doesn’t need to know PHP7+, no even PDO, it is only necessary to know how to use php SQLite3 as it is in its simple version.




That is very true Gilbert. What I should have said was: got to learn php7.2 and openssl + sqlite.

Never used sqlite that much and when did used mcrypt. Nice thing about sqlite is fairly easy to grasp if used mysql.

In a school environment all such databases must be password protected or encrypted. I cannot even get software approved without one or the other: )

Thanks for the link to tutorial!


Openssl is also working find with php 4, 5, and 6.