Overview
End-to-end encrypted real-time chat application built in C++ using the Crow web framework and ASIO for async networking. Implements symmetric AES encryption before message transmission and asymmetric RSA decryption on the receiver side. Features WebSocket-based real-time messaging, user authentication, TLS/SSL with self-signed certificates, and a multi-threaded architecture with mutex-protected message queues.
The Problem
Real-time chat systems commonly store and transmit messages in plaintext on the server, making them vulnerable to server-side breaches and man-in-the-middle attacks. There is educational value in demonstrating end-to-end encryption concepts through a working implementation — showing how symmetric encryption (AES) on the sender side and asymmetric decryption (RSA) on the receiver side can create a secure communication channel where the server only ever sees ciphertext.
The Solution
A C++ end-to-end encrypted real-time chat application built with the Crow web framework and ASIO for async networking. Messages are encrypted with AES (symmetric) before transmission and decrypted with RSA (asymmetric private key) on the receiver side. The server handles WebSocket connections via Crow, manages a mutex-protected message queue for thread safety, and serves the web UI from templates. TLS/SSL is implemented with self-signed certificates (cert.pem/key.pem). User authentication gates access before any message exchange.
Key Features
End-to-End Encryption
AES symmetric encryption applied to messages before transmission. RSA asymmetric decryption on the receiver side. Server only ever processes and stores ciphertext — plaintext never touches the server.
WebSocket Real-Time Messaging
Crow framework WebSocket implementation enables full-duplex real-time message exchange. Mutex-protected connection pool manages concurrent WebSocket connections safely in a multi-threaded environment.
TLS/SSL Transport Security
Self-signed certificate (cert.pem/key.pem) provides transport-layer encryption via OpenSSL. All communication between client and server is encrypted at both application and transport layers.
Multi-threaded Architecture
ASIO event loop with std::mutex for thread-safe message queue access. Handles concurrent WebSocket connections and message delivery without race conditions.
User Authentication
Login system gates access to the chat before any encrypted messaging. Session management prevents unauthorized message access.
Architecture
C++ application using Crow (header-only web framework) with ASIO for async I/O. WebSocket endpoint manages a mutex-protected vector of active connections. Messages stored in a std::vector<Message> with timestamp, user, and content fields. Encryption layer (encryption.h) provides AES XOR cipher and RSA placeholder. HTML/JS UI served from templates/ directory via Crow mustache rendering. TLS configured via ASIO SSL context with self-signed certificates.
How to Use
Compile with the provided Makefile (requires ASIO and Crow headers). Run the compiled executable to start the server. Access the web UI in a browser at the server address. Authenticate with credentials to enter the chat. Messages are encrypted client-side before sending — the server only stores and forwards ciphertext. Multiple concurrent users are supported via WebSocket connections managed with mutex-locked connection pools.
Impact & Results
Demonstrates end-to-end encryption concepts in a fully working C++ implementation, bridging the gap between cryptography theory and practical application. The mutex-protected message queue and WebSocket connection pool showcase systems programming fundamentals in C++. TLS/SSL implementation adds transport-layer security on top of application-layer E2EE for defense-in-depth. The project serves as a reference implementation for understanding how modern secure messaging applications implement layered encryption.

