Skip to content

Simulation of Diffie-Hellman key exchange with a Man-in-the-Middle (MITM) attack demonstration in Java.

Notifications You must be signed in to change notification settings

shaina-gh/Diffie-Hellman--MITM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Diffie-Hellman Key Exchange with MITM Attack

This project demonstrates a secure key exchange using the Diffie-Hellman protocol while simulating a Man-in-the-Middle (MITM) attack using Java socket programming.

Author: Shaina

🧪 Aim

  • To implement a multi-party Diffie-Hellman key exchange protocol.
  • To simulate a Man-in-the-Middle attack on the key exchange.

🧠 Concept Overview

The Diffie-Hellman protocol allows two parties to securely share a secret key over an insecure channel. A MITM attack compromises the exchange by intercepting and modifying public keys, establishing separate shared secrets with both parties without their knowledge.

📁 Files Included

  • ClientAlice.java: Simulates Alice, who initiates the key exchange.
  • ClientBob.java: Simulates Bob, the receiver of Alice's key.
  • MitmEve.java: Simulates Eve, the attacker performing a MITM attack.

⚙️ How to Run

Compile all Java files:

javac ClientAlice.java ClientBob.java MitmEve.java

Open 3 terminals and run the programs in the following order:

Terminal 1 (Start Eve / MITM Server):

java MitmEve

Terminal 2 (Start Alice):

java ClientAlice

Terminal 3 (Start Bob):

java ClientBob

Observe the shared secret and public key exchange on each terminal. You will see that Eve successfully establishes shared secrets with both Alice and Bob separately.

About

Simulation of Diffie-Hellman key exchange with a Man-in-the-Middle (MITM) attack demonstration in Java.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages