How should I use sqlcipher for android 3.x to read 2.x database.
Hi @Rajesh
If the 2.x database is not modifying the standard configuration options, you can use the postKey(…)
event of the SQLiteDatabaseHook
and adjust the KDF iteration length to 4000 using the following command:
PRAGMA kdf_iter = 4000;
I had downloaded the sqlcipher-for-android v2.2.2, I want to use it to read the database, and my ide is android studio. In the build.gradle file, below is the code:
`repositories {
maven {
url “https://repo.commonsware.com.s3.amazonaws.com”
}
}
dependencies {
compile fileTree(include: [’*.jar’], dir: ‘libs’)
testCompile 'junit:junit:4.12’
compile 'com.android.support:appcompat-v7:24.0.0-alpha2’
compile 'com.commonsware.cwac:sqlcipher-for-android:3.3.1’
compile files(‘libs/commons-codec.jar’)
compile files(‘libs/guava-r09.jar’)
compile files(‘libs/sqlcipher.jar’)
}`
how should I change the code to make sqlcipher become to version 2.
I have find this post: android-studio-integration, and this solved my problem . AndI find a another problem that I cant use the password to decrypt the database, but I can use the password to decrypt the database in the windows system. and both sqlcipher are v2.x
Hello @Rajesh
Our recommendation would be to use SQLCipher for Android 3.x (the current release is 3.5.1) and adjust your KDF iteration length when you need to access a 2.x database as I mentioned above.
Are you using the SQLCipher command line shell to open the database successfully, or are you using your application on Windows? Are there any runtime configuration changes being made when connecting to the database?
I’m using my application on Windows. and I havn’t change any configration. OK, I will download the lastest version and try it again.
Ok, I had solved the problem, it’s because I hadn’t set the SQLiteDatabase.NO_LOCALIZED_COLLATORS
,I had found it always been wrong when step to this.setLocale(Locale.getDefault());
. Oh my god , what a stupid mistake.
Hi @Rajesh
Thank you for getting back to us, we are glad to hear everything is working well for you now. Take care!