Trying to copy an encrypted database to a new unencrypted database
SQLiteDatabaseHook hook = new SQLiteDatabaseHook() {
public void preKey(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.rawExecSQL("PRAGMA cipher_default_use_hmac = off;");
}
public void postKey(SQLiteDatabase sqLiteDatabase) {}
};
SQLiteDatabase myDb = SQLiteDatabase.openDatabase("/sdcard/bookscipher.db",
"new_password", null,1);
SQLiteDatabase.openOrCreateDatabase("/sdcard/plaintext.db", "", null,hook);
myDb.execSQL("PRAGMA key = 'new_password';");
myDb.execSQL("ATTACH DATABASE '/sdcard/plaintext.db' AS plaintext KEY '';");
**myDb.execSQL("SELECT sqlcipher_export('plaintext');");**
myDb.execSQL("DETACH DATABASE plaintext;");
sqlite returned: error code = 1, msg = statement aborts at 2: [SELECT sqlcipher_export(‘plaintext’);] table android_metadata already exists