README.md (Markdown content)
Java sockets chat using AES encryption and Diffie–Hellman key exchange.
Console chat over TCP sockets with a secure channel:
- Diffie–Hellman key exchange (per connection)
- AES message encryption (GCM-ready; current impl uses hashed shared secret)
- Server accepts multiple clients (thread per client)
- DH key exchange; shared secret derived & hashed for AES key bytes
- AES encrypt/decrypt for chat messages
- Simple CaesarCipher kept for comparison/learning
- JDK 17+ (tested with JDK 23)
- (Optional)
lib/
with extra JARs if your IDE setup needs them
- Server generates a DH key pair and sends server public key to client.
- Client extracts DH params from server public key, generates its key pair with the same params, sends client public key back.
- Both sides compute the shared secret via
KeyAgreement
. - Shared secret is hashed → 16 bytes used as AES key (for demo).
- Messages are AES-encrypted before sending; decrypted on receive.
- Run
Server.java
- Run
Client.java
(one or more times)
Type messages in the client console; server broadcasts to all clients.
If you see “Illegal base64 character”, it means a non-Base64 line reached the decrypt step. (We’ll harden the protocol soon: message framing + type tags).
src/
module-info.java
server_client_chat_app/
Server.java
Client.java
ClientHandler.java
AESUtil.java
CaesarCipher.java
DiffieHellmanUtil.java
lib/ # optional jars
docs/ # screenshots/diagrams (optional)
- Switch to AES-GCM with IV + auth tag
- Message framing (length + type)
- Basic UI (JavaFX) and user names
- Unit tests for DH/AES utilities
- CI build (once we add Maven/Gradle)
java
sockets
diffie-hellman
aes
cryptography
client-server
MIT — see LICENSE.