Can an iPhone have entitlements to get decrypted wifi password info, e.g. to send by bluetooth? - ios

I am looking to design a way to configure wifi setup for a non-apple device, by pairing it via bluetooth with an app on an iPhone.
The iPhone would be one already connected to the target wifi network. The app would support its own bluetooth connection with the non-apple device
I understand that there are entitlements, like CNCopyCurrentNetworkInfo, but from research it doesn't look like that is enough. Maybe there are others? Or is this only possible by being approved to implement HomeKit on the 'target non-apple device'?
The presume path of data is
credential stored in iOS
some entitlement that permits access to unencrypted data
app with entitlement
app security handles data
valid bluetooth pairing of the app
unencrypted password sent via bluetooth
non-apple device uses the network SSID + credential to make its own connection
Thanks for your help or corrections. These existing Q&A do not answer it: 1, 2

CNCopyCurrentNetworkInfo does not give you the password, even if you jump through all the hoops including users location permission. Theoretically you can only get SSID of the connected network (with location permission from the user)
Best humane way to approach this (as of today) is by asking the user to enter their WiFi SSID/password in a popup and send it to the Bluetooth device. I was not able to find a better way.
If you use something like Blufi, you can :
have BT device scan for available hotspots
display the list of hotspots for the user
have them select the network + enter the password manually
send the credentials to the Bluetooth device
PS. it would be quite spooky if there was a way to read system keychain passwords from an app.

Related

How To Enable the WiFi Information Entitlement

I'm making a react-native application for a DVR device, and updates happen via wifi, I need to get information about this connection, specifically ssid, I tried using react-native-wifi-reborn, but I can't get it, in the description of the library it is written that it is necessary to grant rights to wifi through capabilities, but there is no such thing, and every time I get an error that the ssid was not received, I will be grateful for any information, thanks
used the library and its methods, but it doesn't help
the problem is that I used the simulator, and I could get data about wi-fi only after I add it to the apple store connection, there, when adding App ID, it indicated that I needed access to Wi-Fi, that's the only way I got access to it

ESP32 iPhone Bluetooth, just a general question

I'm writing some code (C++) for ESP32, to act as a BLE beacon. The problem is this: the iPhone doesn't send out its real MAC address, but does a random-generated MAC address, for security. The thing I'm confused about is how do you know if it's a device you've previously paired with?
So let's say I detect a new BLE MAC address, and looking at the manufacturer data I can determine it's an Apple device (first 2 bytes are "4C").
Now I need to know if I've previously paired with that device, so that I can allow the ESP32 to initiate an action (for simplicity let's just say turn on an LED). If that MAC address is in a list of known devices, then I can continue, and if not, I ignore it.
The problem is, if the iPhone is not giving up the real MAC address, the detected MAC address will never match anything. As this is a security situation I'm sure the algorithm for generating those MAC addresses is not known.
To be clear: this code is being written for the ESP32, not the iPhone.
It is in fact not possible to tell if a device has been previously seen, unless you pair and establish a bond with it. Once you pair with the device, long-term keys are exchanged and are used to quickly re-establish the connection.
This is by design. MAC addresses were originally unique, but this allowed tracking people and devices without their consent. You can read more about this in the following ESP-IDF guides:
GATT security server walkthrough
GATT security client walkthrough
So are you using esp32 as a beacon? This dose not involve any pairing or iOS MAC addresses. iOS will just be able to listen and the esp32 will not even know someone is "listening" to its broadcast.
Probably iOS application can store which services it is interested to hear to; may looks like pairing.. but it is a high level application managed technique and not any related to what BT standard calls pairing.

How to ask for authentication before connect to devices using bluetooth?

I want to make demo application, which contains following features.
search and show device list in my device Bluetooth range.
connect(pair) selected devices.
then share string data.
For doing that I am using core Bluetooth framework(Central and peripheral classes). using that I am able to search devices, connect devices and transfer string data also.
but I am not able to authenticate devices before pairing(when I call connect method it is directly shown me connected status). how is it handled in ios?
also please suggest me I am on the right path or I need to use another library to implement this functionality.
For anyone else beating their head against a wall, I have the solution to this issue. It's as simple as setting the AUTHENTICATION required flag for a characteristic on your BLE device. Once that flag is set, you need to attempt a READ from that service / characteristic using the iOS device. Once the read is requested, the BLE device will send back a failure message which then prompts iOS to display the PAIRING / BONDING popup. After that, you're golden.
Here is an example of a Cypress BLE device permission group. The settings are similar for most BLE embedded devices out there.
yes it is possible to ask pairing request from BLE device to ios.
I followed below steps to make ios app to ask for pairing.
edited my ble app to return error code 'RBLE_ATT_ERR_INSUFF_AUTHEN' using gatt write response function.
attempted a write from ios app then i got a prompt to enter pairing key.
used the randomly generated pairing key by BLE device to pair.
Paulw11's comment also helped me to solve that problem,
Regards
Bharath GK

About wifi scanning in iOS

I'm wondering if it's possible to scan wifi networking nearby like what WiFi Map did?
And in this application, it can even provide password of the wifi hotspot. Is it legal and what kind of technology is used?
I do not think this App use IOS technology to scan wifi and offer dynamic password.
In IOS,with public API,you even cannot scan available wifi nearby.
So,I think the Technology of this app is:
At first, they offer some public wifi and passowrd.
Then user use this app,and they choose to share about connected wifi.So,that the database of this app became bigger and bigger.

Connect to wifi using nfc

I am looking for a way to connect a NFC phone to my wifi (just using the built-in feature of NFC).
My current plan would be to push my wifi setting to the phone so that non-NFC phones can still connect to my wifi using a password.
My alternative plan was to use a NFC reader to get informations like mac address of a phone then add it to my list of approved mac addresses in my router.
What plan have the most chance of succeeding and how to go about it?
The first plan sounds promising with the use of an app you can read the wifi credentials off the nfc http://lifehacker.com/six-sweet-things-you-can-do-with-nfc-1323120090
as answered here Share Wifi credentials via NFC tag without special apps its not supported to currently do this with out a nfc reading/dedicated nfc wifi app

Resources