-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
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
Unable to access database using raw key data after forcing app to stop #62
Comments
Hi elasrinadir, Could you clarify what you are trying to do and where the situation is failing for you? Are you failing to reopen the database once you launch the application again? Using SQLCipher, the entire contents of the database are encrypted, so you would need either a SQLCipher command line tool or a SQLCipher client library along with they key to access the contents of the database. More information will be helpful in understanding the problem you are facing. Thanks! |
Thank you for replying, I'm using this Cordova plugin for Android to access SQLite Database. I've made a few changes to use SQLCipher. sql transactions works fine and the database is encrypted as expected. The problem is that when the application is forced to stop or when the phone is restarted the database becomes unreadable. I suppose that this is a normal behaviour when the openOrCreateDatabase() is given a string as second parameter. The derivated key is probably kept in memory and used during the application runtime. What I'm trying to do is to keep access to my database in case of an application shutdown or OS reboot. The idea is to specify a key directly in order to bypass PBKDF2 key derivation. It is possible according to the sqlcipher documentation. So it seems that all I have to do is to provide the byte sequence after calling openOrCreateDatabase(). I thought that can be done by giving the raw key data just after opening the databae. Like that: this.myDb = SQLiteDatabase.openOrCreateDatabase(databaseFile, "", null);
this.myDb.rawExecSQL("PRAGMA key = \"x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'\""); Unfortunately, it does not work. Just in case, I'm not a Java developer and speak just a little english. I tried to explain the problem as best as I could. If you need any additional information let me know, Thank you for your help. |
Hi elasrinadir, You are passing an empty string as your password to
|
I finally find the problem: In the sample code given here, the delete method of databaseFile object is called just before openOrCreateDatabase. Removing the two calls before this method fixes the problem. However I don't know if removing those calls will generate side effects. Anyway thank you a lot for your support :-) I do use your code this way (Simply replacing single quotes, which throw an sql error): this.myDb = SQLiteDatabase.openOrCreateDatabase(databaseFile, "x\"2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99\"", null); Cheers, |
Hi elasrinadir, Glad to hear you've resolved your conflict! Thanks for letting us know. |
Hi,
I'm trying to use a row key data in order to avoid key derivation (According to the documentation http://sqlcipher.net/sqlcipher-api/#key):
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,
The text was updated successfully, but these errors were encountered: