March Docs

Tls

stdlib/tls.march — TLS (Transport Layer Security) support for March.

Wraps OpenSSL 3 via C builtins to provide TLS client and server functionality over existing TCP file descriptors.

Architecture: TlsCtx — an SSL_CTX (configuration + CA store), long-lived, shareable TlsConn — a single SSL * connection wrapping one TCP fd

Typical client usage: let config = Tls.default_client_config() match Tls.client_ctx(config) do Ok(ctx) -> match tcp_connect("example.com", 443) do Ok(fd) -> match Tls.connect(fd, ctx, "example.com") do Ok(conn) -> Tls.write(conn, "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n") Tls.read(conn, 4096) Tls.close(conn) Err(e) -> Err(e) end Err(e) -> Err(TlsHandshakeFailed(e)) end Err(e) -> Err(e) end

Types

typeTlsVersionTlsVersion = Tls12 | Tls13#
typeTlsErrorTlsError =#
typeTlsConfigTlsConfig =#
typeTlsCtxTlsCtx = TlsCtx(Int)#
typeTlsConnTlsConn = TlsConn(Int)#