ddn.net.tls.stream
Native TLS stream implementation.
Provides the encrypted stream for reading and writing application data over a TLS connection. Supports non-blocking I/O via TlsProgress return values. Manages handshake state, negotiated parameters, and the underlying transport.
enum ShutdownState
class NativeTlsStream
Types 2
enumShutdownState
Shutdown state machine phases.
NOT_STARTED
SEND_CLOSE_NOTIFY
WAIT_CLOSE_NOTIFY
DONE
classNativeTlsStream : TlsStream
Native TLS stream using pure D cryptographic primitives.
Wraps a TlsTransport and provides TLS encryption/decryption. All potentially-blocking operations return TlsProgress or TlsResult to support non-blocking I/O.
Fields
private TlsTransport transport_private TlsRole role_private string serverName_private TlsHandshakeState handshakeState_private TlsVersion negotiatedVersion_private CipherSuiteId cipherSuiteId_private string cipherSuite_private string alpnProtocol_private TlsCertificateChain peerCerts_private TlsSession session_private TlsVerifyCallback verifyCallback_private TlsVerifyMode verifyMode_private ubyte[] readBuffer_private size_t readPos_private ubyte[] applicationReadBuffer_private size_t applicationReadPos_private TlsError lastError_private ShutdownState shutdownState_private bool receivedCloseNotify_private RecordLayer handshakeRecordLayer_private Tls13Client tls13Client_private Tls12Client tls12Client_private Tls13Server tls13Server_private Tls12Server tls12Server_private bool serverHelloPeeked_private bool serverUseTls13_TlsVersion minVersion_TlsVersion maxVersion_string[] cipherSuites_string[] alpnProtocols_ubyte[][] serverCertChainDer_string serverCertChainPem_string serverPrivateKeyPem_TlsSessionCache sessionCache_NativeTlsTrustStore trustStore_TlsAead writeAead_TlsAead readAead_Methods
TlsProgress handshake()Performs or continues the TLS handshake.TlsProgress flush()Flushes any buffered data through the TLS layer.TlsProgress shutdown()Initiates graceful TLS shutdown (sends close_notify).void close()private
TlsProgress sendCloseNotify()private
void initHandshakeEngine()private
TlsProgress driveHandshake()private
TlsProgress driveServerHandshake()private
void finalizeHandshake()private
void applyEngineResult(CipherSuiteId cs, string alpn,
TlsCertificateChain peerCerts, TlsSession tlsSession)private
TlsResult readEncrypted(ubyte[] buffer)private
void processPostHandshakeMessage(const(ubyte)[] plaintext)Handles a decrypted post-handshake message (RFC 8446 §4.6).private
TlsResult writeEncrypted(const(ubyte)[] data)private
TlsRecord readTlsRecord()Constructors
this(TlsTransport transport, TlsRole role, string serverName,
TlsVersion minVersion, TlsVersion maxVersion,
TlsVerifyMode verifyMode, TlsVerifyCallback verifyCallback)Constructs a NativeTlsStream.