{ "id": "174887", "key": "MOD-2593", "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-22T17:34:28.000+0000", "created": "2020-04-06T17:48:46.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "database", "encrypted_database", "encryption", "hash", "ios", "module", "performance" ], "versions": [], "issuelinks": [ { "id": "58301", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "174881", "key": "MOD-2591", "fields": { "summary": "Android: 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": "58302", "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": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-04-22T17:34:28.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": "67324", "filename": "DatabaseEncryptMigrationTest.js", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-06T19:24:53.000+0000", "size": 2388, "mimeType": "application/x-javascript" }, { "id": "67325", "filename": "DatabaseEncryptMigrationTest.png", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-06T19:34:11.000+0000", "size": 146724, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: 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, "comment": { "comments": [ { "id": "454986", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR - https://github.com/appcelerator-modules/appcelerator.encrypteddatabase/pull/49", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-06T18:27:45.000+0000", "updated": "2020-04-06T18:27:45.000+0000" }, { "id": "454988", "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. Particularly for testing the migration of the database when changing the hashing algorithm settings on the next time you open it.\r\n !DatabaseEncryptMigrationTest.png|thumbnail! ", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-06T19:34:17.000+0000", "updated": "2020-04-06T19:34:17.000+0000" }, { "id": "455213", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Works as expected. Checked with module 2.1.0. \r\nClosing.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-22T17:34:15.000+0000", "updated": "2020-04-22T17:34:23.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }