etwmc / Personal-HomeKit-HAP

This project will provide source code to build a HomeKit support accessories.
MIT License
236 stars 85 forks source link

C# port data request #26

Closed wzoet closed 9 years ago

wzoet commented 9 years ago

Hi,

I am making a port to c#. Because the absence of right functioning libraries I had to create some myself already (chacha20poly1305 and specific SRP implementation).

At this moment I am stuck on verifying the controller info signature using Ed25519. Could you give me some intermediate values of your project in hex-byte arrays? Eg the shared secret, the session key, input and output of chacha20poly1305 algorithm and preferably the deserialized tlv data of that? The other inputs for the ed25519 algorithm as well of course.

That way I could check my source to see where it fails. I assume it is the ed25519 library I am using this time or some byte gets lost during an earlier process. Since I get to m5 the session key and therefore shared secret must be right. I can also deserialize tlv data after decrypting chachapoly so those algorithms work as well. I just can't verify the signature in the decrypted subtlv data.

Thank you very much!

etwmc commented 9 years ago

You can use the test vector in ed25519 to test it. http://www.ietf.org/id/draft-koch-eddsa-for-openpgp-01.txt

BTW. I don't use C#, but I believe you could call my function directly from C#? It will be better because it takes weeks to debug the connection function.

wzoet commented 9 years ago

Thx, I'll try the document you referenced. I did found other test vectors to be working, but I also found out that implementation for homekit does not use the full specification of an algorithm. I hope this document leads me to the solution.

Verstuurd vanaf mijn iPhone

Op 20 dec. 2014 om 08:43 heeft etwmc notifications@github.com<mailto:notifications@github.com> het volgende geschreven:

You can use the test vector in ed25519 to test it. http://www.ietf.org/id/draft-koch-eddsa-for-openpgp-01.txt

BTW. I don't use C#, but I believe you could call my function directly from C#? It will be better because it takes weeks to debug the connection function.

Reply to this email directly or view it on GitHubhttps://github.com/etwmc/PersonalHomeKit/issues/26#issuecomment-67728279.

etwmc commented 9 years ago

Just notice: you need to change the hash function to sha512. I think the default one use sha1 or something similar.

Sent from my iPhone

On 20 Dec, 2014, at 3:56 pm, wzoet notifications@github.com wrote:

Thx, I'll try the document you referenced. I did found other test vectors to be working, but I also found out that implementation for homekit does not use the full specification of an algorithm. I hope this document leads me to the solution.

Verstuurd vanaf mijn iPhone

Op 20 dec. 2014 om 08:43 heeft etwmc notifications@github.com<mailto:notifications@github.com> het volgende geschreven:

You can use the test vector in ed25519 to test it. http://www.ietf.org/id/draft-koch-eddsa-for-openpgp-01.txt

BTW. I don't use C#, but I believe you could call my function directly from C#? It will be better because it takes weeks to debug the connection function.

  • Reply to this email directly or view it on GitHubhttps://github.com/etwmc/PersonalHomeKit/issues/26#issuecomment-67728279. — Reply to this email directly or view it on GitHub.

wzoet commented 9 years ago

Thanks for pointing me into the right direction! The Ed25519 library I used didn’t had the possibility to change the SHA algorithm. I changed to another library, adjusted to SHA512 and I get pair-verify requests now.

Van: etwmc [mailto:notifications@github.com] Verzonden: zaterdag 20 december 2014 09:00 Aan: etwmc/PersonalHomeKit CC: Wim Zoet Onderwerp: Re: [PersonalHomeKit] C# port data request (#26)

Just notice: you need to change the hash function to sha512. I think the default one use sha1 or something similar.

Sent from my iPhone

On 20 Dec, 2014, at 3:56 pm, wzoet notifications@github.com<mailto:notifications@github.com> wrote:

Thx, I'll try the document you referenced. I did found other test vectors to be working, but I also found out that implementation for homekit does not use the full specification of an algorithm. I hope this document leads me to the solution.

Verstuurd vanaf mijn iPhone

Op 20 dec. 2014 om 08:43 heeft etwmc notifications@github.com<mailto:notifications@github.com<mailto:notifications@github.com%3cmailto:notifications@github.com>> het volgende geschreven:

You can use the test vector in ed25519 to test it. http://www.ietf.org/id/draft-koch-eddsa-for-openpgp-01.txt

BTW. I don't use C#, but I believe you could call my function directly from C#? It will be better because it takes weeks to debug the connection function.

Reply to this email directly or view it on GitHubhttps://github.com/etwmc/PersonalHomeKit/issues/26#issuecomment-67728279. — Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/etwmc/PersonalHomeKit/issues/26#issuecomment-67728582.

Clancey commented 8 years ago

@Wzoet did you get very far? This is something I am about to start on.

wzoet commented 8 years ago

I do have a working version of the code now. Unfortunately still sometimes my ChachaPoly1305 algorithm failes to verify the tag on encrypted data.

Clancey commented 8 years ago

Would you mind putting it up on github? I would love to help contribute.

wzoet commented 8 years ago

Sorry to say but I am not allowed to because of NDA. Shortly after posting I was granted access to the MFi program which is strictly regulated. Even with the correct manuals this is tough matter to handle, let alone without...