Good afternoon.
I am creating an encrypted database file in an Android Application with the following code:
String dbPath = context.getDatabasePath(NAME_OF_MY_FILE).getPath();
SQLiteDatabase sampleDB = SQLiteDatabase.openOrCreateDatabase(dbPath, "password", null);
This works fine and the file is created although when trying to access this encrypted file I get multiple errors such as:
no such table TABLE_NAME and file is encrypted or is not a database
I am simply using the same code to open the file for editing, since the function is called openOrCreateDatabase()
. I assume the process to open the file is simply the reverse of creating, and you pass the original password?
Please note I am using the correct import:
import net.sqlcipher.database.SQLiteDatabase;
and initializing SQLiteDatabase.loadLibs(this);
in the onCreate()
method.
Can someone please point out where I'm going wrong if they have any idea.
Thank you!