eve.tls.api
TLS API Contract Module
This module defines the common API/contract that platform-specific TLS implementations (OpenSSL on Linux, SChannel on Windows) must implement. It provides types for TLS configuration, connection state, certificate handling, and stream operations.
Copyright
Types 11
TLS protocol versions supported by the library.
These values represent the various versions of the TLS protocol that can be negotiated during the handshake.
Error codes for TLS operations.
These codes identify specific TLS-related failures that may occur during handshake, data transfer, or certificate validation.
TLS-specific exception with error code.
This exception is thrown when a TLS operation fails. It includes an error code that identifies the specific type of failure.
TlsErrorCode codeThe specific TLS error code.this(TlsErrorCode code, string msg, string file = __FILE__, size_t line = __LINE__)Construct a TlsError with the given code and message.this(string msg, string file = __FILE__, size_t line = __LINE__)Construct a TlsError with just a message (defaults to INTERNAL_ERROR).Certificate verification modes.
These modes control how the TLS implementation verifies the peer's certificate during the handshake.
TLS connection role.
Identifies whether the connection acts as a client or server during the TLS handshake.
TLS handshake progress state.
Tracks the current state of the TLS handshake process.
TLS stream state.
Represents the overall state of a TLS stream connection.
X.509 certificate information.
Contains the essential fields extracted from an X.509 certificate, typically used for displaying certificate details or logging.
string subjectCertificate subject distinguished name.string issuerCertificate issuer distinguished name.string notBeforeStart of certificate validity period (ISO 8601 format).string notAfterEnd of certificate validity period (ISO 8601 format).string serialNumberCertificate serial number as hex string.TLS configuration context.
Holds configuration parameters for TLS connections, including protocol version constraints and certificate verification settings. This context is used to initialize TLS streams.
TlsVersion minVersionMinimum allowed TLS protocol version.TlsVersion maxVersionMaximum allowed TLS protocol version.TlsVerifyMode verifyModeCertificate verification mode.TlsRole roleConnection role (client or server).string serverNameServer hostname for SNI (Server Name Indication).string caCertFilePath to CA certificates file (PEM format).string certFilePath to client/server certificate file (PEM format).string keyFilePath to private key file (PEM format).TlsContext clientContext() pure @safe nothrow @nogcCreate a client-side TLS context with secure defaults.TlsContext serverContext() pure @safe nothrow @nogcCreate a server-side TLS context with secure defaults.TlsContext setMinVersion(TlsVersion ver) ref pure @safe nothrow @nogc returnSet the minimum TLS protocol version.TlsContext setMaxVersion(TlsVersion ver) ref pure @safe nothrow @nogc returnSet the maximum TLS protocol version.TlsContext setVerifyMode(TlsVerifyMode mode) ref pure @safe nothrow @nogc returnSet the certificate verification mode.TlsContext setServerName(string name) ref pure @safe nothrow @nogc returnSet the server name for SNI.TlsContext setCaCertFile(string path) ref pure @safe nothrow @nogc returnSet the CA certificates file path.TlsContext setCertFile(string path) ref pure @safe nothrow @nogc returnSet the certificate file path.TlsContext setKeyFile(string path) ref pure @safe nothrow @nogc returnSet the private key file path.I/O result for TLS stream operations.
Encapsulates the result of a read or write operation, including the number of bytes transferred and any error that occurred.
size_t bytesTransferredNumber of bytes successfully transferred.TlsErrorCode errorError code if the operation failed.Handshake result from a TLS handshake operation.
Contains the current state of the handshake and any error information.
HandshakeState stateCurrent state of the handshake.TlsErrorCode errorError code if handshake failed.