C++ SQLite3 encrypted DB
-
Hallo
I've encrypted my SQLite3 db by Navicat ! :
So my code:
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(QApplication::applicationDirPath()+ QDir::separator() + "test.db");
and db.login() return true ;
but my trying to execute a query :
QSqlQuery q("SELECT * FROM test"); while(q.next()) qDebug()<<q.value(0).toString(); qDebug()<<q.lastError().text();
so i got :
"file is encrypted or is not a database Unable to execute statement"
i've also try to
db.setPassword("mypass");
but also didn't work
-
Hi,
SQLite is not encrypted by default so you should check with the Navicat folks whether they are using SQLCipher for that.
AFAIR, there are instructions available to build a plugin for Qt using SQLCipher so it's worth checking.
-
Looks like you might be lucky. QtCipherSqlitePlugin.might be what you need.
-
@sgaist said in C++ SQLite3 encrypted DB:
QtCipherSqlitePlugin
As far as I understand QtCipherSqlitePlugin is not an open source. Do we have something in open source which encrypt the data in database? I tried SQLCipher from https://www.zetetic.net/sqlcipher/open-source/ but I am unable to use it as an usual external library in Qt. Isn't it possible? Can you please give me some suggestion on which database i can use, which provides encryption, is open source and can get easily get integrated in Qt?
-
@ryna said in C++ SQLite3 encrypted DB:
As far as I understand QtCipherSqlitePlugin is not an open source.
Why not? It's LGPL 2.1
-
This post is deleted!