-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ios 9.3 POST /pair-setup,POST /pair-verify #61
Comments
hi,if anybody known to deal with POST /pair-verify or /pair-setup session, please email to me |
hi, i find code that can deal with pair-setup |
hi, im reseaching on AirPlay, I found when I publish AirPlay service with: txt.append(26); txt.append("deviceid="); txt.append(GetMacAddress()); notice that the pk=7f2f132f6f6f64fff4ff6f2fff3f42f51. I guess it is the private key, with this key at the pair-verify step, iPhone send to my App the hex string (this hex string changed every the iPhone send to App): (1) and we need to send back the hex string: (2) but I dont know how to Decode (1) string iPhone send to app to (2) string, did you find the way to deal with the pair-verify session, plz share to me, thank you so much |
@yong253535551 @anhhna |
I am facing same issue, if anybody know the solution for how to decode or what string should we pass please let me know. |
@yong253535551 @anhhna @shahasachin @Derek0425 @vranki ,Did you fix this issue ?homekit can't resolve this! |
@Jack-lx, Didn't get solution. Yes, configured homekit but didn't get any solution. |
@Jack-lx have you found out how to handle setup and verify steps? |
Hello everyone! |
There's also an implementation available in Python & ObjectiveC and C. |
Thank you @ViktoriiaKh for letting me know, and huge thanks for @funtax for the work! It's a bit hectic right now but I'll try to find some time for this. |
@funtax It looks like your implementation is only for /setup-pair-pin | binary-plist which is not the requests servers seem to get from Mac OS X. |
Hey @comwizz2, sadly not, I have only focused a this implementation (done by reverse-engineering another app) as this was required by mine. |
@funtax implementation's seems to do the client-side of the Any clues as to what the official client checks on the response for the first pair-verify call (it looks like from that code it's expecting the first 32 bytes to be the server public key and the last 64 just some random blob used for the signature that is sent on the 3rd step, but how does it verify that either the public key or the signature blob have anything to do with either the response from |
@robertoandrade I sadly removed the part where the verification of the mDNS "pk"-value as it wasn't mandatory for my case. Renaming the library and moving code broke the history in IntelliJ. I tried to re-code it a bit into Java.. it won't compile but might help: `
|
Ok, awesome @funtax thanks for sharing this. I'm trying to decipher what are the last 64 bytes of that 96 byte response from the first |
Ok, I figured it out, just needed to do the inverse on the server, sign the server curve public key + client curve public key with the EdDSA private key and decrypt it with the derived AES key from the shared secret composed from the server curve private key and the client curve public key. Thanks a bunch @funtax for the information, this was a lifesaver! |
I'm super-happy to read this @robertoandrade . |
Anyone know of any example c/c++ code for handling /pair-setup and /pair-verify messages sent to the AirPlay server by a connected device??? (or if not, perhaps some sudo-code?) I see some mention of Java code above, but I'm not fluent in Java, and not good at deciphering the logic. |
Hey @htartisan, you mean the client-side that connects to the Apple TV/AirPlay-receiver? |
No. I am trying to write write code for an AirPlay "server" device, that would support AirPlay mirroring. I can't find any documentation on how to do this (even from Apple), or any example code. So far, I have successfully created the Bonjour server entry, and I can see the data from the "/pair-setup" message coming into my server code. I do not know how to interpret the "octec-stream" data that is being sent, or how to create the appropriate response. Beyond that, I know that I need to handle the "/pair-verify" message (interpret it's data) and create the appropriate response to that as well. I would be very helpful for any help that anyone can offer. |
NOTE: AirPlay "server" device = a device that is connected to a monitor/TV, that can receive AirPlay streams. |
Depending on what kind of streams you want to process on your AirPlay "server" (aka receiver in Apple's lingo), you don't need to handle the pairing requests @htartisan, are you trying to handle Screen Mirroring, Audio, Remote Media or all of those? |
Initially, I am just trying to get Screen Mirroring to work. I will probably want to get audio, and perhaps even video to work in the future, but if I can just get the Screen Mirroring to work, that would be a big victory. |
Yeah for that you don't need to handle the pair-setup/pair-verify calls (with the proper mDNS broadcast), you'll only need to do that for sure to handle remote video streams. You may wanna take a look at the long discussion we've had on espes/Slave-in-the-Magic-Mirror#12 |
I'll look there. Thanks! |
@robertoandrade @funtax Thank you. I received a lot of help. Starting with golang's Airplay mirroring server related code ... I succeeded in protocol processing and mirroring data decryption in iOS 7 and 8. Did you solve the key problem? |
heya @funtax I was looking at using advertise mode 0x5A7FFFF7 instead of 0x527FFFF7 which forces the pairing to occur and I noticed the AES Key the clients use to encrypt the data (mirroring/audio) is different than the one they use it without pairing. I was wondering if in your AirAudio implementation (which doesn't seem to be open source from what I could tell) you had any hints as to how the shared secret using during the pairing is used later on to derive the AES Key to be used to encrypt the actual streams? |
Hey @robertoandrade, I am sorry but I have no more knowledge about the usage of the encryption-keys. |
@kcosmos4 hi, i noticed that you have In iOS 10.3.3, pair-verify succeeds,can you tell me the detail information?thank u so much. |
To be more specific, the relevant code seems to be at https://github.com/phonegapX/AirPlay/blob/master/AirplayLibrary/AirPlay/lib/raop.c#L1288 I have been too preoccupied by other stuff lately, but I'm hoping I would have time to at least do some initial tests of integrating this to the main codebase. |
Got it, I found the different in curve25519_donna-c64. Replace this file with your code, I pass the pair-verify. @juhovh 哈哈,是啊。中国人歪点子多。 |
Just out of curiosity, do you mean the |
Yep... |
Hey guys, Having issues on ios 11.3. In airserver I see: INFO My code works fine until the last setup. I don't get any second setup message at all. Do you have your code working on ios 11.3? Can you confirm the flow you see? |
@Kam187 last I checked the flow is the same in 11.3, depending on what you're playing on the sender, you may even get a 3rd SETUP call (one for screen and one for audio). |
Hmm, I wonder why I don't get the second setup. Does your code work with ios 11.3? |
yep, but my codebase is not related to this project at all. |
Ok found the issue, i wasn't sending a 'name' and 'pk' in the info. Previously i had disabled pair-verify :) . Working now. |
Ok another issue. It seems on ios11.3 it does not connect back to the event port. It works fine on lower versions. |
Nevermind it's down to sending an error on my part. |
@382517366 是的,但是curve25519_donna这个函数跟你网上下到的有一点点小区别 |
@382517366 我不是对着这个工程开发的。我是开发遇到问题点刚好看到这里在讨论才进来讨论的。你直接使用https://github.com/phonegapX/AirPlay 这套代码里的这个库就没问题的。 |
@382517366 恩,对的,我们也是用64写的,没问题的。 |
Just to let you know, I have removed comments from notedit and modified references to his repo to point to phonegapX repo instead. It turns out the only reason notedit joined this discussion and cloned phonegapX's repository was to promote his proprietary SDK he is trying to sell, he has done no open source work on airplay protocol whatsoever. |
Just to let you all know again, I have just pushed to master the code that is able to handle |
I have now committed a version of shairplay to master that allows receiving audio from iOS with the full |
The chinese guys above seem to have cracked it! |
@jmvermeulen lol, there are so many product working correctly in China, if you pay me 10 thousands i will give you the code. Kidding. |
@tishion thanks for the edit, without it your comment was a bit too close to reality to be funny @jmvermeulen the code in the phonegapX repository is very Windows specific, I've already ported the key exchange and fairplay decryption parts, and shairplay compiled with |
hi @juhovh , I have some problem while i am implementing the AirServer, the first one is how to disable the FairPlay support? Is it achieved by change the Airplay feature flag? |
@juhovh thanks! Will have a look at your code, when back at the office. Do you know if your application runs in Windows 10 Ubuntu? @tishion I believe we are a open source community. Would be great if you could provide your code in GitHub ;-) |
POST /pair-verify or /pair-setup,how to handle these seesion?
POST /pair-setup RTSP/1.0
Content-Length: 32
Content-Type: application/octet-stream
CSeq: 0
DACP-ID: 82F0F5B508E73AF1
Active-Remote: 3453826074
User-Agent: AirPlay/280.32.2
-k8hS( aG
RTSP/1.0 200 OK
CSeq: 0
Content-Length: 32
Audio-Jack-Status: connected; type=analog
Server: AirTunes/230.33
y|XT^{W7zVSsoFzGt
POST /pair-verify RTSP/1.0
X-Apple-AbsoluteTime: 481732246
X-Apple-PD: 1
Content-Length: 68
Content-Type: application/octet-stream
CSeq: 1
DACP-ID: 82F0F5B508E73AF1
Active-Remote: 3453826074
User-Agent: AirPlay/280.32.2
P(XGd^+a;5lmpH^-k8hS( aG
RTSP/1.0 200 OK
CSeq: 1
Content-Length: 96
Audio-Jack-Status: connected; type=analog
Server: AirTunes/230.33
^Ns`>shrPbg1xYy=L^X_ne:_|6OB#hi^9m-^O/S^lb
POST /pair-verify RTSP/1.0
X-Apple-AbsoluteTime: 481732247
X-Apple-PD: 1
Content-Length: 68
Content-Type: application/octet-stream
CSeq: 2
DACP-ID: 82F0F5B508E73AF1
Active-Remote: 3453826074
User-Agent: AirPlay/280.32.2
j8~oY6>J?[X|2U|iWn
RTSP/1.0 200 OK
CSeq: 2
Content-Length: 0
Audio-Jack-Status: connected; type=analog
Server: AirTunes/230.33
The text was updated successfully, but these errors were encountered: