Search code examples
javaencryptiondiffie-hellman

Implement full Diffie-Helllman key exchange encryption in java


I have a chat program that uses sockets for sending and receiving data. Now, I want to encrypt the data transfers via sockets with Diffie-Hellman key exchange system. What is the easiest way to do that?


Solution

  • What is the easiest way to do that?

    Use JSSE and configure to use Diffie Hellman.
    JSSE is Java's socket extension for SSL. Using the SecureSocket classes which provide the same interface as regular sockets (so your current code does not need to change) but operate over SSL you can achieve encryption in your network connectivity.
    You should study the link provided to see how to configure to do what you need.