Prototype

Secure TCP handshake demo

A Java TCP client/server that layers RSA-signed Diffie-Hellman, AES encryption, and HMAC integrity over raw sockets.

This lab is a compact secure-channel demo. It is intentionally educational, not production cryptography, but the protocol shape is clear: prove identity, derive a shared secret, encrypt payloads, and verify message integrity.

LayerMechanismPurpose
Identity proofRSA signatureShows the server owns the private key.
Key exchangeDiffie-HellmanDerives a shared secret over the socket.
ConfidentialityAES-256-CBCEncrypts messages after the handshake.
IntegrityHMAC-SHA-256Detects message tampering.

What makes it worth showing is not that it is “secure enough.” It is that the code makes a normally invisible protocol legible.

Repository: toy-secure-tcp-dh.

Built with

JavaTCP socketsDiffie-HellmanRSAAESHMAC