Skip to content

About

A secure peer-to-peer chat application built in Python using socket programming with RSA-based key exchange and AES-GCM encryption. Designed for LAN communication without any central server.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🔐 Secure P2P Encrypted Chat (Python)

A peer-to-peer (P2P) secure chat application built using Python sockets with end-to-end encryption using **RSA + AES-GCM**.

This project allows multiple users connected to the same network (Wi-Fi/LAN) to communicate securely without a central server.

---

## 🚀 Features

- 🔐 End-to-End Encryption (RSA + AES-GCM)
- 📡 Peer-to-Peer Communication (No Server Required)
- ⚡ Fast TCP Socket Messaging
- 👤 Username-based Messaging
- 🔁 Automatic Reconnection Handling
- 🧵 Multi-threaded Client Handling
- 🛡 Secure Key Exchange (RSA OAEP)

---

## 🧠 How It Works

1. Each user generates an RSA key pair.
2. When connecting:
   - Users exchange public keys.
   - A secure AES session key is generated.
   - AES key is encrypted using RSA.
3. Messages are encrypted using AES-GCM before sending.
4. Receiver decrypts messages securely.

---

## 📦 Requirements

Install dependencies:

```bash
pip install cryptography

▶️ Usage

Step 1: Run the script

python chat.py

Step 2: Enter your name

Your name: Guhan

Step 3: Add peer IPs (same Wi-Fi)

Peer IP: 192.168.1.5
Peer IP: 192.168.1.6

Step 4: Start chatting 🎉


🌐 Network Requirements

  • All devices must be on the same Wi-Fi/LAN
  • Firewall should allow port 7777

🛠 Project Structure

chat.py        # Main application
README.md      # Documentation
LICENSE        # License file

🔒 Security Details

  • RSA (2048-bit) for key exchange
  • AES-GCM (128-bit) for message encryption
  • Unique nonce per message
  • Protection against replay attacks

⚠ Limitations

  • Works only in local network (LAN/Wi-Fi)
  • No message persistence (no database)
  • Manual IP input required

🤝 Contributing

Feel free to fork and improve this project!


👨‍💻 Author

Guhan Senthil

About

A secure peer-to-peer chat application built in Python using socket programming with RSA-based key exchange and AES-GCM encryption. Designed for LAN communication without any central server.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages