{ "id": "174881", "key": "MOD-2591", "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": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-04-15T01:35:05.000+0000", "created": "2020-04-04T03:39:21.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "database", "encrypted_database", "encryption", "hash", "module", "performance" ], "versions": [], "issuelinks": [ { "id": "58301", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "174887", "key": "MOD-2593", "fields": { "summary": "iOS: Add properties \"hmacAlgorithm\" and \"hmacKdfIterations\" to encrypted DB module", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "58299", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "174808", "key": "TIMOB-27803", "fields": { "summary": " Performance delays with encrypted db module 2.0.7", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-04-22T17:36:47.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13609", "name": "Encrypted SQLite DB" } ], "description": "*Summary:*\r\nThe \"appcelerator.encrypteddatabase\" module's default settings for its hashing algorithm has changed recently from {{SHA1}} to {{SHA512}}, with KDF iterations from {{64000}} to {{256000}}. While this has made it much more secure, it comes at the cost of performance.\r\n\r\nOn Android, the defaults changed in module v3.0.3.\r\nOn iOS, the defaults changed in module v2.0.6.\r\n\r\nWe should add new properties that allowing app developers to control these settings.\r\n(ie: Sacrifice security for speed or sacrifice speed for security.)\r\n\r\n*Requirements:*\r\nAdd the following constants to the module. These must be integer IDs.\r\n* {{HMAC_SHA1}}\r\n* {{HMAC_SHA256}}\r\n* {{HMAC_SHA512}}\r\n\r\nAdd the following properties to the module.\r\n* {{hmacAlgorithm}} - to be assigned one of the above constants. Defaults to {{HMAC_SHA512}}.\r\n* {{hmacKdfIterations}} - to be assigned an integer. Defaults to {{256000}}. Min value is {{4000}}.\r\n\r\nThe above properties are \"stateful\" like the {{password}} property. Meaning that they affect the next time you call the {{open()}} method. When opening an existing database with different hmac settings above, then the module must auto-migrate it to use the module's current hmac settings.\r\n\r\n*Usage Test:*\r\n{code:javascript}\r\nvar database = require(\"appcelerator.encrypteddatabase\");\r\ndatabase.password = \"password\";\r\n\r\n//database.hmacAlgorithm = database.HMAC_SHA1;\r\ndatabase.hmacAlgorithm = database.HMAC_SHA256;\r\n//database.hmacAlgorithm = database.HMAC_SHA512;\r\n\r\ndatabase.hmacKdfIterations = 64000;\r\n//database.hmacKdfIterations = 128000;\r\n//database.hmacKdfIterations = 256000;\r\n\r\nvar openStartTime = new Date();\r\nvar dbConnection = database.open(\"test_encrypted.db\");\r\nTi.API.info(\"@@@ DB open duration: \" + (new Date() - openStartTime) + \" ms\");\r\n\r\ndbConnection.execute(\"CREATE TABLE IF NOT EXISTS test(id integer PRIMARY KEY, name TEXT);\");\r\ndbConnection.execute(\"INSERT OR REPLACE INTO test(id, name) VALUES (?, ?)\", 1, \"Hello World\");\r\ndbConnection.close();\r\n{code}\r\n", "attachment": [ { "id": "67323", "filename": "DatabaseEncryptMigrationTest.js", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-06T19:24:02.000+0000", "size": 2388, "mimeType": "application/x-javascript" }, { "id": "67326", "filename": "DatabaseEncryptMigrationTest.png", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-06T19:37:33.000+0000", "size": 157626, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Add properties \"hmacAlgorithm\" and \"hmacKdfIterations\" to encrypted DB module", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1192, "state": "closed", "name": "2020 Sprint 8", "startDate": "2020-04-10T18:08:36.092Z", "endDate": "2020-04-24T18:08:00.000Z", "completeDate": "2020-04-24T16:23:30.466Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "454970", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (android): https://github.com/appcelerator-modules/appcelerator.encrypteddatabase/pull/48\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-04T04:08:06.000+0000", "updated": "2020-04-04T04:08:06.000+0000" }, { "id": "454989", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The attached [^DatabaseEncryptMigrationTest.js] script can help test this change.\r\n !DatabaseEncryptMigrationTest.png|thumbnail! ", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-06T19:37:35.000+0000", "updated": "2020-04-06T19:37:35.000+0000" }, { "id": "455137", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR Merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-15T01:35:22.000+0000", "updated": "2020-04-15T01:35:22.000+0000" }, { "id": "455191", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Here is a back-port which will work with Titanium 7.0.0+. (Not built with gradle.)\r\nPR (android)(3_3_X): https://github.com/appcelerator-modules/appcelerator.encrypteddatabase/pull/50\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-20T20:35:40.000+0000", "updated": "2020-04-20T20:35:40.000+0000" }, { "id": "455205", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This updates the documented properties to the back-ported version.\r\nPR: https://github.com/appcelerator-modules/appcelerator.encrypteddatabase/pull/51", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-21T22:29:49.000+0000", "updated": "2020-04-21T22:29:49.000+0000" }, { "id": "455214", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the improvements in 4.1.0 & backported 3.3.0 module .\r\nClosing.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-22T17:36:25.000+0000", "updated": "2020-04-22T17:36:25.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }