Program to implement Deffi-Hellman Algorithm in Client-Server Fashion.
The Diffie Hellman Algorithm is being used to establish a shared secret that can be used for secret communications while exchanging data over a public network.
In the below program, the client will share the value of , , and public key . Whereas, the server will accept the values and calculate its public key and send it to the client.
Both Client and Server will calculate the secret key for symmetric encryption by using the public key.
Program 1: Server Program
Program 2: Client Program
Use javac to Compile the programs, and open two console/terminal to run the system
In the first console run the server program, it will wait for the client’s connection. As soon as client is connected results will popup
In the second console, run the client’s program
This article is attributed to GeeksforGeeks.org