Change Password of the Database


Hi All,

I see that there is a method in net.sqlcipher.database.SQLiteOpenHelper changePassword(string). Is there any specific process to do this ? Meaning, I tried this method which ultimately threw

file is encrypted or is not a database when using onCreate(db) db object

or below error when using getWriteableDatabase(currentPassword)

net.sqlcipher.database.SQLiteException: unknown error
04-09 16:13:47.629: E/AndroidRuntime(23895): 	at net.sqlcipher.database.SQLiteDatabase.native_rekey(Native Method

Is this method intended to literally change the password of database at runtime ? Pls clarify


Hello @vinay_kumar

The changePassword(…) function performs a native call to sqlite3_rekey. Please note you must have successfully keyed the database prior to making this call. The documentation for the native call can be found here.


Thanks for that Nick…GOT IT WORKING