Objective C Secure Transport Core Bluetooth - ios

After several days of research about how to use Secure Transport i found that all the example and projects are working with BSD sockets and Streams.
In Apple documentation there is no statement confirming or denying the possibility of applying TLS over Core Bluetooth.
I have tried in many ways to establish a TLS session between two iOS devices that exchange data via Core Bluetooth. However i always get error -9806 every time i call the SSLHandShake() method.
In almost every example, a BSD Socket should be configured and connected before starting TLS HandShake.
Once the Socket is connected, Secure Transport exchanges automatically the TLS settings between two peers after calling SSLHandShake() method.
I suppose that Secure Transport supports BSD Sockets when it comes to establish a TLS HandShake. I did not find any solution to make Secure Transport exchange TLS settings between two peers connected via Core Bluetooth (BLE).
Is it possible to establish a TLS session between two iOS devices that have been connected via Core Bluetooth ? Should i forget about Secure Transport and implement TLS protocol (over Core Bluetooth) by myself without using Secure Transport ?
Thanks :)

Related

iOS - TLS over BLE

I m currently working on iOS BLE application. To secure the connection between the smartphone which is in Central mode and the head unit which is in peripheral mode we need to implement TLS protocole over BLE.
To send the certificate which is big data for BLE we will use a segmentation protocole.
We need to use TLS because we can't be hack easily on our system and BLE 4.2 which is more secure than 4.0 is not implement in enough phone.
I have see that secure transport allow to make TLS on iOS (https://developer.apple.com/reference/security/secure_transport) and I have not see that I can't implement it over BLE.
Did someone have already implement TLS with secure transport?
If yes can he explain me how I can use it in my case? Or if I can't use it can he explain me why?

TLS between two iOS devices

I am currently developing an application which allows two establish a TLS session between two iOS devices.
The session is established between a Centra and a Peripheral that communicate via BLE (Core Bluetooth) library.
The server must hold the certificate and send it to the client which will validate it.
Does Apple's Secure Transport library handle all this automatically ? Is there any example for establishing a TLS session between two iOS devices ?
Thanks.

Framework for communicating between iOS and MacOS

I'm looking to build a pair of apps that work in a similar way to iTunes and the Remote app for iOS... Is there a framework for connecting iOS and MacOS over wifi?
Bluetooth is something I'd like to avoid and there's no need for a web service, I'm just looking to control my Mac app remotely from the phone.
Thanks in advance.
Id say the most ideal way to accomplish this is via the Bonjour protocol.
Here is a great article on the subject, http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/.
Good thing with using Bonjour in iOS is it also works via Bluetooth.
Hope this helps !
here is an example project which exchange the data between iphone and iMAC with WiFi connectivity.
https://github.com/boobalaninfo/Bonjour-iOS-MAC-Apps
Use bonjour to search for devices. Then use CocoaAsyncSocket to send and receive data. It works like a charm.
Little info about AsyncSock:
GCDAsyncSocket and AsyncSocket are TCP/IP socket networking libraries.
Here are the key features available in both:
Native objective-c, fully self-contained in one class. No need to muck
around with sockets or streams. This class handles everything for you.
Full delegate support Errors, connections, read completions, write
completions, progress, and disconnections all result in a call to your
delegate method.
Queued non-blocking reads and writes, with optional timeouts. You tell
it what to read or write, and it handles everything for you. Queueing,
buffering, and searching for termination sequences within the stream -
all handled for you automatically.
Automatic socket acceptance. Spin up a server socket, tell it to
accept connections, and it will call you with new instances of itself
for each connection.
Support for TCP streams over IPv4 and IPv6. Automatically connect to
IPv4 or IPv6 hosts. Automatically accept incoming connections over
both IPv4 and IPv6 with a single instance of this class. No more
worrying about multiple sockets.
Support for TLS / SSL Secure your socket with ease using just a single
method call. Available for both client and server sockets.

OBD 2 iOS wifi swift communication

I want to create an iOS app to connect my Wifi OBD 2 to the iPhone. But i have no idea on how to do the peer connection with swift 2. I have the OBD doc to communicate with it (https://www.elmelectronics.com/wp-content/uploads/2016/07/ELM327DS.pdf - page 30).
I tried to search the same thing on android and windows but the problem is my knowledge on peer to peer iOS communication.
I see a lot of iOS app for OBD protocol on app store, I'm sure that anybody can help me !
Thank you !
You don't need to know about real wifi peer2peer communication. Once you attached your phone to the wifi network created by the obd2 wifi adapter, you will be able to establish a good old TCP-connection to it. By default most wifi adapters listen at 192.168.0.10:35000 for incoming connections.
After establishing the TCP connection you can communicate via AT and PIDs by writing/reading to/from the socket. The actual protocol is described in ELM327 manual and the ISO/SAE standard documents.

How will iOS enforce connections to use a secure connection exclusively?

Starting 2017, Apple will require HTTPS connections for iOS apps. Apps will be forced to use ATS, based on TLS, to establish a connection successfully.
I'm currently developing a network measurement tool for a client. Using the low-level socket interfaces, the purpose is to transmit packets over TCP or UDP to a server in the network, in order to measure the speed of the WiFi connection.
As it is not clear how Apple will enforce their new rules, we find it hard to estimate how our application will be influenced by them. Is there any more information available on this? On which types of connections do they apply? Based on what characteristics will iOS label a connection as insecure?
Your app should be fine. See this thread with a response from an Apple staff: https://forums.developer.apple.com/thread/48979
The relevant part:
First up, there have been no changes to the technical behaviour of ATS (other than the addition of NSAllowsArbitraryLoadsInWebContent and NSRequiresCertificateTransparency). From a technical perspective, ATS exceptions in the newly seeded OS releases work the same way as they do in the current OS release.
What has changed is that App Review will require “reasonable justification” for most ATS exceptions. The goal here is to flush out those folks who, when ATS was first released, simply turned it off globally and moved on. That will no longer be allowed.

Resources