ddn.net.tls.tls13client
TLS 1.3 client handshake (RFC 8446).
Implements the full TLS 1.3 client handshake as a resumable state machine. Each call to handshake() progresses through one or more phases until I/O is needed or the handshake completes.
Phases:
- Send ClientHello (key_share + supported_versions + supported_groups + signature_algorithms)
- Receive ServerHello (select cipher suite, key share group, compute shared secret)
- Receive EncryptedExtensions, Certificate, CertificateVerify, Finished
- Send client Finished
- Switch to application data keys
Types 2
TLS 1.3 client handshake phases.
Each phase represents a discrete step in the handshake state machine. The handshake progresses forward through these phases.
TLS 1.3 client handshake engine.
Drives the client side of a TLS 1.3 handshake over a record layer using a resumable state machine. After successful handshake, provides the AEAD cipher and negotiated parameters for application data exchange.
Call handshake() repeatedly until it returns TlsProgress.DONE. On NEED_READ, wait for the transport to become readable before calling again. On NEED_WRITE, wait for writability.
RecordLayer recordLayer_Tls13KeySchedule keySchedule_TranscriptHash transcript_string serverName_TlsVerifyMode verifyMode_TlsVerifyCallback verifyCallback_string[] alpnProtocols_NativeTlsTrustStore trustStore_string negotiatedAlpn_CipherSuiteId negotiatedCipher_ProtocolVersion negotiatedVersion_TlsCertificateChain peerCerts_TlsSession tlsSession_X25519PrivateKey ecdhePrivate_ubyte[] sharedSecret_ubyte[32] clientRandom_ubyte[32] legacySessionId_bool firstHelloDone_EcdhP256Store * ecdhP256Store_TlsAead clientWriteAead_TlsAead serverReadAead_TlsAead clientAppAead_TlsAead serverAppAead_Tls13HandshakePhase phase_SecureRandom rng_NamedGroup hrrSelectedGroup_ubyte[] hrrCookie_ubyte[] pendingPlaintext_ubyte[] pendingHandshakeData_TlsProgress handshake()Performs or continues the TLS 1.3 client handshake.TlsProgress skipCCSAndRead(ref TlsRecord record)TlsProgress ensureHandshakeData()Ensures we have at least 4 bytes of handshake data to read the message header. If we need more data for a complete message, reads and decrypts more records. Returns TlsProgress.DONE when enough dat...ubyte[] consumeHandshakeMessage()Consumes a handshake message from the pending buffer. Updates the transcript and returns the message data.ubyte[] buildClientHello(SecureRandom rng,
NamedGroup forcedGroup = NamedGroup.init,
const(ubyte)[] cookie = null)void processServerHello(TlsRecord rec)void parseServerKeyShare(const(ubyte)[] extData)void deriveSharedSecret()bool isHelloRetryRequest(TlsRecord rec)void processHelloRetryRequest(const(ubyte)[] data, size_t off,
size_t msgEnd)void switchToHandshakeKeys()void processEncryptedExtensions()void processCertificate()void verifyPeerCertificates()void processCertificateVerify()void verifyCertificateVerify(SignatureScheme sigScheme,
const(ubyte)[] signature, const(ubyte)[] message)void processServerFinished()ubyte[] buildClientFinished()void switchToApplicationKeys()void receiveNewSessionTicket()ubyte[] decryptRecord(TlsRecord rec, TlsAead aead)ubyte[] encryptRecord(ubyte[] handshakeMsg, TlsAead aead)this(RecordLayer recordLayer, string serverName,
TlsVerifyMode verifyMode, TlsVerifyCallback verifyCallback,
string[] alpnProtocols, NativeTlsTrustStore trustStore = null)Constructs a TLS 1.3 client handshake engine.EcdhP256StoreHeap storage for EcdhP256 since it's a struct.