Skip to content

πŸ” CipherChat β€” Secure end-to-end encrypted chat using the Signal Protocol (X3DH + Double Ratchet). Features TLS transport security, IPv4/IPv6 support, perfect forward secrecy, TOFU key verification, and AES-256-GCM encrypted messaging.

License

Notifications You must be signed in to change notification settings

DNSdecoded/CipherChat

Repository files navigation

πŸ” CipherChat β€” Secure End-to-End Encrypted Messenger (Python)

CipherChat is a professional-grade encrypted chat system featuring Signal Protocol security (X3DH + Double Ratchet), TLS transport encryption, and dual IPv4/IPv6 support. Messages are protected with perfect forward secrecy, future secrecy, and zero-knowledge messaging β€” ensuring that even the server cannot read user messages.

Python 3.8+ License: MIT Security: Signal Protocol


✨ Features

πŸ” End-to-End Encryption (Signal Protocol)

  • X3DH handshake for key exchange
  • Double Ratchet for per-message forward secrecy
  • X25519 ECDH key agreement
  • AES-256-GCM authenticated encryption

πŸ›‘ MITM Protection

  • TOFU (Trust-On-First-Use) key pinning
  • Key fingerprints & safety numbers
  • Key change warnings and verification prompts

🌐 Network & Transport Security

  • TLS 1.2+ encrypted transport layer
  • Dual IPv4/IPv6 support with fallback
  • Real-time delivery (TCP_NODELAY)
  • Zero-knowledge server design

πŸ’¬ Chat Features

  • Multi-user secure messaging
  • Broadcast encrypted messages
  • Identity verification guidance
  • Presence updates (join/leave)

πŸš€ Quick Start

πŸ“Œ Requirements

  • Python 3.8 or higher
  • OpenSSL (recommended for certificate generation)

πŸ“¦ Install Dependencies

pip install -r requirements.txt

πŸ”‘ Generate TLS Certificates

python generate_certs.py

πŸ–₯ Start the Server

python server.py

πŸ’¬ Start a Client

python client_v2.py

Enter:

  • Server address: localhost or IP
  • Port: 5000 (default)
  • Username: any name

πŸ“– Usage (Security Demonstration)

πŸ” First Contact (TOFU Key Verification)

============================================================
[TOFU] First contact with Bob
============================================================
Identity fingerprint:
  SHA256:abcd1234...ef567890

Verify this fingerprint with Bob out-of-band (phone, in person)
============================================================

⚠️ Key Change Warning Example

⚠️  SECURITY WARNING: Bob's key changed!
Do NOT accept unless verified with Bob!

🧠 Architecture Overview

πŸ”‘ Key Exchange (X3DH)

Alice β†’ Server β†’ Bob (key bundle)
   β”‚                   β”‚
   └── Performs DH ops β”˜
        β†’ shared secret

πŸ”„ Forward Secrecy (Double Ratchet)

  • New keys on every message
  • Past messages safe even if keys leak

πŸ“‚ Project Structure

CipherChat/
 β”œβ”€β”€ server.py              # Secure chat server (TLS + bundle relay)
 β”œβ”€β”€ client_v2.py           # Signal client with TOFU + Ratchet
 β”œβ”€β”€ x3dh.py                # X3DH key agreement
 β”œβ”€β”€ double_ratchet.py      # Double Ratchet protocol
 β”œβ”€β”€ x25519_utils.py        # X25519 ECDH + fingerprints
 β”œβ”€β”€ crypto_utils.py        # AES-GCM encryption
 β”œβ”€β”€ generate_certs.py      # TLS certificate generator
 β”œβ”€β”€ config.py              # Configuration options
 └── certs/                 # πŸ”’ (ignored) Local TLS keys

πŸ”’ Security Notes

Protected

βœ” Message content (E2E)
βœ” Transport layer (TLS)
βœ” Forward secrecy
βœ” MITM (with user verification)

Not Protected

❌ Metadata (who talks to whom)
❌ Timing/traffic analysis
❌ First-contact MITM if user ignores fingerprint verification


πŸ“œ License

This project is licensed under the MIT License.
See LICENSE for details.


πŸ™Œ Contributions

Contributions, audits, and improvements are welcome!
Secure coding tips or vulnerability reports are especially appreciated.

About

πŸ” CipherChat β€” Secure end-to-end encrypted chat using the Signal Protocol (X3DH + Double Ratchet). Features TLS transport security, IPv4/IPv6 support, perfect forward secrecy, TOFU key verification, and AES-256-GCM encrypted messaging.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages