Hi,Poco is fantastic library. The one thing that is missing would be encrypted SQLite.I have tried to do it on my own, I used modified SQLite available here http://www.zetetic.net/software/sqlcipher so that was pretty easy to compile. But I haven't tested it yet.

It looks like SQLCipher is at least source compatible with SQLite.. for unofficial purposes it looks like it might be as easy as statically building/linking SQLCipher and dropping it in place into the Poco build.

Ok, I managed to replace sqlite.c in Data with SQLCipher and had to do some config changes but it built.Now I just need to run some tests to see that the encryption features work, after that, I'll post how to build it if anyone needs it.Also, I currently work on windows only, so the changes where to the solution file for the Data/SQLite module, perhaps someone will help me to configure and build on other platforms to see if it works as well?I'll post my changes ASAP, I just need a couple of hours to leave work and get home.

Ok, It's a mess to be able to integrate SQLCipher, mostly because of the way the SQLite code is modified.I think I'll analyze how the SQLCipher code works, and then, instead of using directly openSSL and having to do a mess for building it, I'll use POCO crypto, so when someone wants to build POCO with crypto, you'll get the crypto options for SQLite.

Also another problem for using SQLCipher, is that because most changes in SQLite are spread throughout the code, it's harder for SQLCipher developers to upgrade SQLite everytime a new release is ready, so for example, right now, SQLite is on version 3.7.5, whereas the latest release of SQLCipher is based on 3.7.2.

I'll see what I can do, if anyone else is willing to help me, just message me, as this is also gonna be a learning experience, as I haven't used POCO crypto before.

Ok, I managed to build SQLCipher as an SQLite amalgamation on windows using cygwin, after that, I replaced the Data/SQLite/src sqlite3.h and sqlite3.c files with the SQLCipher amalgamated files.

Then added these two preprocessor directives for building: SQLITE_HAS_CODEC and SQLITE_TEMP_STORE=2 to the MSVC solution.After that, I added in the include paths, the path to my openssl include folder.Then I added in the lib paths, the path to my openssl lib folder.For the shared builds, I added in the Linker -> Input -> Additional Dependencies: libeay32.libFor the static builds, I added to Librarian -> Additional Dependencies: libeay32.lib

After that, just build, and for testing, I used the Tuple example for SQLite, first, I ran the example as it comes out of the box, and it generates a sample.db file, I opened the file with a Hex Editor, and I was able to read the data in clear text, and saw the Lisa and Bart Simpson text.Now, for testing the encryption, I added the following code right after the: session << "CREATE TABLE Person ... line:

After that, it was able to print out the data to the screen, so it means it was able to read it correctly, and when I opened the sample.db file with the hex editor again, I saw garbage instead of clear text, which means the encryption was successful.

Can somebody please help me test this on other platforms to see that it works and see how can we integrate this to the POCO source?

I'm trying to attach the sqlite3 amalgamation files I created, but I guess the forum has issues with the 1MB zip file.

With the help of sqlcipher forums i managed to build sqlcipher in windows with sqlcipher.dll.I'm not clear with few things:1.) The files u mentioned "SQLCipher amalgamated files" they are the files dropped out during sqlcipher build isn't it?2.) After replacing "sqlite3.h and sqlite3.c " did you rebuilt poco?

Things which i followed and got hooked with unencrypted DB:1.)I built sqlcipher using mysys.2.)Replaced Data/SQLite/src "sqlite3.h and sqlite3.c" with files dropped out in sqlcipher build directory during sqlcipher build.3.)Rebuilt poco in windows. Got some undefined reference in sqlite3.c Fixed it by manually defining preprocessor (SQLITE_TEMP_STORE=2, SQLITE_HAS_CODEC) in SQLite_vs90.sln. so finally built with no errors.4.)I tried the Tuples examples which you mentioned above. Ended up with unencrypted DB.

can you plz tell me where i went wrong........

raulgd wrote:Ok, I managed to build SQLCipher as an SQLite amalgamation on windows using cygwin, after that, I replaced the Data/SQLite/src sqlite3.h and sqlite3.c files with the SQLCipher amalgamated files.

Then added these two preprocessor directives for building: SQLITE_HAS_CODEC and SQLITE_TEMP_STORE=2 to the MSVC solution.After that, I added in the include paths, the path to my openssl include folder.Then I added in the lib paths, the path to my openssl lib folder.For the shared builds, I added in the Linker -> Input -> Additional Dependencies: libeay32.libFor the static builds, I added to Librarian -> Additional Dependencies: libeay32.lib

After that, just build, and for testing, I used the Tuple example for SQLite, first, I ran the example as it comes out of the box, and it generates a sample.db file, I opened the file with a Hex Editor, and I was able to read the data in clear text, and saw the Lisa and Bart Simpson text.Now, for testing the encryption, I added the following code right after the: session << "CREATE TABLE Person ... line:

After that, it was able to print out the data to the screen, so it means it was able to read it correctly, and when I opened the sample.db file with the hex editor again, I saw garbage instead of clear text, which means the encryption was successful.

Can somebody please help me test this on other platforms to see that it works and see how can we integrate this to the POCO source?

I'm trying to attach the sqlite3 amalgamation files I created, but I guess the forum has issues with the 1MB zip file.

No, the amalgamated files is not what the build drops out.The problem is that you built the DLL instead of the amalgamation.In SQLite, an amalgamation is that when you build the project, instead of getting a library, you get as the output a sqlite3.h and sqlite3.c files, where all of the original source files are placed together inside them, so what you do is, build the amalgamation files instead of the DLL, replace the POCO SQLite amalgamation with the ones you've built from sqlcipher, then on the VS projects, add the preprocessor definitions and the OpenSSL includes and libeay library to your project properties, and then build poco.

So the result would be that you will use poco with Data/SQLite, but because you replaced it with sqlcipher, you'll be able to use the PRAGMA directive as well for crypting your SQLite database.