std only.Expand description
Unified Phantom Protocol Handshake
The post-quantum, mutually-authenticated key-establishment state machine.
HandshakeClient and HandshakeServer exchange a ClientHello /
ServerHello pair that runs a hybrid KEM (X25519 + ML-KEM-768; ECDH-P-256 +
ML-KEM-768 under --features fips) and a hybrid signature (Ed25519 +
ML-DSA-65) over a single SHA-256 transcript. The signed transcript binds the
whole ClientHello plus the build-side PROTOCOL_VARIANT, giving the
downgrade / cross-mode resistance of Invariants 7 and 10.
On top of the core exchange the module layers: a stateless cookie + adaptive
proof-of-work DoS gate; per-IP reputation-driven difficulty (DOS-2); 0-RTT
session resumption with a proof-of-possession binder (HS-03) and one-shot
anti-replay (Invariant 9); and optional AEAD-sealed early-data folded into
the single ClientHello. HandshakeStage tracks the staged progression
(Initial -> ClassicalReady -> Established | Failed).
Structs§
- Client
Hello - Client hello message (initiates handshake).
- Handshake
Client - Handshake Client State Machine
- Handshake
Server - Handshake Server State Machine
- Hello
Retry Request - Hello Retry Request (Server demands PoW or Cookie)
- Server
Hello - Server hello message (response to ClientHello)
- Server
Reject - Typed handshake rejection the server returns instead of silently dropping
the connection when it structurally cannot satisfy a
ClientHello— today, an unknownversion. It gives a forward/backward-incompatible peer an actionable signal (the version the server speaks) rather than a bare connection reset.
Enums§
- Handshake
Error - Handshake
Response - Server response to ClientHello
- Handshake
Stage - Server
Reply - A discriminated server handshake reply (T4.4).
Constants§
- EARLY_
DATA_ MAX_ LEN - Maximum 0-RTT early-data plaintext, in bytes. The client constructor rejects a larger payload; the server drops an oversized blob and continues as a normal 1-RTT handshake. Caps the work an unauthenticated peer can force before the handshake completes.
- PROTOCOL_
VARIANT Non- fips - Compile-time protocol-variant tag, baked into every
ClientHello(cleartext field) and the signed handshake transcript. Peers reject mismatched variants up front withHandshakeError::ProtocolVariantMismatch; even an attacker who rewrites the cleartext field cannot escape detection because the transcript signature is computed over the build’s own variant. - PROTOCOL_
VERSION - The sole protocol version carried in
ClientHello.versionand bound into the handshake transcript. Pinned to one value — the protocol is not negotiated (pre-1.0, no users). It is a tamper-check anchor and a hook for a future, deliberate version increment. - REJECT_
UNSUPPORTED_ VERSION ServerReject::code: the client’sClientHello.versionis one this server does not speak.supported_versioncarries the version it does speak.- SERVER_
REJECT_ MARKER - Marker leading a
ServerRejectbody. Reply kind dispatch is by the explicitServerReplydiscriminant byte (from_wire), not by this marker — but the marker is a defense-in-depth integrity check inside the reject payload, so a malformed or confusable blob can never be silently mistaken for a genuine reject (seeServerReject::has_marker).
Traits§
- Zero
RttAnti Replay - Pluggable 0-RTT anti-replay hook — the distributed-deployment seam (A2b).