How to implement SQLCipher when using SQLiteOpenHelper

后端 未结 2 703
遇见更好的自我
遇见更好的自我 2021-01-04 12:32

I am trying to secure some sensible data by implementing encryption in my already existing and functioning database setup in an android application.

I tried to follo

2条回答
  •  轮回少年
    2021-01-04 13:02

    In this situation how should I use SQLCipher?

    That is impossible to answer in the abstract. You would use it largely the same way that you use SQLite.

    Where should I define the password?

    You should get it from the user.

    Where should I use loadLibs(context)? Only in the main activity? Or in every activity that accesses the database?

    Once per process is sufficient (in fact, more could conceivably be a problem). If you are using a ContentProvider for your SQLCipher database, call loadLibs() in onCreate() of the ContentProvider. If you are using a custom Application, call loadLibs() in onCreate() of the Application.

提交回复
热议问题