Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2521] Encrypted Database: Android: Add access to preKey and postKey hooks

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsEncrypted SQLite DB
Labelsandroid, encrypted_database, sqlite
ReporterJohn V Pataki
AssigneeUnknown
Created2019-05-22T21:19:37.000+0000
Updated2019-05-28T19:19:18.000+0000

Description

The code base used in the Encrypted Database module is sqlcipher. Currently the module relies on the java openOrCreateDatabase() method which passes in the key at the java level (not at the javascript level) wrapped up in the open() function called in javascript. This means you can't set any PRAGMAs just before or just after the key is set. There are valid reasons (I will articulate in another ticket an actual issue found) for why you may want to set a PRAGMA before or after the key is provided, but before the other operations (like the test against sqlite_master) in openOrCreateDatabase(). There exists already accepts these two hooks that can be called in the sqlcipher code for preKey() and postKey() and a construct for handling it as [SQLiteDatabaseHook](https://github.com/sqlcipher/android-database-sqlcipher/blob/master/android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabaseHook.java) and you can see in this method [keyDatabase](https://github.com/sqlcipher/android-database-sqlcipher/blob/79bfeedaedfc5329e31c70a47666c9f7eaf20d87/android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java#L2633) the way those hooks are applied before and after the actual key "run" step. This will open up the ability to perform operations before or after the key is provided within the open() function / openOrCreateDatabase() method.

Comments

No comments

JSON Source