{ "id": "82824", "key": "TIMOB-6211", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2011-11-17T07:21:22.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "exalture" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [ { "id": "13913", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "82561", "key": "MOD-286", "fields": { "summary": "Implement TLS based secure socket for iOS and Android", "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": "Critical", "id": "1" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } }, { "id": "41644", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "82826", "key": "TIDOC-288", "fields": { "summary": "APIDoc: Document Support for TLS to TCP Sockets", "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": "Low", "id": "4" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-08-02T17:31:41.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h1. Problem\r\nFacebook chat now requires a secure connection, so any apps that are using it are now broken until TLS is exposed through our TCP sockets.\r\n\r\nh2. Pull Request\r\nhttps://github.com/appcelerator/titanium_mobile/pull/725\r\n\r\nh2. How to Test\r\nDrop the following in an app.js. Look at the log. After some network traffic (~5 seconds) you should see the log message, \"Socket secured!\". (Note that around 10 seconds later, the connection will timeout and you'll be disconnected -- this is expected behavior.)\r\n\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar states = {\r\n WAITING_FOR_FIRST_RESPONSE: 0,\r\n WAITING_FOR_START_TLS: 1,\r\n WAITING_FOR_PROCEED: 2,\r\n WAITING_FOR_SECURED: 3,\r\n DONE: 4,\r\n ERRORED: 5\r\n};\r\nvar currentState = Ti.Android ? states.WAITING_FOR_FIRST_RESPONSE : states.WAITING_FOR_START_TLS;\r\n\r\nvar socket = Ti.Network.Socket.createTCP({\r\n host: 'chat.facebook.com', port: 5222,\r\n connected: function (e) {\r\n Ti.API.info('Socket opened!');\r\n Ti.Stream.pump(e.socket, read, 1024, true);\r\n socket.write(Ti.createBuffer({\r\n value: ''\r\n }));\r\n },\r\n secured: function (e) {\r\n Ti.API.info('Socket secured!');\r\n },\r\n error: function (e) {\r\n Ti.API.info('Error (' + e.errorCode + '): ' + e.error);\r\n },\r\n closed: function (e) {\r\n Ti.API.info('Socket closed!');\r\n }\r\n});\r\nsocket.connect();\r\n\r\nfunction write(msg) {\r\n Ti.API.info('State: ' + currentState + ', Wrote: ' + msg);\r\n socket.write(Ti.createBuffer({\r\n value: msg\r\n }));\r\n}\r\n\r\nfunction read(e) {\r\n try {\r\n if (e.buffer) {\r\n var received = e.buffer.toString();\r\n Ti.API.info('State: ' + currentState + ', Received: ' + received);\r\n switch (currentState) {\r\n\r\n case states.WAITING_FOR_FIRST_RESPONSE:\r\n if (received.split('');\r\n if (!Ti.Android) {\r\n // Note: iOS requires that startTLS be called right after sending the above XML.\r\n // This is required because of how reads and writes are queued up before a secure handshake.\r\n socket.startTLS();\r\n return currentState = states.WAITING_FOR_SECURED;\r\n }\r\n return currentState = states.WAITING_FOR_PROCEED;\r\n\r\n case states.WAITING_FOR_PROCEED:\r\n if (received.split('').length <= 1) {\r\n Ti.API.error('Unexpected response from server while WAITING_FOR_PROCEED!');\r\n return currentState = states.ERRORED;\r\n }\r\n socket.startTLS();\r\n return currentState = states.WAITING_FOR_SECURED;\r\n\r\n case states.WAITING_FOR_SECURED:\r\n write('');\r\n return currentState = states.DONE;\r\n\r\n }\r\n }\r\n else {\r\n Ti.API.error('Error: no e.buffer!');\r\n }\r\n } catch (ex) {\r\n Ti.API.error(ex);\r\n }\r\n}\r\n\r\nwin.open();\r\n{code}\r\n\r\nh2. Related Tickets\r\niOS: [TIMOB-6211]\r\nAndroid: [TIMOB-6212]\r\nAPIDoc: [TIMOB-6213]", "attachment": [], "flagged": false, "summary": "iOS: Add Support for TLS to TCP Sockets", "creator": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "173084", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Cloned off of [MOD-286]. Android and Doc tickets en route as well as pull requests for all of them.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-11-17T07:23:07.000+0000", "updated": "2011-11-17T07:23:07.000+0000" }, { "id": "173085", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Opened pull request https://github.com/appcelerator/titanium_mobile/pull/725", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-11-17T07:36:06.000+0000", "updated": "2011-11-17T07:36:06.000+0000" }, { "id": "173088", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Revamped the description so that it is clear what this is addressing and how it can be tested.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-11-17T07:41:38.000+0000", "updated": "2011-11-17T07:41:38.000+0000" }, { "id": "301618", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Still nothing changed? Can somebody explain me how can I develop secure software using Titanium if features like this one are not provided?", "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-19T17:30:32.000+0000", "updated": "2014-04-19T17:31:37.000+0000" }, { "id": "302048", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~sko] Are you actually creating a direct TCP socket, or just using a HTTPS connection? TLS is already supported in that context, see http://www.appcelerator.com/blog/2012/11/the-titanium-sdk-and-certificate-validation/.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-22T15:55:14.000+0000", "updated": "2014-04-22T15:55:14.000+0000" }, { "id": "302206", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Ingo, yes I create a direct TCP connection to be more specific I have got my own module that provides connection using WebSocket protocol and this protocol works over TCP that unfortunately can't be encrypted... That's a big problem.\r\n\r\nThis feature is not required only by me ,but several other people that mentioned this in Titanium Community Questions & Answers.\r\n\r\n// To be honest at this time every serious application uses encrypted connection (https, wss or directly TCP). I think this feature is quite important.", "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-23T15:57:22.000+0000", "updated": "2014-04-23T16:06:24.000+0000" }, { "id": "302212", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~sko] is this a native module? How is it creating the TCP connection?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-23T16:24:09.000+0000", "updated": "2014-04-23T16:24:09.000+0000" }, { "id": "302213", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "body": "No it is not a native module. The TCP connection is created exactly in the same way as in the example above so using Ti.Network.Socket.createTCP", "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-23T16:28:16.000+0000", "updated": "2014-06-13T20:03:57.000+0000" }, { "id": "308959", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Ingo, please could you set higher priority for this issue? We are quite far with our application and we can't release it without encrypted connection. That's standard. Thank you a lot", "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-06-13T20:02:48.000+0000", "updated": "2014-06-13T20:02:48.000+0000" }, { "id": "308964", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~sko] I currently cannot bump the priority. If you are interested, I believe you could take [~dtoth]'s PR and expand it.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-06-13T20:13:44.000+0000", "updated": "2014-06-13T20:13:44.000+0000" }, { "id": "336974", "author": { "name": "haraldschlager", "key": "haraldschlager", "displayName": "Harald Schlager", "active": true, "timeZone": "America/Los_Angeles" }, "body": "i would need a secure socket for a chat app for ios and android - is there timeline or a workaround ? thanks ", "updateAuthor": { "name": "haraldschlager", "key": "haraldschlager", "displayName": "Harald Schlager", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-12-18T06:17:44.000+0000", "updated": "2014-12-18T06:17:44.000+0000" }, { "id": "427571", "author": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "body": "Hello to all\r\nAlso in my work I find myself needing to create secure connections on TLS.\r\nSpecifically for the creation of IoT app with proprietary protocol that require a minimum level of data transmission security.", "updateAuthor": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "created": "2017-09-05T07:19:16.000+0000", "updated": "2017-09-05T07:19:16.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }