A secure chat system implementing end-to-end encrypted messaging over a federated server network. Built with Python, WebSockets, and RSA-4096.
🔑 Security note: all RSA keypairs are generated locally at runtime — no private keys are stored in this repository.
Security
- RSA-4096 end-to-end encryption — servers cannot read message contents
- Message signing and signature verification
- Public key infrastructure with key request/exchange protocol
- SHA-256 integrity verification for file transfers
Messaging & files
- Encrypted direct messages and public channel broadcasts
- Cross-server message routing across the federated network
- Encrypted, chunked (4 KB) file transfer with automatic retry
Network
- Federated server architecture with automatic server discovery
- Introducer/bootstrap servers for joining the network
- Heartbeat-based connection monitoring
Requires Python 3.8+.
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt# Terminal 1 — introducer/bootstrap server (generates its RSA-4096 keypair on startup)
python run_server.py --port 8001 --introducer
# Terminal 2 — a second server that joins the network (optional)
python run_server.py --port 8002Options: --host, --port, --introducer, --verbose, --key KEYFILE.
cd client
python client.pyEnter the server host/port and a username; the client generates its own RSA-4096 keypair and announces its public key to the network.
| Command | Description |
|---|---|
/tell <user> <msg> |
Send an encrypted direct message |
/file <user> <path> |
Send a file (encrypted, SHA-256 verified) |
/all <msg> |
Broadcast to the public channel |
/list |
List all online users across servers |
/keys |
Show known public keys |
/request <user> |
Request a user's public key |
/quit |
Exit |
Start two servers (ports 8001 and 8002), connect alice to 8001 and bob to 8002, then /tell bob hello from alice — the message routes between servers and only bob can decrypt it.
server/
server.py # Main server: WebSockets, routing, protocol
crypto_handler.py # Cryptography operations
database.py # SQLite persistence (aiosqlite)
routing.py # Cross-server message routing
config.py # Configuration handling
client/
client.py # Interactive chat client
crypto_client.py # Client-side cryptography
common/
constants.py # Protocol constants and enums
key_exchange.py # Key exchange implementation
run_server.py # Server entry point
run_client.py # Client entry point
Built as a group project (Group 34) for Secure Programming at the University of Adelaide, by Omkar Thombre, Ayush Sahane, Sharvil Kadam, and Yashashree Talele.