Comments (8)
Here is a very simple patch that will fix this issue and it is backwards compatible. I applied it and tested it against the v2 branch.
--- src/net/sqlcipher/database/SQLiteDatabase.java (revision 2a7b24d6eecc6b8ff2ccffbe2a0d4d745ea5ace0)
+++ src/net/sqlcipher/database/SQLiteDatabase.java (revision )
@@ -103,11 +103,10 @@
}
}
- private static void loadICUData(Context context) {
+ private static void loadICUData(Context context, File workingDir) {
try {
- File applicationFilesDirectory = context.getFilesDir();
- File icuDir = new File(applicationFilesDirectory, "icu");
+ File icuDir = new File(workingDir, "icu");
if(!icuDir.exists()) icuDir.mkdirs();
File icuDataFile = new File(icuDir, "icudt46l.dat");
if(!icuDataFile.exists()) {
@@ -130,19 +129,23 @@
}
}
- public static void loadLibs (Context context)
+ public static void loadLibs (Context context) {
+ loadLibs(context, context.getFilesDir());
+ }
+
+ public static void loadLibs (Context context, File workingDir)
{
System.loadLibrary("stlport_shared");
System.loadLibrary("sqlcipher_android");
System.loadLibrary("database_sqlcipher");
boolean systemICUFileExists = new File("/system/usr/icu/icudt46l.dat").exists();
- File applicationFilesDirectory = context.getFilesDir();
- String icuRootPath = systemICUFileExists ? "/system/usr" : applicationFilesDirectory.getAbsolutePath();
+
+ String icuRootPath = systemICUFileExists ? "/system/usr" : workingDir.getAbsolutePath();
setICURoot(icuRootPath);
if(!systemICUFileExists){
- loadICUData(context);
+ loadICUData(context, workingDir);
}
}
from android-database-sqlcipher.
Hi jeffdcamp,
Thanks for taking a look at this. Would you mind sending a pull request for the change? Thanks!
from android-database-sqlcipher.
I just submitted 2 pull requests for the change.... one for master (version 1.1) and one for v2 (2.0)
from android-database-sqlcipher.
Hi jeffdcamp,
Thanks for submitting that. I'll review it this afternoon and if everything runs smooth with our test suite I will merge it into the v2 branch. v2 will be merged back into master soon so no need for the extra pull request. Thanks again!
from android-database-sqlcipher.
I know this is not the place for this comment.... but is there a developer group that I can post comments/questions to? (I'm concerned about compatibility/migration from v1.1 to v2.0... my 1.1 database didn't seem to open when I compiled v2 branch and tried to open an existing 1.1 database using v2 code)
from android-database-sqlcipher.
Hi jeffdcamp,
There is a difference between the database format in 2.0 vs. 1.1. I have added a upgrade method in v2 called SQLiteDatabase.upgradeDatabaseFormatFromVersion1To2
to perform the upgrade. If you need to maintain the 1.1 format but want to use the 2.0 library I have also added a SQLiteDatabaseHook
interface that you can pass into the SQLDatabase.openOrCreateDatabase
method which will allow you to open a 1.1 database without issues/upgrading with the 2.0 sqlcipher core. Note this is only available in the v2 branch. To do something like that it would look like:
SQLiteDatabaseHook hook = new SQLiteDatabaseHook(){
public void preKey(SQLiteDatabase database){
database.rawExecSQL("PRAGMA cipher_default_use_hmac = off");
}
public void postKey(SQLiteDatabase database){}
}
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databasePath,
password, null, hook);
from android-database-sqlcipher.
FYI... I've been using this feature ("ICU dat file on SD card") in 2.0RC5 for quite some time and on many devices using many different versions of Android and this has been working great.
Jeff
from android-database-sqlcipher.
Jeff,
Glad to hear it's working well for you, thanks for reporting back!
from android-database-sqlcipher.
Related Issues (20)
- 4.5.3, the relevant so file depends on the component version HOT 1
- Your application is using a defective version of the OpenSSL library that may cause the application to crash. HOT 2
- Vulnerability in openssl-1.1.1s HOT 1
- android.database.sqlite.SQLiteException: SQL logic error: , while compiling: select count(*) from sqlite_master; HOT 1
- How to create new password if previous one forget or wrong HOT 1
- java.lang.IllegalStateException: database /data/user/0/<app>/databases/<app>_encrypted.db already closed HOT 7
- Database gets corrupted if the database is open while the application is updated HOT 4
- Can not create writeable HOT 1
- Exception on API level 28 HOT 4
- Thread synchronisation issue in SQLiteCompiledSQL.releaseReference() which causes a double free in SQLiteCompiledSQL native_finalize HOT 3
- java.util.concurrent.TimeoutException: net.sqlcipher.database.SQLiteCursor.finalize() timed out after 10 seconds HOT 1
- android.database.sqlite.SQLiteException: unable to close due to unfinalized statements or unfinished backups: sqlite3_close() failed HOT 2
- Getting java.lang.UnsatisfiedLinkError HOT 11
- Fatal Exception: android.database.sqlite.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master; HOT 4
- new version not support armeabi HOT 3
- Vulnerability in openssl-1.1.1q CVE-2023-5678 HOT 1
- Vulnerability in SQLite3.39.2 BDSA-2023-3555 HOT 1
- AndroidRuntime: net.sqlcipher.database.SQLiteException: no such table: room_table_modification_log: , while compiling: SELECT * FROM room_table_modification_log WHERE invalidated = 1; HOT 2
- Vulnerability in SQLite3.39.2 CVE-2024-0232 HOT 5
- Vulnerability in SQLite3.39.2 BDSA-2023-3627 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-database-sqlcipher.