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.
- X3DH handshake for key exchange
- Double Ratchet for per-message forward secrecy
- X25519 ECDH key agreement
- AES-256-GCM authenticated encryption
- TOFU (Trust-On-First-Use) key pinning
- Key fingerprints & safety numbers
- Key change warnings and verification prompts
- TLS 1.2+ encrypted transport layer
- Dual IPv4/IPv6 support with fallback
- Real-time delivery (TCP_NODELAY)
- Zero-knowledge server design
- Multi-user secure messaging
- Broadcast encrypted messages
- Identity verification guidance
- Presence updates (join/leave)
- Python 3.8 or higher
- OpenSSL (recommended for certificate generation)
pip install -r requirements.txtpython generate_certs.pypython server.pypython client_v2.pyEnter:
- Server address:
localhostor IP - Port:
5000(default) - Username: any name
============================================================
[TOFU] First contact with Bob
============================================================
Identity fingerprint:
SHA256:abcd1234...ef567890
Verify this fingerprint with Bob out-of-band (phone, in person)
============================================================
β οΈ SECURITY WARNING: Bob's key changed!
Do NOT accept unless verified with Bob!
Alice β Server β Bob (key bundle)
β β
βββ Performs DH ops β
β shared secret
- New keys on every message
- Past messages safe even if keys leak
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
β Message content (E2E)
β Transport layer (TLS)
β Forward secrecy
β MITM (with user verification)
β Metadata (who talks to whom)
β Timing/traffic analysis
β First-contact MITM if user ignores fingerprint verification
This project is licensed under the MIT License.
See LICENSE for details.
Contributions, audits, and improvements are welcome!
Secure coding tips or vulnerability reports are especially appreciated.