eve.tls.openssl.engine

OpenSSL TLS Engine

This module provides TLS/SSL support using the OpenSSL library. It implements the eve.tls.api contract using OpenSSL's libssl/libcrypto.

This engine is platform-independent and works wherever OpenSSL is available.

This module uses the deimos.openssl bindings from the openssl dub package.

Types 2

RAII wrapper for OpenSSL SSL_CTX.

Fields
private SSL_CTX * _ctx
Methods
TlsErrorCode initialize(ref const(TlsContext) tlsCtx) @trusted nothrowInitialize OpenSSL context from TlsContext configuration.
void release() @trusted nothrowRelease the OpenSSL context.
bool isValid() @property const pure @safe nothrow @nogcCheck if the context is valid.
SSL_CTX * handle() @property pure @safe nothrow @nogcGet the underlying SSL_CTX pointer.
structTlsStream(Transport)

TLS stream that wraps a transport connection with TLS encryption.

This struct provides non-blocking TLS operations suitable for event loop integration. All I/O operations return immediately with WANT_READ/WANT_WRITE status if they would block.

Parameters

TransportThe underlying transport type (e.g., TCP connection).
Fields
private Transport * _transport
private SSL * _ssl
private OpenSslContext _ctx
private TlsState _state
private TlsErrorCode _lastError
Methods
private void cleanup() @trusted nothrow
TlsState state() @property const pure @safe nothrow @nogcGet the current TLS state.
TlsErrorCode lastError() @property const pure @safe nothrow @nogcGet the last error code.
TlsIoInterest ioInterest() const pure @safe nothrow @nogcGet the current I/O interest for the underlying transport.
HandshakeResult handshake() @trusted nothrowPerform TLS handshake.
TlsIOResult read(ubyte[] buffer) @trusted nothrowRead decrypted data from the TLS stream.
TlsIOResult write(const(ubyte)[] data) @trusted nothrowWrite data to the TLS stream (will be encrypted).
void shutdown() @trusted nothrowShutdown the TLS connection gracefully.
void abort() @trusted nothrowAbort the TLS connection without sending close_notify.
CertificateInfo peerCertificate() @trusted nothrowGet information about the peer's certificate.
Constructors
this(Transport * transport, TlsContext ctx)Create a TLS stream wrapping a transport connection.

Functions 5

private fnint tlsVersionToOpenSSL(TlsVersion ver) pure @safe nothrow @nogcConvert TlsVersion to OpenSSL protocol version constant.
private fnint verifyModeToOpenSSL(TlsVerifyMode mode) pure @safe nothrow @nogcConvert TlsVerifyMode to OpenSSL verification mode flags.
private fnTlsErrorCode sslErrorToCode(int sslError) pure @safe nothrow @nogcConvert OpenSSL error code to TlsErrorCode.
fnTlsStream!T tlsClient(T)(T * transport, string serverName)Helper to create a client TLS stream.
fnTlsStream!T tlsServer(T)(T * transport)Helper to create a server TLS stream.