{ "id": "172416", "key": "AC-5961", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2019-01-08T21:40:56.000+0000", "created": "2018-10-10T04:57:12.000+0000", "labels": [ "android", "keychain-access" ], "versions": [ { "id": "17038", "name": "Appcelerator Studio 4.5.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-01-09T14:16:38.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "The Ti.Identity.Keychain module throws an error when reading a keychain item.\r\nIt seems the error is thrown when the text is too long.\r\n\r\nSteps to reproduce\r\n \r\n{noformat}\r\n\r\nvar keychainItem = globals.identity.createKeychainItem({\r\n identifier: \"myIdentifier\"\r\n});\r\n\r\n\r\nkeychainItem.addEventListener('save', function(e) {\r\n\r\n if (e.success == 1) {\r\n keychainItem.read();\r\n\r\n }\r\n});\r\n\r\n\r\nkeychainItem.addEventListener('read', function(e) {\r\n\r\n console.error(\"keychain read error\", e);\r\n\r\n});\r\n\r\nkeychainItem.save(\"my very long string that isn't really that long but it long enough to cause the issue\");\r\n{noformat}\r\n\r\n \r\nerror\r\n \r\n\r\n{noformat}\r\nno value is returned\r\n\r\n{\"type\":\"read\",\"source\":{\"accessControlMode\":0,\"accessibilityMode\":0,\"identifier\":\"myIdentifier\",\"cipher\":\"AES/CBC/PKCS7Padding\",\"apiName\":\"ti.touchid.KeychainItem\",\"bubbleParent\":true,\"_events\":{\"save\":{},\"read\":{}}},\"identifier\":\"myIdentifier\",\"error\":null,\"bubbles\":false,\"success\":false,\"code\":-1,\"cancelBubble\":false}\r\n{noformat}\r\n\r\n \r\n", "attachment": [], "flagged": false, "summary": "Ti.Identity.Keychain read error in Android", "creator": { "name": "cmoss", "key": "cmoss", "displayName": "Christian Moss", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "cmoss", "key": "cmoss", "displayName": "Christian Moss", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK 7.4.0.GA\r\nAxway Appcelerator Studio, build: 5.1.1.201809051655\r\nMacOS\r\nAndroid API 27", "comment": { "comments": [ { "id": "444037", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello [~cmoss],\r\nThanks for reporting this. Which's your module version? Can you please test this on 7.5.0.GA again and let us know how it goes. It would be helpful if you can share your complete console log, test steps to reproduce this and environment details here.\r\n\r\n", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-11-29T06:21:29.000+0000", "updated": "2018-11-29T06:21:29.000+0000" }, { "id": "444344", "author": { "name": "cmoss", "key": "cmoss", "displayName": "Christian Moss", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi @Rakhi Mitro\r\n\r\nyes same on 7.5.0.GA\r\n\r\n```\r\nvar keychainItem = Identity.createKeychainItem({\r\n\t\tidentifier: \"myIdentifierNew\"\r\n\t});\r\n\r\n\tkeychainItem.addEventListener('save', function(e) {\r\n\r\n\t\tif (e.success == 1) {\r\n\t\t\tconsole.log(\"Keychain saved\");\r\n\t\t\tkeychainItem.read();\r\n\r\n\t\t}\r\n\t});\r\n\r\n\tkeychainItem.addEventListener('read', function(e) {\r\n\t\tif (e.success == 1) {\r\n\t\t\tconsole.log(e.value);\r\n\r\n\t\t} else {\r\n\t\t\tconsole.error(\"keychain read error\", e);\r\n\t\t}\r\n\r\n\t});\r\n\r\n\tkeychainItem.save(\"my very long string that isn't really that long but it long enough to cause the issue\");\r\n```\r\n\r\nshows error \r\n```\r\n[ERROR] keychain read error {\"type\":\"read\",\"source\":{\"accessControlMode\":0,\"accessibilityMode\":0,\"identifier\":\"myIdentifierNew\",\"cipher\":\"AES/CBC/PKCS7Padding\",\"apiName\":\"ti.touchid.KeychainItem\",\"bubbleParent\":true,\"_events\":{\"save\":{},\"read\":{}}},\"identifier\":\"myIdentifierNew\",\"error\":null,\"bubbles\":false,\"success\":false,\"code\":-1,\"cancelBubble\":false}\r\n\r\n```\r\n\r\n\r\nif you change the string ti something short it works\r\n\r\nheres some info of my environment\r\n\r\n```\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.14\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 16.0GB\r\n\r\nNode.js\r\n Node.js Version = 9.4.0\r\n npm Version = 6.4.1\r\n\r\nAppcelerator CLI\r\n Installer = 4.2.13\r\n Core Package = 7.0.8\r\n\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\n node-appc Version = 0.2.44\r\n\r\nTitanium SDKs\r\n 7.5.0.GA\r\n Version = 7.5.0\r\n Install Location = /Users/a/Library/Application Support/Titanium/mobilesdk/osx/7.5.0.GA\r\n Platforms = iphone, android\r\n git Hash = 2e5a7423d0\r\n git Timestamp = 11/15/2018 21:52\r\n node-appc Version = 0.2.47\r\n \r\nMac OS X\r\n Command Line Tools = installed\r\n\r\nIntelĀ® Hardware Accelerated Execution Manager (HAXM)\r\n Installed = yes\r\n Memory Limit = 6 GB\r\n\r\nJava Development Kit\r\n Version = 1.8.0_131\r\n Java Home = /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home\r\n\r\nGenymotion\r\n Path = /Applications/Genymotion.app/Contents/MacOS\r\n Genymotion Executable = /Applications/Genymotion.app/Contents/MacOS/genymotion\r\n Genymotion Player = /Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS/player\r\n Home = /Users/a/.Genymobile/Genymotion\r\n\r\nVirtualBox\r\n Executable = /Applications/VirtualBox.app/Contents/MacOS/VBoxManage\r\n Version = 5.0.10r104061\r\n\r\nAndroid SDK\r\n Android Executable = not found\r\n ADB Executable = /Users/a/Library/Android/sdk/platform-tools/adb\r\n SDK Path = /Users/a/Library/Android/sdk\r\n\r\nAndroid NDK\r\n NDK Path = /Users/a/Library/Android/android-ndk-r10e\r\n NDK Version = r10e (64-bit)\r\n```\r\n\r\ntested on a android x86emulator 8.1.0", "updateAuthor": { "name": "cmoss", "key": "cmoss", "displayName": "Christian Moss", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-12-08T12:42:46.000+0000", "updated": "2018-12-08T12:42:46.000+0000" }, { "id": "444351", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, This is not our issue, this is most likely a native Android keystore issue, this issue is mentioned in this [post| https://stackoverflow.com/questions/27320610/how-can-i-use-the-android-keystore-to-securely-store-arbitrary-strings], Look into the comment by Alamgir Mand. There is nothing we can do about this right now. Thanks. ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-12-08T22:08:19.000+0000", "updated": "2018-12-08T22:08:19.000+0000" }, { "id": "444479", "author": { "name": "cmoss", "key": "cmoss", "displayName": "Christian Moss", "active": true, "timeZone": "America/Los_Angeles" }, "body": "no problem\r\nActually I ended up making myu own module and learnt more about how keystores differ on iOS on Android\r\n\r\non iOS you can store large amounts of data such as json strings etc, however on android it generates keys which are storedi n the keystore and is just meant to store keys that you use to encrypt data which is stored in user preferences.\r\n\r\nso I assume the error is because im storing something larger than a 32/128 bit key etc\r\n\r\nhowever I think the ti identity api/docs doesnt reflect this or make it clear so maybe good to mention it as a cavaet?", "updateAuthor": { "name": "cmoss", "key": "cmoss", "displayName": "Christian Moss", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-12-11T13:14:04.000+0000", "updated": "2018-12-11T13:14:04.000+0000" }, { "id": "444517", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Thanks for your feedback.[~cmoss].", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-12-12T04:04:05.000+0000", "updated": "2018-12-12T04:04:05.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }