Project

General

Profile

sqlcipher

Added by Derek Spenser about 13 years ago

I was just wondering if anyone has looked into (or has experience with) sqlcipher? (sqlcipher.net)

After looking at the information provided on their web site, it would seem that a Wt::Dbo backend for sqlcipher wouldn't be too difficult to implement; it looks to be just sqlite with encryption. Any thoughts?


Replies (2)

RE: sqlcipher - Added by Koen Deforche about 13 years ago

Hey Derrek,

From reading the docs, it seems that you should be able to use the sqlite3 backend as is, by linking against the sqlcipher database instead of SQlite3 itself (you can disable the packaged SQlite3 amalgation using USE_SYSTEM_SQLITE3=ON), and use SQlite3::executeSql() with the pragmas to set the keys ?

Regards,

koen

RE: sqlcipher - Added by Stefan Bn over 3 years ago

Thanks for the hint! I've rebuilt WT 4.4.0 with the USE_SYSTEM_SQLITE3 build option and linked against the current SQLCipher Version 4.4.0 with MinGW on Windows. There is also no big change in my WT code needed though:

auto sqlite3 = std::make_unique<Dbo::backend::Sqlite3>(dbFileName);
sqlite3->setProperty("show-queries", "false");
this->setMappingClasses(this);
this->setConnection(std::move(sqlite3));

Dbo::Transaction t(*this);

// Set SQLite Cipher Encryption Key
std::string sqlStat = "PRAGMA key = 'test123'";
this->execute(sqlStat);

I get a perfectly encrypted database. I was worried about the version differences, however SQLCipher 4 works fine with the Wt dbo Sqlite3 backend :-)

    (1-2/2)