Secure Chat Application Using End-to-End Encryption (Python + AES/RSA) | Tour2Tech
Home / Projects / Secure Chat (E2EE)
LIMITED OFFER
Get up to ₹1,000 OFF
Use coupon MYProject when you book via WhatsApp/Call. We don’t sell online.
Python • PyCryptodome • Sockets/Flask • SQLite

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
Delivery in 3–5 days • Pan-India support
*Demo video placeholder. Replace with your link.
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
Existing System
  • Centralized servers with weak/opaque encryption
  • Possibility of provider/attacker message access
  • Poor key management; no device-to-device E2EE
Proposed System
  • 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
  1. User Authentication: User logs in/creates account.
  2. Key Generation: Per-user RSA keypair (public/private).
  3. Session Setup: Sender encrypts a new AES key with recipient’s RSA public key.
  4. Message Encryption: Each message encrypted with the AES session key.
  5. Decryption: Recipient uses RSA private key to unwrap AES key, then decrypts messages.
  6. 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
User Authentication Module

Login/registration & verification.

  • Salted hashes
  • Session tokens
Encryption Module

AES encryption/decryption of messages.

  • CBC/GCM modes
  • Random IV per message
Key Exchange Module

RSA-wrapped AES session keys.

  • Per-session keys
  • Public key directory
Message Transfer Module

Socket/Flask real-time relay.

  • Async threads
  • Delivery acks
GUI Module

Tkinter chat window & contacts.

  • Status & typing
  • Attachment picker*
Logging Module

Optional metadata logging only.

  • No content storage
  • Audit/troubleshoot
*Attachments are encrypted client-side with the same session key.
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]]
              
Delivery includes full Python source (AES CBC/GCM), RSA key management, Tkinter GUI, socket/Flask server, SQLite schema, and documentation.
What You Get
ItemIncludedNotes
Python Source CodePyCryptodome + Sockets/Flask
E2EE (AES + RSA)Per-session keys, IV per message
Tkinter GUI ClientChat, contacts, status
Server ComponentRelays ciphertext only
Demo VideoSetup & working walkthrough
Report & PPTCollege-format templates
SupportInstallation + viva Q&A (1 month)

FAQs — Secure Chat (E2EE)

The AES session key is wrapped with the recipient’s RSA public key using OAEP padding. Only their RSA private key can unwrap it.

Yes. GCM provides authenticated encryption (confidentiality + integrity). The project includes both modes.

By default, it only relays encrypted payloads. You can enable ephemeral queueing with auto-expiry if users are offline.

Need a privacy-first chat app?

Get the Secure Chat Application with code, demo, docs, and support.

WhatsApp Us Now
Shopping Cart
Scroll to Top
Open chat
Need help in Admission?
Hello! 👋 Welcome to Tour2Tech Academy!

We’re here to help you succeed in your engineering journey with:

🌟 Final Year Projects
🎯 College Admission Consultancy
📚 Career Guidance and Skill-Building Courses

How can we assist you today? Whether you need help with a project, are looking for career guidance, or want to know more about our services, we’re just a message away! 😊