CryptoChatApp is a messaging application demonstrating cryptographic principles implemented from scratch. Without relying on external cryptographic libraries, it explores the fundamentals of Elliptic-curve Diffie–Hellman (asymmetric encryption) for key exchange and AES (symmetric encryption) for message security. Built using React.js and Node.js, the app supports real-time messaging through WebSocket. Refer to the Message Encryption Flow section for detailed cryptographic workflows.
demo.mp4
Note: This project is for educational purposes and should not be used in production.
- Ensure Docker is installed on your system.
docker pull ghcr.io/guillaumedorschner/rtu-cryptochatapp:latest
docker run -p 80:80 -p 3000:3000 -p 3001:3001 ghcr.io/guillaumedorschner/rtu-cryptochatapp:latest
Then open your browser and visit http://localhost
.
-
Clone the repository:
git clone https://github.com/GuillaumeDorschner/CryptoChatApp.git cd CryptoChatApp
-
Start the application with Docker:
docker compose up
-
Open your browser and visit
http://localhost:3000
.
- ECDH: Used to securely exchange the symmetric AES key between users.
- AES: AES ensures message confidentiality by using a symmetric key derived from the ECDH shared secret.
- WebSocket: Facilitates real-time encrypted messaging by relaying data between users, without requiring server-side storage of messages.
The server acts solely as a relay and does not decrypt or store messages.
sequenceDiagram
participant A as Alice (User)
participant S as Server
participant B as Bob (User)
Note over A,B: Key Exchange Phase
A->>S: Send ECDH Public Key
S-->>B: Relay Alice's ECDH Public Key
B->>S: Send ECDH Public Key
S-->>A: Relay Bob's ECDH Public Key
A->>A: Compute Shared Secret with Bob's Public Key
B->>B: Compute Shared Secret with Alice's Public Key
A->>A: Derive AES Key from Shared Secret
B->>B: Derive AES Key from Shared Secret
Note over A,B: Messaging Phase
A->>S: Send encrypted message for Bob (via AES)
S-->>B: Relay encrypted message for Bob (via AES)
B->>B: Decrypt message using AES
B->>S: Send encrypted message for Alice (via AES)
S-->>A: Relay encrypted message for Alice (via AES)
For a detailed explanation of this project, refer to the Technical Design System.
Elliptic-Curve Diffie-Hellman (ECDH) is chosen for its high security with smaller key sizes compared to RSA or traditional Diffie-Hellman, making it faster and more efficient.
📹 Watch: Elliptic Curve Cryptography Explained
AES (Advanced Encryption Standard) is a symmetric encryption algorithm widely used for its speed and security.
📹 Watch: AES Explained
ECC, while secure, has implementation challenges and requires careful attention to avoid side-channel attacks.
📹 Watch: Problems with ECC
For an introduction to public and private key cryptography, check out this beginner-friendly explanation:
📹 Watch: Diffie-Hellman and ECC with Color Analogy
- Frontend: React.js
- Backend: Node.js
- Real-time Messaging: WebSocket (via
ws
) - Custom Cryptography: ECDH and AES implemented manually.
This project is licensed under the MIT License.