SQLCipher/sqlite plugin for Qt6 projects. Based on original CMakeLists.txt`s from Qt 6.7.2 srcs (from sqldrivers and sqlite3 folders) with minimal changes/additions. Checked on Visual Studio 2022 projects. Project uses OpenSSL x64 static libraries built for Visual Studio. If you need another libraries you should change CMakeLists.txt
- SQLCipher/sqlite amalgamation
- OpenSSL binaries (//TODO)
- Open the Visual Studio Command Prompt (Tools -> Command Line -> Developer Command Prompt)
- cd to Projects folder
- Clone this project
> git clone git@github.com:9241304/qsqlcipher.git
- cd to project folder and create .build folder and cd to it
> cd qsqlcipher
> mkdir .build
> cd .build
- Configure the project (use your paths and keywords instead of example). Make sure all paths use '/' slash
> cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=../.install -DCMAKE_DEBUG_POSTFIX=d -DQt6_DIR=c:/Qt/6.7.2/msvc2019_64/lib/cmake/Qt6 -DSQLITE3_SRC_AM_DIR=d:/proj/sqlcipher/.am -DOPENSSL_INSTALL_DIR=c:/SDK/openssl/1.1.1m/OpenSSL-Win64
- Build and install
> cmake --build . --config Debug
> cmake --build . --config RelWithDebInfo
> cmake --install . --config Debug
> cmake --install . --config RelWithDebInfo
In .install folder you will find release and debug version of plugin. Just copy these files to sqldrivers folder of Qt6 installation and/or your project. So, now you can use your plugin
auto db{QSqlDatabase::addDatabase("QSQLCIPHER")};
db.setDatabaseName("encrypted.db");
if (!db.open())
return {};
QSqlQuery query(db);
//Use the safer way to enter password
query.exec("PRAGMA key = 'yourpassword';");
...