package tls

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

TLS module given a flow

Parameters

Signature

module FLOW = F
type error = [
  1. | `Tls_alert of Tls.Packet.alert_type
  2. | `Tls_failure of Tls.Engine.failure
  3. | `Read of F.error
  4. | `Write of F.write_error
]

possible errors: incoming alert, processing failure, or a problem in the underlying flow.

type write_error = [
  1. | `Closed
  2. | error
]

The type for write errors.

type buffer = Cstruct.t
type +'a io = 'a Lwt.t
type tracer = Sexplib.Sexp.t -> unit

we provide the FLOW interface

include Mirage_flow_lwt.S with type 'a io := 'a io and type buffer := buffer and type error := error and type write_error := write_error
val pp_error : error Fmt.t
val pp_write_error : write_error Fmt.t
type flow
val read : flow -> (buffer Mirage_flow.or_eof, error) Stdlib.result io
val write : flow -> buffer -> (unit, write_error) Stdlib.result io
val writev : flow -> buffer list -> (unit, write_error) Stdlib.result io
val close : flow -> unit io
val reneg : ?authenticator:X509.Authenticator.a -> ?acceptable_cas:X509.distinguished_name list -> ?cert:Tls.Config.own_cert -> ?drop:bool -> flow -> (unit, write_error) Result.result Lwt.t

reneg ~authenticator ~acceptable_cas ~cert ~drop t renegotiates the session, and blocks until the renegotiation finished. Optionally, a new authenticator and acceptable_cas can be used. The own certificate can be adjusted by cert. If drop is true (the default), application data received before the renegotiation finished is dropped.

val client_of_flow : ?trace:tracer -> Tls.Config.client -> ?host:string -> FLOW.flow -> (flow, write_error) Result.result Lwt.t

client_of_flow ~trace client ~host flow upgrades the existing connection to TLS using the client configuration, using host as peer name.

val server_of_flow : ?trace:tracer -> Tls.Config.server -> FLOW.flow -> (flow, write_error) Result.result Lwt.t

server_of_flow ?tracer server flow upgrades the flow to a TLS connection using the server configuration.

val epoch : flow -> (Tls.Core.epoch_data, unit) Result.result

epoch flow extracts information of the established session.

OCaml

Innovation. Community. Security.