We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DBFlow Version: 4.2.4
Bug or Feature Request: Bug
Description:
I am using DBFlow with SQLCipher. I am trying to encrypt the already existing SQLite Database(using DBFlow) with SQLCipher in Android.
I used the following code to encrypt the DB:
private void encryptDB() { String password = "test123"; String LEGACY_DATABASE_NAME = "legacy.db"; String NEW_DATABASE_NAME = "new_crypt.db"; File newDBFile = getDatabasePath(NEW_DATABASE_NAME); File legacyFile = getDatabasePath(LEGACY_DATABASE_NAME); if (!newDBFile.exists() && legacyFile.exists()) { SQLiteDatabase.loadLibs(this); SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(legacyFile, "", null); db.rawExecSQL(String.format("ATTACH DATABASE '%s' AS encrypted KEY '%s';", newDBFile.getAbsolutePath(), password)); db.rawExecSQL("SELECT sqlcipher_export('encrypted')"); db.rawExecSQL("DETACH DATABASE encrypted;"); // db = SQLiteDatabase.openOrCreateDatabase(newDBFile, password, null); db = SQLiteDatabase.openDatabase(newDBFile.getAbsolutePath(), password, null, SQLiteDatabase.OPEN_READWRITE); legacyFile.delete(); newDBFile.renameTo(legacyFile); boolean open = db.isOpen(); Log.d("isOpen", ""+ open); // this is getting as true } }
The DB is encrypted fine but when I am trying to write any operations then getting the following exception:
io.reactivex.exceptions.UndeliverableException: android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032 SQLITE_READONLY_DBMOVED[1032])
I found a similar post here https://stackoverflow.com/q/36070088/2462531 but not found any solution to it.
Also, I found this https://stackoverflow.com/questions/37939513/sqlcipher-along-with-dbflow/41812230#41812230 to encrypt the DBFlow database with SQLCipher and implemented it. Then it is working if I install it as a fresh app but when I install this app on top of the old app which is having not encrypted DB then it is failing.
net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
Please suggest how can I fix this?
See my question in SOF here: https://stackoverflow.com/q/67226149/2462531
The text was updated successfully, but these errors were encountered:
No branches or pull requests
DBFlow Version: 4.2.4
Bug or Feature Request: Bug
Description:
I am using DBFlow with SQLCipher. I am trying to encrypt the already existing SQLite Database(using DBFlow) with SQLCipher in Android.
I used the following code to encrypt the DB:
The DB is encrypted fine but when I am trying to write any operations then getting the following exception:
I found a similar post here https://stackoverflow.com/q/36070088/2462531 but not found any solution to it.
Also, I found this https://stackoverflow.com/questions/37939513/sqlcipher-along-with-dbflow/41812230#41812230 to encrypt the DBFlow database with SQLCipher and implemented it. Then it is working if I install it as a fresh app but when I install this app on top of the old app which is having not encrypted DB then it is failing.
Please suggest how can I fix this?
See my question in SOF here:
https://stackoverflow.com/q/67226149/2462531
The text was updated successfully, but these errors were encountered: