Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLCipher Loadlibs and db password change

SQLCipher website mentions

"Init the database in onCreate() using SQLiteDatabase.loadLibs(this); //first init the db libraries with the context"

  1. I am calling this loadlibs only once in my first activity (seems to be working). I want to make sure I do not need to call this function for every activity that might access the database. Is this correct?

  2. How do I change the database password? I tried rekey but that does not work. It still takes the old password.

Any help would be appreciated.

Thank you.

like image 302
lumpawire Avatar asked Nov 23 '25 02:11

lumpawire


1 Answers

SQLiteDatabase.rawExecSQL("PRAGMA key = 'old_password';");
SQLiteDatabase.rawExecSQL("PRAGMA rekey = 'new_password';");
like image 159
boiledwater Avatar answered Nov 25 '25 15:11

boiledwater