{ "id": "173661", "key": "MOD-2521", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10034", "key": "MOD", "name": "Appcelerator Modules", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2019-05-22T21:19:37.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "android", "encrypted_database", "sqlite" ], "versions": [], "issuelinks": [], "assignee": null, "updated": "2019-05-28T19:19:18.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "13609", "name": "Encrypted SQLite DB" } ], "description": "The code base used in the Encrypted Database module is sqlcipher.\r\n\r\nCurrently 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().\r\n\r\nThere 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.\r\n\r\nThis will open up the ability to perform operations before or after the key is provided within the open() function / openOrCreateDatabase() method.", "attachment": [], "flagged": false, "summary": "Encrypted Database: Android: Add access to preKey and postKey hooks ", "creator": { "name": "patakijv", "key": "patakijv", "displayName": "John V Pataki", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "patakijv", "key": "patakijv", "displayName": "John V Pataki", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Android", "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }