Results 1 to 3 of 3

Thread: SQLCipher, Windows and Mac OS

  1. #1
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default SQLCipher, Windows and Mac OS

    Afternoon all --

    I've managed to perform a minor miracle and have compiled SQLCipher in Windows and on my Mac (following these instructions: https://sites.google.com/site/lukesh...er-for-windows and http://www.qtcentre.org/wiki/index.php?title=Building_QSQLITE_driver_with_AES-256_encryption_support_(Linux). On the Mac, w/out doing anything beyond the directions, when I execute the following code,

    Qt Code:
    1. #include <QtGui>
    2. #include <QtSql>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. qDebug() << QSqlDatabase::drivers();
    8. return 0;
    9. }
    To copy to clipboard, switch view to plain text mode 

    "QSQLCIPHER" does indeed show up. In Windows, I have modified my .pro to point to the new libraries accordingly, like so:
    Qt Code:
    1. win32 {
    2. message("Compiling for Windows!")
    3. LIBS += \
    4. c:\sqlcipher\.libs\libeay32.lib \
    5. c:\sqlcipher\.libs\libsqlite3.a \
    6. c:\sqlcipher\.libs\libgcc.a
    7.  
    8. INCLUDEPATH += c:\sqlcipher\
    9. }
    To copy to clipboard, switch view to plain text mode 
    but I *don't* see QSQLCIPHER using the same main.cpp

    So, now I'm stuck as to what to "include" to use SQLCipher on both platforms, and there's not much documentation out there about that. I tried to open my DB (that's non-encrypted right now) using SQLCipher on the Mac, and the database didn't open (and the error told me nothing). Obviously I'm missing something easy, possible the correct "include", so please feel free to embarrass me in getting beyond this. I'm stuck on the Windows side trying to make the code "see" SQLCipher and then on both platforms actually using it.


    Kodi

    ps -- still googling in the meantime and will update if I figure it out

    Ed. additional question -- is the sqlite3.h file created in the sqlcipher directory something I know need to be including? Should move it to build directory and/or add that directly into my project? Also, I found this link: https://code.google.com/p/qsqlcipher4win/downloads/list with a pre-compiled .dll (or course, after I spend hours creating a static one). Will I know how to add a library to my project I still can't get Windows working, and I think it's got something to do with the header file and making sure I have the right library linked in.
    Last edited by mtnbiker66; 11th October 2012 at 21:22.

  2. #2
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: SQLCipher, Windows and Mac OS

    Update:

    Still having trouble creating a library in Windows but I have generated the libraries on my Mac. Incorporated them into my project, but that's going haywire -- when I open my DB, which is unencrypted, using "QSQLCIPHER", I don't see any existing data in my models (I can see the data when opening with "QSQLITE"); however, executing direct queries/insert/deletes work just fine. In addition, while I can add data to my models, upon submitALL(), I get errors (near "," syntax error).

    Also, my app creates a DB w/all the necessary tables and seed data if one is not found, and the PRAGMA command doesn't appear to be actually encrypting the DB when I do this; the exec() returns isactive = TRUE but when I bring up the DB outside of my app, the data is not encrypted. I do make sure that's the first command I issue after my db.open() command for a new and an existing DB.

    Kodi

  3. #3
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: SQLCipher, Windows and Mac OS

    Another update:

    In Windows I've FINALLY managed to generate a dynamic library for SQLCIPHER in Windows, but I still can't see it in my app. I've copied the qsqlcipher4.dll to /plugins/sqldrivers folder along with libeay32.dll, but it won't load. From what I was reading it doesn't seem like modifications need to be made to my project file, but even when at add LIB += with the paths, that doesn't work either. I'm just wondering if anyone else can see the plugin in their app, and if so, what steps need to be done that I haven't? make install worked but now I'm stuck

Similar Threads

  1. Using NCReport with SQLCipher
    By SIFE in forum Qt Programming
    Replies: 2
    Last Post: 12th March 2012, 17:02
  2. Replies: 2
    Last Post: 16th November 2011, 22:19
  3. Encrypting an existing sqlite database in sqlcipher
    By thefatladysingsopera in forum Newbie
    Replies: 5
    Last Post: 21st October 2011, 18:47
  4. AES-256 encrypted SQLite databases with SQLCipher
    By Lykurg in forum Installation and Deployment
    Replies: 10
    Last Post: 29th July 2011, 03:22
  5. Replies: 2
    Last Post: 6th September 2010, 14:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.