ddn.net.tls.tls13server

TLS 1.3 server handshake (RFC 8446).

Implements the full TLS 1.3 server handshake as a resumable state machine:

  1. Receive ClientHello (parse extensions, key_share, supported_versions, etc.)
  2. Send ServerHello (select cipher suite, send key_share X25519)
  3. Send EncryptedExtensions, Certificate, CertificateVerify, Finished
  4. Receive client Finished
  5. Switch to application data keys

Types 2

TLS 1.3 server handshake phases.

NOT_STARTED
RECV_CLIENT_HELLO
SEND_SERVER_HELLO
FLUSH_SERVER_HELLO
SWITCH_TO_HANDSHAKE_KEYS
SEND_ENCRYPTED_EXTENSIONS
FLUSH_ENCRYPTED_EXTENSIONS
SEND_CERTIFICATE
FLUSH_CERTIFICATE
SEND_CERTIFICATE_VERIFY
FLUSH_CERTIFICATE_VERIFY
SEND_SERVER_FINISHED
FLUSH_SERVER_FINISHED
RECV_CLIENT_FINISHED
SWITCH_TO_APP_KEYS
SEND_NEW_SESSION_TICKET
FLUSH_NEW_SESSION_TICKET
DONE

TLS 1.3 server handshake engine.

Drives the server side of a TLS 1.3 handshake over a record layer using a resumable state machine. After successful handshake, provides the AEAD ciphers and negotiated parameters for application data exchange.

Methods
TlsProgress handshake()Performs or continues the TLS 1.3 server handshake.
Tls13ServerHandshakePhase phase() @property constReturns: The current handshake phase.
TlsAead serverAead() @propertyReturns: The server application data AEAD cipher.
TlsAead clientAead() @propertyReturns: The client application data AEAD cipher.
CipherSuiteId cipherSuite() @property constReturns: The negotiated cipher suite ID.
string alpn() @property constReturns: The negotiated ALPN protocol.
string serverName() @property constReturns: The server name from ClientHello SNI.
TlsCertificateChain peerCertificates() @propertyReturns: The peer certificate chain (empty for typical server).
TlsSession session() @propertyReturns: The TLS session for resumption.
Constructors
this(RecordLayer recordLayer, TlsVerifyMode verifyMode, TlsVerifyCallback verifyCallback, string[] alpnProtocols, ubyte[][] certChainDer, string certChainPem, string privateKeyPem)Constructs a TLS 1.3 server handshake engine.