SQLite Encryption Extension - PRAGMA activate_extensions= not working
-
I've got a good working application that uses SQLite. I've cross-compiled the Android SQLite lib, and gotten it to load on Android .
But, the problem now is that to actually encrypt the data (it all continues to work fine un-encrypted) According to the SQLite Encryption Extension docs, I'm supposed to execute thes PRAGMAs ont he db IMMEDIATELY AFTER the db .open()... I do it like this:
void DataStore::lock() { QSqlQuery active(sqlite); active.exec("PRAGMA activate_extensions='see-7bb07b8d471d642e';"); qDebug() << "active last error: " << active.lastError(); //no errors occurred QSqlQuery key(sqlite); key.exec("PRAGMA key='sqlite3';"); qDebug() << "key last error: " << key.lastError(); //no errors occurred }
which is what I have confirmed is the correct PRAGMAs from the SQLite encryption extension folks. I get no errors, nor do I get encryption.
Has anyone any done this before? any ideas?
Could there be something internally to the Qt code that executes between the PRAGMAs and the actual SQLite open()? -
Hi,
What version of SQLite are you using ?
-
Did you rebuild the SQLite plugin to use your custom version of SQLite ?
-
For example, yes. I mean that if you are building your application for different targets, you need to build/re-build the QSQLite plugin for each of them.
-
@SGaist ? my application continues to run on windows and linux and Android and iOS - all hitting the SQLite db. I never once rebuilt that file, or any of Qt specifically.
I believe that my app is linking to the actual binary libsqlite.so (that the libqsqlite.so plugin would link to) because, when I (with a hex editor) change the few bytes at the beginning of my libsqlite.so, then the db does fail on Android - I see that it fails to link on the console output. When I restore the bytes, it works again. But, I could be misinterpreting that somehow.
I'd never heard of compiling this plugin separately: qsql_sqlite.cpp. Is that what you mean?
-
AFAIR, if you don't use your system provided SQLite library, the plugin is built with Qt's internally provided SQLite which is built statically for that matter. Hence my question about re-building the QSQLite plugin using your custom version.