0

I'm trying to use a row key data in order to avoid key derivation (According to the SQLCipher documentation):

this.myDb = SQLiteDatabase.openOrCreateDatabase(databaseFile, "", null);
this.myDb.rawExecSQL("PRAGMA key = \"x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'\"");
Cursor myCursor = this.myDb.rawQuery(query, params);

When I force the application to stop, accessing the data becomes impossible.

This behaviour does not happen without using SQLCipher. The database is readable even after forcing application to stop.

I'm I doing something wrong ?

Thanks in advance,

ridan
  • 858
  • 3
  • 11
  • 24
  • This appears to be the same question asked on the GitHub Issues page [here](https://github.com/sqlcipher/android-database-sqlcipher/issues/62), I have commented there asking for additional information. – Nick Parker Aug 27 '12 at 13:07
  • Additional information is given on the issue :-) – ridan Aug 27 '12 at 21:17

3 Answers3

0

My understanding is that the database is not accessible except by the app - this is to prevent other apps from accessing data they shouldn't

Martin
  • 4,711
  • 4
  • 29
  • 37
  • It is possible to specify a key directly in order to bypass key derivation. With this, the database can be readable even after restarting the phone or forcing the application to stop. – ridan Aug 26 '12 at 11:08
0

You need to show us more code so we be able to give you the right answer.

Your call is equal to

SQLiteDatabase.openDataBase(databaseFile.getPath(),"", CREATE_IF_NECESSARY, null);

When you force close your application everething is restored, including all the static params. So the only thing that can effect from previously run of the application is the data you are saving at the data base. So try to look at that direction.

Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216
  • I'm using this Cordova plugin for Android to access SQLite Database: [link](https://github.com/chbrody/Cordova-SQLitePlugin/blob/master/Android/src/com/phonegap/plugin/sqlitePlugin/SQLitePlugin.java) I've made a few changes to use SQLCipher [link](http://mobileapphelp.blogspot.com/2012/08/trying-sqlcipher-with-cordova.html) – ridan Aug 26 '12 at 11:18
0

For those who are facing the same problem, a solution is given here:

https://github.com/sqlcipher/android-database-sqlcipher/issues/62#issuecomment-8090646

ridan
  • 858
  • 3
  • 11
  • 24