GreenDAO with Sqlcipher Integration Example

放肆的年华 提交于 2019-12-22 04:02:30

问题


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.


回答1:


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:

Database snapshot:



来源:https://stackoverflow.com/questions/22196368/greendao-with-sqlcipher-integration-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!