1

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.

Mike Ounsworth
  • 57,707
  • 21
  • 150
  • 207
  • 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](https://en.wikipedia.org/wiki/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
  • Related question, but answers are out of date as they are pre-Signal: [Securing Peer to Peer communication](https://security.stackexchange.com/q/116832/61443) – Mike Ounsworth May 31 '18 at 11:59
  • @SteffenUllrich I'm not creating my own protocol but my problem is how to add this pre-shared key into the file transfer app.Your answers was helpful understanding the concept guys – Zakariae Belghazi May 31 '18 at 12:08
  • 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
  • @ZakariaeBelghazi Just use something like libsodium. It provides efficient key exchange and encryption. – forest Jun 01 '18 at 00:21

0 Answers0