is it possible to implement SQL AES_ENCRYPT/AES_DECRYPT into SQLite using PHP ? For example I have a PHP Code:
$SQL = "INSERT INTO parent (Request, Column1, Column2) VALUES ('$Request',AES_ENCRYPT('$Col1','$key'),AES_ENCRYPT('$Col2','$key'))";
and this query works in SQL, but is it possible to use this same query in SQLite?
I'd say you have 2 options :
encrypt your values at the PHP level and store them as BLOBs or base64 strings
encrypt the whole database executing the following command (just like any other regular SQL command) : PRAGMA hexkey='0x_your_key_in_hex_format' . Don't forget do do the same when you open your database for running SELECT queries. Here is the official documentation.
Well, about 10 minutes ago I finished installing
PHP 7.2.2
on my HP laptop withUbuntu 16.04 LTS 64bit
. You do not need to acquire a license forSQLite
Encryption Extension (SEE). On top of existingPHP
extension I have added a fewC
files withAES
andSQLite
functions for en/decrypting Pager. It works well and now I will try to make it work using Intel i5 built-in AES functionality - to get the best out of hardware itself. Now, to open a sqlite db I can use the following:Encrypting the whole database is definitely the best solution. Write me a message for details. I will probably publish this solution soon.