On 20 Aug 2019, at 8:40pm, Mark Tomlin <m...@mimocad.io> wrote:

> I found the regular sqlite3::open method has an $encryption_key parameter.
> 
> https://www.php.net/manual/en/sqlite3.open.php

Yep.

> As I am using PDO for the interface into SQLite, I wonder if there is a 
> similar parameter for that interface.

Nope.  The @passwd parameter is for user authentication, not encryption.

If there's way to do it with the PDO module, I'm betting that it's using PRAGMA:

    PRAGMA key='your-secret-key';

Issue this as a SQL command immediately after you've opened the SQLite database 
using PDO.  It might work in PHP.  I've never tried it.  If it doesn't work 
there's probably no way to make it work short of compiling your own copy of PHP.

You might use the sqlite3 module to create a tiny test encrypted database, with 
a row of data, for you to do testing on.  If you can successfully read that 
database using PDO try using the above PRAGMA with a freshly-created database 
to see if PDO can be used to encrypt.

Refs:

<https://www.sqlite.org/see/doc/release/www/readme.wiki>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to