I'm working on the famous android app to transfer files using WiFi-Direct technology: https://github.com/Miserlou/Android-SDK-Samples/tree/master/WiFiDirectDemo

I want to implement a key exchange protocol (Diffie-Hellman) but I'm confused about where to put my key source code into this app.

  • Is there some reason you can't use a TLS library to handle the key exchange? – Mike Ounsworth May 31 '18 at 11:38
  • I don't have a Client/Server architecture. I'm working on Device-to-Device communication. No client can handle the Certificate while using TLS. – Zakariae Belghazi May 31 '18 at 11:53
  • Hmm, how about Signal protocol? Basically, please find a suitable and reputable library rather than rolling your own DH. – Mike Ounsworth May 31 '18 at 11:58
  • 2
    @ZakariaeBelghazi: TLS does not need to be used with certificates but can be used with pre-shared key (PSK) and other methods (even without authentication). TLS does not need to be used with many clients against one server but can also be one device connecting to one another. Don't invent your own protocol just because you don't understand what established protocols can do. – Steffen Ullrich May 31 '18 at 11:59
  • 1
    @ZakariaeBelghazi: do I understand it correctly that you know what to do but don't know where to do it in the source code? In this case this is not a security question but a coding question, i.e. off-topic here and more on-topic on stackoverflow.com. Only they expect the OP to do more work by his own first, i.e. not just link to some complex code and ask where it should be changed but try to solve the problem first, show what was tried and why it failed etc. – Steffen Ullrich May 31 '18 at 12:53