Secure Chat Application — True End-to-End Encryption (AES + RSA)
Messages encrypt on your device with AES. Session keys are exchanged via RSA. The server sees only ciphertext. Private by design, real-time, and extensible.
- ✓E2EE: AES for messages, RSA for key exchange
- ✓Per-session keys & authentication
- ✓Socket/Flask server with Tkinter GUI client
1. Introduction
The Secure Chat Application Using End-to-End Encryption is a Python-based communication system for private messaging. It applies AES to encrypt messages on the sender’s device and uses RSA to share session keys securely. With authentication, key exchange, and a simple GUI, it prevents interception and unauthorized access while keeping chat responsive and lightweight.
2. Existing System vs Proposed System
- Centralized servers with weak/opaque encryption
- Possibility of provider/attacker message access
- Poor key management; no device-to-device E2EE
- True E2EE: AES messages + RSA key exchange
- Fresh session keys per conversation
- No plaintext leaves the device
- Authentication & session management
- LAN or Internet compatible
3. Working
- User Authentication: User logs in/creates account.
- Key Generation: Per-user RSA keypair (public/private).
- Session Setup: Sender encrypts a new AES key with recipient’s RSA public key.
- Message Encryption: Each message encrypted with the AES session key.
- Decryption: Recipient uses RSA private key to unwrap AES key, then decrypts messages.
- Secure Communication: Server relays ciphertext only.
4. Technology Stack
- Language: Python
- Libraries: socket, threading, tkinter, PyCryptodome, base64
- Algorithms: AES (message), RSA (key exchange)
- Framework: Flask or socket-based real-time server
- Database: SQLite3 or JSON user records
- Security: Session auth, endpoint encryption/decryption
5. Modules
Login/registration & verification.
- Salted hashes
- Session tokens
AES encryption/decryption of messages.
- CBC/GCM modes
- Random IV per message
RSA-wrapped AES session keys.
- Per-session keys
- Public key directory
Socket/Flask real-time relay.
- Async threads
- Delivery acks
Tkinter chat window & contacts.
- Status & typing
- Attachment picker*
Optional metadata logging only.
- No content storage
- Audit/troubleshoot
6. Advantages
- Strong E2EE keeps messages confidential
- Server and admins can’t read chats
- Efficient crypto suitable for real-time use
- Supports text, files, and attachments
- Scalable to groups/multi-user rooms
7. Applications
- Confidential personal/business chat
- Corporate/government secure comms
- Private academic/research discussions
- Enterprise intranet messaging
Python Integration Sketch (Sockets/Flask + PyCryptodome)
# RSA keypair per user
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP, AES
from Crypto.Random import get_random_bytes
# Generate user RSA keys (once)
def gen_user_keys():
key = RSA.generate(2048)
return key.export_key(), key.publickey().export_key()
# Start secure session: wrap AES key with recipient's RSA public key
def start_session(recipient_pub_pem):
aes_key = get_random_bytes(32) # AES-256
iv = get_random_bytes(16)
rsa_pub = RSA.import_key(recipient_pub_pem)
wrapped = PKCS1_OAEP.new(rsa_pub).encrypt(aes_key)
return aes_key, iv, wrapped # send 'wrapped' + iv to recipient
# Encrypt message
def enc_msg(aes_key, iv, plaintext):
cipher = AES.new(aes_key, AES.MODE_CBC, iv=iv)
pad = 16 - (len(plaintext) % 16)
ct = cipher.encrypt(plaintext + bytes([pad])*pad)
return ct
# Decrypt session key (recipient side)
def unwrap_key(priv_pem, wrapped):
rsa_priv = RSA.import_key(priv_pem)
return PKCS1_OAEP.new(rsa_priv).decrypt(wrapped)
# Decrypt message
def dec_msg(aes_key, iv, ciphertext):
cipher = AES.new(aes_key, AES.MODE_CBC, iv=iv)
pt = cipher.decrypt(ciphertext)
return pt[:-pt[-1]]
What You Get
| Item | Included | Notes |
|---|---|---|
| Python Source Code | ✅ | PyCryptodome + Sockets/Flask |
| E2EE (AES + RSA) | ✅ | Per-session keys, IV per message |
| Tkinter GUI Client | ✅ | Chat, contacts, status |
| Server Component | ✅ | Relays ciphertext only |
| Demo Video | ✅ | Setup & working walkthrough |
| Report & PPT | ✅ | College-format templates |
| Support | ✅ | Installation + viva Q&A (1 month) |
FAQs — Secure Chat (E2EE)
Need a privacy-first chat app?
Get the Secure Chat Application with code, demo, docs, and support.
WhatsApp Us Now
