iOS convert CFUUID to MAC Address - ios5

I know CFUUID is generated from MAC address and a few other stuff. So is there anyways to get the MAC address back from CFUUID?
We have a few bluetooth devices and all the user knows is the last 3 parts of the MAC address which is written on the device. So we wanna give the user and option to select the right device. On the iOS side, looks like all we have the the CFUUID. So is there's a way to convert the UUID back to mac address?
Or even better would be if there's a way to get a peripheral's MAC address directly instead of UUID, but doesn't seem like that's possible
Thanks

Well, as you might have learnt from the comments to your question, the answer is clearly: NO. It is not possible (practically) to get the seeds that generated a particular UUID. Provided that in fact the algorithm that generated your UUID did used the MAC Address of your device to generate it, and I guess you cannot guarantee that it is the case for the UUID generator you use, unless you have access to the UUID Generator code or algorithm (UUID Version 1 probably?) and it is not a opaque operation to you (Immediately defeating the very purpose of the uuid generation algorithm).
While you clearly are onto something when you say that the generation of a UUID might use the MAC address of the device, other components like timestamps, hashing, UDID (iOS Devices) and so on. The fact is that the MAC Address, could be just one of many factors used to generate the UUID so if you were to spend a lot of computing power into trying to deconstruct it out of a big sample of UUIDs generated by the same system under the same conditions; We will probably be talking about a quantum computer wasting computing power trying to explore as many combinations as particles in the observable universe so you get a MAC address that you may as well get as a characteristic from a Bluetooth peripheral if you like, and incidentally defeating the purpose of having a UUID in the first place, once more.
On the other hand, further to what somebody commented on your question: the reason you find UUIDs so boring, building on top of the previous paragraph idea, is so you can avoid collisions: Generating duplicates not just coming from the ones generated by your computer but from all the other ones generated by every device out there every moment of the day (to authenticate requests, create string index keys in a database, or identifying services and characteristics) so your cool service or characteristic named:
AAAAAAAA-BBBB-CCCC-DDDD-EEEEFFFF6666
does not get confused with another cool foo service or characteristic with the same UUID.
In general, for more information check wikipedia or just the Core Bluetooth Programming Guide, form the developer portal. It is still under NDA so you have to be a registered iOS Developer with active developer program credentials to read it.

I was looking for a way to deploy platform-independent, static configurations of BLE devices. I was getting discouraged (Apple's UUIDs are +/- meaningless, and the MAC/BDADDR which can be obtained on most/all other platforms is not accessible from CoreBluetooth). Fortunately, I noticed that the "Device Information Service" profile (0x180A) contains a "System ID" attribute (0x2A23) which encodes the device's unique MAC/BDADDR address. I don't know if it is mandatory for a BLE device to expose this service, however.

there is a way to get mac address for ios device. but only works on ios8 and later. no private api .https://github.com/Baoge2012/MacAddressLibDemo

Related

Methods for enabling/disabling passcode lock based on device connection in iOS

I tried searching around, but couldn't come up with much on the topic of this.
Is there an API or code within various Security API's that would allow some sort of passcode locking mechanism to enable whenever a device is connected (by Bluetooth, etc) and disable whenever said device is paired with the phone? An interesting concept I had thought up earlier today but can't seem to determine a method available for this.
The concept is pretty much this: if the phone is close enough to be connected over Bluetooth to the device (would be something like a smartwatch or other wearable computing) then the phone is on you and passcode entry can be disabled. However, when the device is not found by the iPhone, there is a physical distance between the two devices and the phone should lock up and not allow entry. This could even be some form of superficial lock mechanism on some apps (which exists already) that could activate based on this proximity awareness. This method is meant to failsafe by being a "lock first, then check" mentality that is paired to a specific address of the wearable computing. This could, in theory, be hacked, yes, but for general usage allows a user to have a no-maintenance method that can save some passcode entries from time to time should one find it annoying, but still want it's security potential.
Again, this idea is based on the assumption that said device connecting to your iPhone that the phone itself is searching for is physically latched to you somehow.
Thanks and I appreciate any sort of input or direction.

Is the iphones mac address static? Looking for a way to identify which user is online

I am building an app where I do not want a loginsystem. I still want to be able to know what user is sending information to my online database. As far as I know, the UDID is not allowed to upload to any servers, so that is out of the question. Can I use the iphones mac address for this? If it is dynamic, it will change from time to time, and I won't be able to track it.
We use the MAC address as a unique identifier now the UDID has been deprecated.
MAC addresses are hardware based and therefore cannot be changed.

iPhone to RS-232 via Bluetooth

I'm looking to connect my iPhone to an RS-232 serial device via Bluetooth. Has anyone implemented this successfully and can offer advice on hardware to use? It's kind of tricky because of the need for the Apple Authentication Processor with the device. The best potential device I've found is this guy but it only comes in an embedded package, its serial port interface is just logic-level UART rather than line-level RS-232, and I can't find a supplier with it in stock.
Any thoughts would be appreciated.
I'm considering just using WiFi to serial instead, but please ignore that possibility for the purposes of this question.
most of the question was answered by yourself already.
Basically you have 5 (+2) choices.
Join the MFi program. This might be hard to impossible if you are not part of a at least mid-size company.
Buy the OEM Bluetooth Module. I'm not sure if this is even allowed by the apple policies.
Use WiFi. Keep in mind that you want to use a wifi chipset that can act as at least ad-hoc access point. Those chipsets are quite expensive, and you have to think of a way to join existing networks (customers don't want to leave their home network to use your product). This will add a lot of cost to the BOM of your device.
Jailbreak might be an option. I never tried to use accessories with a jailbreak, so I don't know if it's possible to use bluetooth without authentication.
Work with a company that is member of the MFi program.
(Maybe an option, and depending of the speed you want to have via RS232: Eventually you can convert the audio output of the head-phone jack to RS232 levels and vice versa)
(Not really an option: develop for Android and do whatever you want)
If you jailbreak your device, you can use BTstack.org (disclaimer: I'm the author of BTstack) to connect to a Bluetooth device that supports the Serial Port Profile. You can get Bluetooth Modules that implement SPP and provide UART level output. As David R. above points out, you then need a UART to RS232 converter, e.g. the MAX232.
Ok. Another option. There are one or two companies that sell RS232 cables for iOS, eg. Skywire here: http://www.southernstars.com/products/skywire/index.html
Then, you could uses a Bluetooth RS232 extender, which consists of a RS232-to-SPP and a SPP-to-RS232 pair. Ugly, but within Apple's rules.
Well. It seems like my answer could be something you didnt ask for.
But the guy you referred to is the answer. Buy his product and you are good to go, all you need is a MAX232 chip. Converts logic level UART to RS232.
the diffrence high + voltage low zero voltage is converted to high +~10volts low -~10volts.
I use the MAX232 chip with my microprocessor, that uses logic level USART to communicate over RS232.
There is a lot of tutorials out there explaining how to hook things up.
This product works: https://serialio.com/product/bluetooth-serial-adapter/bluesnap-smart-bluetooth-40-ble-rs232-adapter
The only downside is that the adapter requires power.
It should be possibly I would think to create something in the middle that accept the bluetooth commands and convert them to serial, similar to what this does with TCP connections: https://www.npmjs.com/package/stellar-socks

Determining unique Bluetooth MAC address for iPhone and Android

Is it possible to determine the unique bluetooth MAC address for an iPhone and an Android (and to a lesser extent, other smartphones) from within an app on said device? Is my assumption that the MAC address is universally unique correct?
A general yes or no would be helpful. Example code in the case of an iPhone or an Android would be extremely helpful.
Yes the bluetooth MAC address will always be unique.
In Android you can use the getAddress() api on the BluetoothAdaptor.
It returns the MAC address as a String.
On iPhone it looks like there is no public API to read the MAC address , see this thread
Android
Read up on the Bluetooth section of dev guide, specifically Connecting Devices.
About UUID
A Universally Unique Identifier (UUID)
is a standardized 128-bit format for a
string ID used to uniquely identify
information. The point of a UUID is
that it's big enough that you can
select any random and it won't clash.
In this case, it's used to uniquely
identify your application's Bluetooth
service. To get a UUID to use with
your application, you can use one of
the many random UUID generators on the
web, then initialize a UUID with
fromString(String).

Connect iPhone/iPad with Mac (the Apple way)

When Apple's Remote app tries to connect to a Mac (running iTunes) on a local network (using WiFi), the user needs to enter a passcode provided by the iPhone as a security measure. This approach has been adopted by a number of other apps (e.g., Rowmote, Pastebot, ...). Is there an API that provides this way of working?
Assuming Bonjour is in play, how does an iPhone checks if the passcode entered on a Mac is correct without resolving the NSNetService the Mac is publishing? Or does the iPhone resolve the NSNetService a Mac is publishing and waits for the passcode to be confirmed before processing any other packets that might be sent via the NSNetService (packets other than the passcode).
I have a solution for my problem, but I would like to know if there's an API I have overlooked that provides a ready-made solution.
Advice and pointers are welcome.
Thanks in advance,
Bart
I don't believe there is an Apple provided API for this. I simply use the Bonjour APIs to open a connection between two devices, then have one randomly create a 4 digit passcode and ask the other device for it. The other device presents a UI to ask the user for the passcode, then transmits it back and waits for an answer. If they match, the devices store each other's identifiers to skip over this process the next time they connect.
Edit: Thanks to tc for pointing out that this implementation isn't totally secure. I'm now having one device create a unique, random password, and send it over to the other device, then store the SHA1 hash of the password for future reference. Then the other device stores the password and sends it back over whenever it connects for authentication. The user does the number code thing once in order to let the devices know that they should trust each other in the future, but now in order for a reverse engineer to connect to a device they would have to know both the identifier of and password for a valid, connected device. (Or they'd have to have access to both devices and do the number code thing; there isn't really a way to stop anyone from doing that, obviously).