- TCP socket communication between clients via a central server
- Diffie-Hellman key exchange (RFC 3526, 2048-bit MODP Group 14) for session key establishment
- SHA-256 key derivation from DH shared secret
- AES-256-GCM authenticated encryption ensuring confidentiality and message integrity
- Real-time active user list with automatic updates on connect/disconnect
- Peer selection - choose who you want to chat with using /chat
Start the server:
python3 -m server.server
Start clients (in separate terminals):
python3 -m client.client
/chat <username>Start an encrypted session with a user/quitto disconnect from the server
- Client connects to server via TCP
- Client sends
HELLO:<username> - Server responds with
HELLO_OKor an error - Server broadcasts updated user list to all clients
- Alice sends
/chat bob— client sendsDH_INIT:bob:alice:<public_key> - Server forwards message to Bob
- Bob automatically responds with
DH_RESPONSE:alice:bob:<public_key> - Server forwards response to Alice
- Both parties independently compute the shared secret and derive an AES-256 key via SHA-256
- Sender encrypts plaintext using AES-256-GCM
- Message is sent as
CHAT:<target>:<sender>:<json_payload> - JSON payload contains
ciphertext,tag, andnonce— all Base64 encoded - Server forwards payload to target without being able to read contents
- Recipient decrypts and verifies message integrity using the tag
This project is actively being developed. Planned improvements...