Giter Club home page Giter Club logo

qtciphersqliteplugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtciphersqliteplugin's Issues

undefined reference to dlerror, dlclose, dlsym, dlopen

Hi,

I have a problem compiling QtCipherSqlitePlugin v1.2 with Qt 5.7.1 on Debian Stretch. Both QtCreator Compilation and Console Compilation break with same errors:

/var/home/knm/fsqlite/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3.c:37958: error: undefined reference to 'dlerror'
/var/home/knm/fsqlite/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3.c:37989: error: undefined reference to 'dlclose'
/var/home/knm/fsqlite/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3.c:37985: error: undefined reference to 'dlsym'
/var/home/knm/fsqlite/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3.c:37944: error: undefined reference to 'dlopen'

What I'm doing wrong?

Can somebody help?

Thank You.

Can't open from Navicat

I've compiled the plugin and evrything is ok 👍
so i've create new Sqlite3 DB from navicat and uses encrypt option : img , Navicat uses wxSQLite3 for encrypt, but when i try to login from Qt to the database it says : Can not open connection: "Invalid password"

so i've change the db name to another name(non-exist db):QString DB_FILE_PATH = dir + "/test_new.db";
and dbconn.setPassword("gogo");

he did make a new DB called test_new , and evrything work find : img

but when i try to connect to this db from navicat and i've put the encrypt password (gogo) it says : img , that's haapens when the password is incorrect !

so what is the problem ? i've also try to use only numbers but same problem !

The problem of compilation failure under qt5.6

Thank you for writing this plugin, it helped me solve the sqlite3 encryption problem. There is a small problem. QSqlCachedResultPrivate is not exported on qt5.6, and it will prompt QSqlCachedResultPrivate to be an undefined base class when compiling. Is there a solution currently under qt5.6?

Invalid password between databases on different platforms

We have created Sqlite Cipher db and it works fine (Windows x64). When this database would open on other platform (Debian amd64), it getting password error and vise versa.
Situation between win x64 and win x86 is incompatible too.

Not working on Windows 5.14.1

Config: Using QtTest library 5.14.1, Qt 5.14.1 (x86_64-little_endian-llp64 shared (dynamic) release build; by GCC 7.3.0)
FAIL! : TestSqliteCipher::initTestCase() 'QSqlDatabase::isDriverAvailable("SQLITECIPHER")' returned FALSE. (SQLITECIPHER driver not found.)
C:/Users/slevin/Desktop/QtCipherSqlitePlugin-master/test/main.cpp(20) : failure location
PASS : TestSqliteCipher::cleanupTestCase()
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 77ms
********* Finished testing of TestSqliteCipher *********

Segfault in Qt while using SQLite cipher plugin

Hello.
I was trying to use the plugin on Ubuntu 16.04 x64 (it is a VM in VirtualBox 5.0.26) and I've got some strange behavior. My application crashes with SIGSEGV with a following stack trace:

1 ??                                                                      0x7ffff608b3a9 
2 QSqlCachedResultPrivate::cleanup()                                      0x7ffff608c3b2 
3 QSqlQuery::prepare(QString const&)                                      0x7ffff607d4ae 
4 BB::EventCacheComponent::EventCacheComponent eventcachecomponent.cpp 43 0x439a46       
5 BB::Agent::Agent                             agent.cpp               33 0x412416       
6 main                                         main.cpp                54 0x41090a       

Namespace "BB::" corresponds to my app. Levels 1-3 of stack trace correspond to the "libQt5Sql.so" module.
I don't think that the problem is with my code: my app works without any issue if I change database driver to the "QSQLITE".
I tried to run test project from your repository with the same result - it crashed. Here is the stack trace:

1 ??                                             0x7fcb4fb673a9 
2 QSqlCachedResultPrivate::cleanup()             0x7fcb4fb683b2 
3 QSqlQuery::exec(QString const&)                0x7fcb4fb58d25 
4 main                               main.cpp 21 0x4019be       

Building and running the same app on Windows 10 x64 does not trigger this issue (msvc2013 x64 and x86 builds work fine). Also, there was a report about similar issue with my app on Mac OS X some time ago, though I'm not sure it is related. Qt version: 5.7.0 on all platforms. Does anyone know what exactly is the problem and how to fix it?

Is a bug?

int
GetCipherType(sqlite3* db)
{
CodecParameter* codecParams = (db != NULL) ? GetCodecParams(db) : codecParameterTable;
CipherParams* cipherParamTable = (codecParams != NULL) ? codecParams[0].m_params : commonParams;
#if 0
if (codecParams == NULL)
{
return value;
}

int j = 0;
for (j = 0; strlen(codecParams[j].m_name) > 0; ++j)
{
if (sqlite3_stricmp(cipherName, codecParams[j].m_name) == 0) break;
}
if (strlen(codecParams[j].m_name) > 0)
{
cipherParamTable = codecParams[j].m_params;
}
#endif

int cipherType = CODEC_TYPE;
CipherParams* cipher = cipherParamTable;
for (; strlen(cipher->m_name) > 0; ++cipher)
{
if (sqlite3_stricmp("cipher", cipher->m_name) == 0) break;
}
if (strlen(cipher->m_name) > 0)
{
cipherType = cipher->m_value;
cipher->m_value = cipher->m_default; // Why to change value to default value? Specifies cipher at runtime, will cause error when attach database twice or more~
}

return cipherType;
}

linker error while building with Qt 5.6.2 msvc 2013 32bit

sqlitecipher.obj: -1: error: LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall QSqlCachedResult::QSqlCachedResult(class QSqlCachedResultPrivate &)" (_imp??0QSqlCachedResult@@iae@AAVQSqlCachedResultPrivate@@@z) referenced in function "public: __thiscall SQLiteResult::SQLiteResult(class SQLiteCipherDriver const *)" (??0SQLiteResult@@QAE@PBVSQLiteCipherDriver@@@z)
.
.
I am trying to build QtCipherSqlitePlugin with Qt 5.6.2 msvc 2013 32bit, but I get this error.

not build with qt 5.5.1

as your wiki i open the project in qt and build it but this is the bugs:

D:\Qt\Apps\QtCipherSqlitePlugin-master\sqlitecipher\sqlite3\fastpbkdf2.c:259: error: expected ';', ',' or ')' before 'ctx'
static inline void sha1_extract(sha1_ctx *restrict ctx, uint8_t *restrict out)
^
D:\Qt\Apps\QtCipherSqlitePlugin-master\sqlitecipher\sqlite3\fastpbkdf2.c:268: error: expected ';', ',' or ')' before 'out'
static inline void sha1_cpy(sha1_ctx *restrict out, const sha1_ctx *restrict in)
^
D:\Qt\Apps\QtCipherSqlitePlugin-master\sqlitecipher\sqlite3\fastpbkdf2.c:277: error: expected ';', ',' or ')' before 'out'
static inline void sha1_xor(sha1_ctx *restrict out, const sha1_ctx *restrict in)
^

Navicat can't open

I have read the topic Can't open from Navicat #11. The issue is not same to me.
I used the testapp for test and the result is OK.
The issue I meet is as followed:

26-file is not a database

By the way, I have changed CODEC_TYPE to CODEC_TYPE_AES128 in DEFINES in sqlitecipher/sqlite3/sqlite3.pri.

best crypt options

What is the best algorithm for opening crypto db with this library?

is it strong enough crypt options in example?

  QSqlDatabase glbDB = QSqlDatabase::addDatabase("SQLITECIPHER");
  glbDB.setDatabaseName(__DB_FILE_PATH__);
  glbDB.setPassword("test");
  glbDB.setConnectOptions("QSQLITE_USE_CIPHER=sqlcipher; QSQLITE_ENABLE_REGEXP");
  if (!glbDB.open()) {
      qDebug() << "Can not open connection: " << glbDB.lastError().driverText();
      //exit("CONNECTION_FAILED");
  }

nullptr issue when imported into qt 5.5.1 mingw version

Hi,

I just tried to imported into qt 5.5.1 (mingw version, but got below error when compiling, what is the problem and how should I do? Thanks!

C:\gitrepository\QtCipherSqlitePlugin-master\sqlitecipher\qsql_sqlite.cpp:666: error: 'nullptr' was not declared in this scope
if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, nullptr) == SQLITE_OK) {
^

Password update is not working!

  1. How to update new password for my database?

My code is:

    checkDb = QSqlDatabase::addDatabase("SQLITECIPHER");
    checkDb.setDatabaseName("test.db");
    checkDb.setPassword("test");

    if (!checkDb.open()) {
        qDebug() << "Can not open Db!" << checkDb.lastError().driverText();
    }
    else  {
        qDebug() << "try to change password";
        QString strNew;
        checkDb.setConnectOptions("QSQLITE_UPDATE_KEY=newtest");
        qDebug() <<  checkDb.lastError().driverText();
    }
    checkDb.close();

Password update is not working. I can not change my db password.
How Can I fix it?

Unable to open manually-encrypted sqlite database with QtCipherSqlitePlugin and viceversa

I have manually created a SQLite database (named "localDB.db") and protected it with a password, by using DB browser. If I am not mistaken, DB browser uses SQLCipher (with a default page size of 1024), for encrypting a database.
However, if I try to open the database with this plugin (see following code), I always get the error that "the password is invalid or cipher does not match", although I clearly use the correct password and have set the cipher as "sqlcipher".

#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QSqlError>
#include <QtSql/QSqlDatabase>

#ifdef Q_OS_IOS

#include <QtPlugin>

Q_IMPORT_PLUGIN(SqliteCipherDriverPlugin)

#endif

#define CONNECTION_FAILED -1

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    qDebug() << QSqlDatabase::drivers();

    QString dir = QCoreApplication::applicationDirPath();
    QString db_file_path = dir + "/Data/localDB.db";
    qDebug() << "DB File Path is:" << db_file_path;

    QSqlDatabase db = QSqlDatabase::addDatabase("SQLITECIPHER");
    db.setDatabaseName(db_file_path);
    db.setPassword("test");
    db.setConnectOptions("QSQLITE_USE_CIPHER=sqlcipher");
    db.open();

    if (!db.isOpen())
    {
        qDebug() << "Can not open connection: " << db.lastError().driverText();
        exit(CONNECTION_FAILED);
    }

    return 0;
}

The same happens for the inverse process: if I encrypt a database by using this plugin, then I am unable to manually open the database with DB Browser or other similar programs, because it does not accept the password.

How can I solve this problem? I need to access an encrypted sqlite database through both my software and a third-party application like DB browser.

Thanks in advance

bug(sqlite3_reset)

in fetchNext func, sqlite3_reset cause crash, stmt is NULL or wild pointer

fetchNext func{
...
case SQLITE_DONE:
if (rInf.isEmpty())
// must be first call.
initColumns(true);
q->setAt(QSql::AfterLastRow);
### sqlite3_reset(stmt);
case SQLITE_CONSTRAINT:
case SQLITE_ERROR:
// SQLITE_ERROR is a generic error code and we must call sqlite3_reset()
// to get the specific error message.
### res = sqlite3_reset(stmt);
q->setLastError(qMakeError(access, QCoreApplication::translate("QSQLiteResult",
"Unable to fetch row"), QSqlError::ConnectionError, res));
q->setAt(QSql::AfterLastRow);
return false;
case SQLITE_MISUSE:
case SQLITE_BUSY:
default:
// something wrong, don't get col info, but still return false
q->setLastError(qMakeError(access, QCoreApplication::translate("QSQLiteResult",
"Unable to fetch row"), QSqlError::ConnectionError, res));
### sqlite3_reset(stmt);
q->setAt(QSql::AfterLastRow);
return false;
}
...
}

Password not working

Hello
I'm using Qt 5.11.2 and i've edit CODEC_TYPE to CODEC_TYPE_AES128 so i can use it with navicat ! , then i compiled the library and add it to sqldrivers and i check the drivers:
("QSQLITE", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7", "SQLITECIPHER")

my code:
const QString dbLocation = QApplication::applicationDirPath()+ QDir::separator() + "SalesManagement.db"; QSqlDatabase db = QSqlDatabase::addDatabase("SQLITECIPHER"); db.setDatabaseName(dbLocation); db.setPassword("It_es_g"); if(!db.open()) { DBFailMsg(); return 1; }

then i tryed to open an already sqlite db with aes128 enc but it's not open , then i tryed to make new db throw the same code with password and it's being created but without password !

so what's the problem ?

偶尔会异常闪退

1.3版本的插件在某些windows下(10台windows才有一台)会异常闪退无法使用,1.2版本都正常

Did not build on Qt 5.14 for Android/iOS/MacOS

Did not build on Qt 5.14 for all of Android build settings
.obj/armeabi-v7a/smain.o:smain.cpp:function SqliteCipherDriverPlugin::create(QString const&): error: undefined reference to 'operator new(unsigned int)' .obj/armeabi-v7a/smain.o:smain.cpp:function qt_plugin_instance: error: undefined reference to 'operator new(unsigned int)' .obj/armeabi-v7a/smain.o:smain.cpp:function qt_plugin_instance: error: undefined reference to '__cxa_guard_acquire' .obj/armeabi-v7a/smain.o:smain.cpp:function qt_plugin_instance: error: undefined reference to '__cxa_guard_release' .obj/armeabi-v7a/smain.o:smain.cpp:function SqliteCipherDriverPlugin::~SqliteCipherDriverPlugin(): error: undefined reference to 'operator delete(void*)' .obj/armeabi-v7a/smain.o:smain.cpp:function QWeakPointer<QObject>::~QWeakPointer(): error: undefined reference to 'operator delete(void*)' .obj/armeabi-v7a/smain.o:smain.cpp:typeinfo for SqliteCipherDriverPlugin: error: undefined reference to 'vtable for __cxxabiv1::__si_class_type_info' /Users/alexandr/Tools/android/sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function .obj/armeabi-v7a/sqlitecipher.o:sqlitecipher.cpp:function SQLiteResult::SQLiteResult(SQLiteCipherDriver const*): error: undefined reference to 'operator new(unsigned int)' .obj/armeabi-v7a/sqlitecipher.o:sqlitecipher.cpp:function SQLiteResult::~SQLiteResult(): error: undefined reference to 'operator delete(void*)' .obj/armeabi-v7a/sqlitecipher.o:sqlitecipher.cpp:function SQLiteCipherDriver::SQLiteCipherDriver(QObject*): error: undefined reference to 'operator new(unsigned int)' .obj/armeabi-v7a/sqlitecipher.o:sqlitecipher.cpp:function SQLiteCipherDriver::~SQLiteCipherDriver(): error: undefined reference to 'operator delete(void*)' .obj/armeabi-v7a/sqlitecipher.o:sqlitecipher.cpp:typeinfo for SQLiteResult: error: undefined reference to 'vtable for __cxxabiv1::__si_class_type_info' /Users/alexandr/Tools/android/sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function .obj/armeabi-v7a/sqlitecipher.o:sqlitecipher.cpp:typeinfo for QSqlCachedResultPrivate: error: undefined reference to 'vtable for __cxxabiv1::__si_class_type_info' /Users/alexandr/Tools/android/sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function .obj/armeabi-v7a/sqlitecipher.o:sqlitecipher.cpp:typeinfo for SQLiteResultPrivate: error: undefined reference to 'vtable for __cxxabiv1::__si_class_type_info' /Users/alexandr/Tools/android/sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function clang++: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [plugins/sqldrivers/libplugins_sqldrivers_sqlitecipher_armeabi-v7a.so] Error 1 11:53:26: The process "/Users/alexandr/Tools/android/sdk/ndk/20.1.5948944/prebuilt/darwin-x86_64/bin/make" exited with code 2. Error while building/deploying project sqlitecipher (kit: Android for (Clang Qt 5.14.0 for Android)) When executing step "Make"

SQL queries are not working when called from another thread

I'm developing an Android application in which I have multiple threads:

  • main Qt thread (UI);
  • service thread.

SQL queries work fine when executed from the main Qt thread but they all fail in the service thread.
I don't make SQL queries from multiple threads at the same time, just from another thread.

D libprotox_arm64-v8a.so: "SQL: INSERT INTO TextMessages (message, action) VALUES (:message, :action)"
D libprotox_arm64-v8a.so: "SQL: SELECT reference_id FROM TextMessages ORDER BY reference_id DESC LIMIT 1"
W libprotox_arm64-v8a.so: QSqlQuery::prepare: database not open
D libprotox_arm64-v8a.so: "SQL: "
D libprotox_arm64-v8a.so: "SQL error: Driver not loaded Driver not loaded"
W libprotox_arm64-v8a.so: QSqlQuery::value: not positioned on a valid record
D libprotox_arm64-v8a.so: "SQL: INSERT INTO Messages (public_key, type, reference_id, self, received, datetime, temporary, unique_id) VALUES (:public_key, :type, :reference_id, :self, :received, :datetime, :temporary, :unique_id)"
D libprotox_arm64-v8a.so: "SQL error: UNIQUE constraint failed: Messages.public_key, Messages.unique_id Unable to fetch row"

The error reports that the driver is not loaded, but qDebug() << QSQLDatabase::drivers();, when called in the service thread, reports that the driver is present:

D libprotox_arm64-v8a.so: ("QSQLITE", "SQLITECIPHER")

Qt windows static link

Hi,
i have a problem use the plugin statically linked on Qt-5.5 static windows. the function QSqlDatabase::isDriverAvailable("SQLITECIPHER") return false.

it does run fine on Qt MacOSX(static) and Qt Windows(dynamic). the function QSqlDatabase::isDriverAvailable("SQLITECIPHER") return true on both of them, and i can create tables insert records....

in my .pro filei have:
QTPLUGIN += sqlitecipher
macx:LIBS += -L/usr/local/Qt-5.5.1/plugins/sqldrivers -lsqlitecipher
win:LIBS += C:\qt-5.5-x64-source\qtbase\plugins\sqldrivers/sqlitecipher.lib
in my main.cpp file i have:

Q_IMPORT_PLUGIN(SqliteCipherDriverPlugin)

any idea why it does run on Qt static macosx and not on windows.

thanks.

error: inlining failed in call to always_inline '_mm_aesimc_si128': target specific option mismatch

E:\Applications\Qt\Tools\mingw730_64\lib\gcc\x86_64-w64-mingw32\7.3.0\include\wmmintrin.h:77: error: inlining failed in call to always_inline '_mm_aesimc_si128': target specific option mismatch
 _mm_aesimc_si128 (__m128i __X)
 ^~~~~~~~~~~~~~~~


E:/Applications/Qt/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/wmmintrin.h:77:1: error: inlining failed in call to always_inline '_mm_aesimc_si128': target specific option mismatch
 _mm_aesimc_si128 (__m128i __X)
 ^~~~~~~~~~~~~~~~
D:\Projects\GithubProjects\QtCipherSqlitePlugin\sqlitecipher\sqlite3\sqlite3mc_amalgamation.c:254177:26: note: called from here
         keySchedule[j] = _mm_aesimc_si128(tempKeySchedule[j]);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mingw32-make[2]: *** [Makefile.Debug:300: .obj/debug/sqlite3mc_amalgamation.o] Error 1

SOS!
How can I handle this error?

I got 25 errors building it in Android

I am trying to build it with qtcreator qt5.10.1 gcc4.9 jdk1.8 sdk26 ndk17 for android armv7 but i get 25 errors. in shatheer.c they all related with u64 .
this is the error message " use of a undeclared identifier u64"

QT5.5无法编译

请教下 Qt5.5下编译汇报找不Private Header的问题,这个需要怎么解决?

db.setConnectOptions("QSQLITE_CREATE_KEY"); it 's not work!

I build my project on Qt5.7.0 with mingw, when I set the connection options it was not work, but I didnt set this option it was worked! and I also cant not read the .db file with the sqlite db browser because of using that driver, but, actually, I didnt set password ,cause I havent set the connection options, It should not be encrypted. what's wrong with my project?

if(QSqlDatabase::contains("qt_sql_default_connection"))
{
db = QSqlDatabase::database("qt_sql_default_connection");
}
else
{
db=QSqlDatabase::addDatabase(dataBaseVersion);
}
db.setHostName(ip);
db.setPort(port.toInt());
db.setDatabaseName(dataBaseName);
db.setUserName(userName);
db.setPassword(passWord);
//db.setConnectOptions("QSQLITE_CREATE_KEY"); //if I set this connectionOptions, then I cant open my .db file.

Qt5.10.0 SQLITECIPHER driver not loaded

("QSQLITE", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7")
DB File Path is: "./test_c.db"
QSqlDatabase: SQLITECIPHER driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
Can not open connection: "Driver not loaded"

add files:
D:\Qt5.10.0\5.10.0\mingw53_32\plugins\sqldrivers\sqlitecipher.dll
D:\Qt5.10.0\Tools\QtCreator\bin\plugins\sqldrivers\sqlitecipher.dll

iOS error

install -m 644 -p libsqlitecipher.a /Users/angeluslove/Qt5.8.0/5.8/ios/plugins/sqldrivers/libsqlitecipher.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib -s /Users/angeluslove/Qt5.8.0/5.8/ios/plugins/sqldrivers/libsqlitecipher.a

but :

Starting remote process.
("QSQLITE")
QSqlDatabase: SQLITECIPHER driver not loaded
QSqlDatabase: available drivers: QSQLITE
Can not open connection: "Driver not loaded"
exited with exit code -1,
Run ended.

QSqlDatabase::isOpen returns incorrect data

if (_db.open()) {
	qDebug() << "db is OPEN: " << _db.isOpen();
}
else {
	qDebug() << "db is NOT open: " << _db.isOpen();
}

And the result is:
db is NOT open: true

Ubuntu 18.04
gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)
Qt 5.10.1 64bit

Do not build with Qt 5.15 and Qt 6.2.1/6.2.4

After this commit "3a3ca590 Trim option values." everything crashed when building it. Before it evrything ok for Qt 5.15

I have this troubles on MacOS with Qt 5.15 and Qt 6.2.1.

/Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250606:34: error: '__builtin_ia32_aeskeygenassist128' needs target feature aes temp = _mm_extract_epi32(_mm_aeskeygenassist_si128(_mm_setr_epi32(0, temp, 0, 0), 0), 1); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/__wmmintrin_aes.h:136:12: note: expanded from macro '_mm_aeskeygenassist_si128' (__m128i)__builtin_ia32_aeskeygenassist128((__v2di)(__m128i)(C), (int)(R)) ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250611:34: error: '__builtin_ia32_aeskeygenassist128' needs target feature aes temp = _mm_extract_epi32(_mm_aeskeygenassist_si128(_mm_setr_epi32(0, temp, 0, 0), 0), 0); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/__wmmintrin_aes.h:136:12: note: expanded from macro '_mm_aeskeygenassist_si128' (__m128i)__builtin_ia32_aeskeygenassist128((__v2di)(__m128i)(C), (int)(R)) ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250665:26: error: always_inline function '_mm_aesimc_si128' requires target feature 'aes', but would be inlined into function 'aesGenKeyDecrypt' that is compiled without support for 'aes' keySchedule[j] = _mm_aesimc_si128(tempKeySchedule[j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250714:18: error: always_inline function '_mm_aesenc_si128' requires target feature 'aes', but would be inlined into function 'aesEncryptCBC' that is compiled without support for 'aes' feedback = _mm_aesenc_si128(feedback, key[j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250716:16: error: always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'aesEncryptCBC' that is compiled without support for 'aes' feedback = _mm_aesenclast_si128(feedback, key[j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250737:18: error: always_inline function '_mm_aesenc_si128' requires target feature 'aes', but would be inlined into function 'aesEncryptCBC' that is compiled without support for 'aes' feedback = _mm_aesenc_si128(feedback, key[j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250739:16: error: always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'aesEncryptCBC' that is compiled without support for 'aes' feedback = _mm_aesenclast_si128(feedback, key[j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250786:14: error: always_inline function '_mm_aesdec_si128' requires target feature 'aes', but would be inlined into function 'aesDecryptCBC' that is compiled without support for 'aes' data = _mm_aesdec_si128(data, key[numberOfRounds - j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250788:12: error: always_inline function '_mm_aesdeclast_si128' requires target feature 'aes', but would be inlined into function 'aesDecryptCBC' that is compiled without support for 'aes' data = _mm_aesdeclast_si128(data, key[numberOfRounds - j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250801:14: error: always_inline function '_mm_aesdec_si128' requires target feature 'aes', but would be inlined into function 'aesDecryptCBC' that is compiled without support for 'aes' data = _mm_aesdec_si128(data, key[numberOfRounds - j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250803:12: error: always_inline function '_mm_aesdeclast_si128' requires target feature 'aes', but would be inlined into function 'aesDecryptCBC' that is compiled without support for 'aes' data = _mm_aesdeclast_si128(data, key[numberOfRounds - j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250827:14: error: always_inline function '_mm_aesdec_si128' requires target feature 'aes', but would be inlined into function 'aesDecryptCBC' that is compiled without support for 'aes' data = _mm_aesdec_si128(data, key[numberOfRounds - j]); ^ /Users/alexandr/Tools/QtCipherSqlitePlugin/sqlitecipher/sqlite3/sqlite3mc_amalgamation.c:250829:12: error: always_inline function '_mm_aesdeclast_si128' requires target feature 'aes', but would be inlined into function 'aesDecryptCBC' that is compiled without support for 'aes' data = _mm_aesdeclast_si128(data, key[numberOfRounds - j]);

Database encrypted by this plugin can't open by wxsqlite3_shell

Datbases: created with Qt 5.9.9 32bit + QtCipherSqlitePlugin 1.2,
Cipher method: chacha20 , sqlcipher
Password length: 5
database created and encrypted using the following source codes:

QSqlDatabase dbconn = QSqlDatabase::addDatabase("SQLITECIPHER");
dbconn.setDatabaseName("test.db");
dbconn.setPassword("12345");
dbconn.setConnectOptions("QSQLITE_USE_CIPHER=sqlcipher");
//dbconn.setConnectOptions("QSQLITE_USE_CIPHER=chacha20");
``

`
The generated test.db can't be open in wxsqlite3 shell (version: 4.0.4, 4.1.0, 4.5.1)
 [https://github.com/utelle/wxsqlite3/releases](https://github.com/utelle/wxsqlite3/releases) . 

CRASH when when using SQLITECIPHER

I compiled the plugin as detailed and copied the sqlitecipher.dll to the plugins/sqldrivers folder. I use the code below to open an existing encrypted database (encrypted using db browser for SQLCipher). And it works great.

However, when I try and run the program on another machine (with all the necessary .dlls copied over as well) it crashes on start-up when trying to open the database. Why is the exact same program and libraries not working on my other machine ? (Both Windows 10 64-bit).

QSqlDatabase db = QSqlDatabase::addDatabase("SQLITECIPHER");
db.setDatabaseName("myDB");
db.setPassword("myDBPassword");
db.setConnectOptions("QSQLITE_USE_CIPHER=sqlcipher; SQLCIPHER_LEGACY=1;");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.