Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GreenDAO with Sqlcipher Integration Example

I have setup a new project using GreenDAO, was able to generate with ExampleDAO using DaoGenerator. Everything works fine.

I also have a prepopulated sqlite database shipped in android assets folder, on app run, it is being copied to android database system path.

Now I want to integrate with SqlCipher, to have my database encrypted... If anybody can help or give example app, that would be a great help.

like image 331
Faisal Basra Avatar asked Mar 05 '14 11:03

Faisal Basra


1 Answers

Please let me know if these solutions work for you:

A sample project with the integration: https://github.com/ywenblocker/GreenDao-SQLCipher

Here is the original thread with all discussion about how to implement it: https://github.com/greenrobot/greenDAO/issues/6

Edit:

After removing the private libraries from the build path, and adding them again, I found a not implemented method of DevOpenHelper:

sDaoMaster = new DaoMaster(sDevOpenHelper.getWritableDatabase("secret-key"));

There was no such method implemented on the sample project, unfortunately it looks like you should implement the getWritable and getReadable methods all by yourself. Without these modifications you would get a non-encrypted database, as shown by screenshoots below:

Device ScreenShot:

enter image description here

Database snapshot:

enter image description here

like image 200
carlosmaciel Avatar answered Oct 06 '22 08:10

carlosmaciel