package tls

  1. Overview
  2. Docs

Core type definitions

type tls_version =
  1. | TLS_1_0
  2. | TLS_1_1
  3. | TLS_1_2
val tls_version_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tls_version
val sexp_of_tls_version : tls_version -> Ppx_sexp_conv_lib.Sexp.t
val pair_of_tls_version : tls_version -> int * int
val tls_version_of_pair : (int * int) -> tls_version option
type tls_any_version =
  1. | SSL_3
  2. | Supported of tls_version
  3. | TLS_1_X of int
val tls_any_version_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tls_any_version
val sexp_of_tls_any_version : tls_any_version -> Ppx_sexp_conv_lib.Sexp.t
val any_version_to_version : tls_any_version -> tls_version option
val version_eq : tls_any_version -> tls_version -> bool
val version_ge : tls_any_version -> tls_version -> bool
val tls_any_version_of_pair : (int * int) -> tls_any_version option
val pair_of_tls_any_version : tls_any_version -> int * int
val max_protocol_version : ('a * 'b) -> 'b
val min_protocol_version : ('a * 'b) -> 'a
type tls_hdr = {
  1. content_type : Packet.content_type;
  2. version : tls_any_version;
}
val tls_hdr_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tls_hdr
val sexp_of_tls_hdr : tls_hdr -> Ppx_sexp_conv_lib.Sexp.t
module SessionID : sig ... end
type client_extension = [
  1. | `Hostname of string
  2. | `MaxFragmentLength of Packet.max_fragment_length
  3. | `EllipticCurves of Packet.named_curve_type list
  4. | `ECPointFormats of Packet.ec_point_format list
  5. | `SecureRenegotiation of Cstruct_sexp.t
  6. | `Padding of int
  7. | `SignatureAlgorithms of (Ciphersuite.H.t * Packet.signature_algorithm_type) list
  8. | `UnknownExtension of int * Cstruct_sexp.t
  9. | `ExtendedMasterSecret
  10. | `ALPN of string list
]
val __client_extension_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> client_extension
val client_extension_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> client_extension
val sexp_of_client_extension : client_extension -> Ppx_sexp_conv_lib.Sexp.t
type server_extension = [
  1. | `Hostname
  2. | `MaxFragmentLength of Packet.max_fragment_length
  3. | `ECPointFormats of Packet.ec_point_format list
  4. | `SecureRenegotiation of Cstruct_sexp.t
  5. | `UnknownExtension of int * Cstruct_sexp.t
  6. | `ExtendedMasterSecret
  7. | `ALPN of string
]
val __server_extension_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> server_extension
val server_extension_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> server_extension
val sexp_of_server_extension : server_extension -> Ppx_sexp_conv_lib.Sexp.t
type client_hello = {
  1. client_version : tls_any_version;
  2. client_random : Cstruct_sexp.t;
  3. sessionid : SessionID.t option;
  4. ciphersuites : Packet.any_ciphersuite list;
  5. extensions : client_extension list;
}
val client_hello_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> client_hello
val sexp_of_client_hello : client_hello -> Ppx_sexp_conv_lib.Sexp.t
type server_hello = {
  1. server_version : tls_version;
  2. server_random : Cstruct_sexp.t;
  3. sessionid : SessionID.t option;
  4. ciphersuite : Ciphersuite.ciphersuite;
  5. extensions : server_extension list;
}
val server_hello_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> server_hello
val sexp_of_server_hello : server_hello -> Ppx_sexp_conv_lib.Sexp.t
type dh_parameters = {
  1. dh_p : Cstruct_sexp.t;
  2. dh_g : Cstruct_sexp.t;
  3. dh_Ys : Cstruct_sexp.t;
}
val dh_parameters_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> dh_parameters
val sexp_of_dh_parameters : dh_parameters -> Ppx_sexp_conv_lib.Sexp.t
type ec_curve = {
  1. a : Cstruct_sexp.t;
  2. b : Cstruct_sexp.t;
}
val ec_curve_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> ec_curve
val sexp_of_ec_curve : ec_curve -> Ppx_sexp_conv_lib.Sexp.t
type ec_prime_parameters = {
  1. prime : Cstruct_sexp.t;
  2. curve : ec_curve;
  3. base : Cstruct_sexp.t;
  4. order : Cstruct_sexp.t;
  5. cofactor : Cstruct_sexp.t;
  6. public : Cstruct_sexp.t;
}
val ec_prime_parameters_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> ec_prime_parameters
val sexp_of_ec_prime_parameters : ec_prime_parameters -> Ppx_sexp_conv_lib.Sexp.t
type ec_char_parameters = {
  1. m : int;
  2. basis : Packet.ec_basis_type;
  3. ks : Cstruct_sexp.t list;
  4. curve : ec_curve;
  5. base : Cstruct_sexp.t;
  6. order : Cstruct_sexp.t;
  7. cofactor : Cstruct_sexp.t;
  8. public : Cstruct_sexp.t;
}
val ec_char_parameters_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> ec_char_parameters
val sexp_of_ec_char_parameters : ec_char_parameters -> Ppx_sexp_conv_lib.Sexp.t
type ec_parameters =
  1. | ExplicitPrimeParameters of ec_prime_parameters
  2. | ExplicitCharParameters of ec_char_parameters
  3. | NamedCurveParameters of Packet.named_curve_type * Cstruct_sexp.t
val ec_parameters_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> ec_parameters
val sexp_of_ec_parameters : ec_parameters -> Ppx_sexp_conv_lib.Sexp.t
type tls_handshake =
  1. | HelloRequest
  2. | ServerHelloDone
  3. | ClientHello of client_hello
  4. | ServerHello of server_hello
  5. | Certificate of Cstruct_sexp.t list
  6. | ServerKeyExchange of Cstruct_sexp.t
  7. | CertificateRequest of Cstruct_sexp.t
  8. | ClientKeyExchange of Cstruct_sexp.t
  9. | CertificateVerify of Cstruct_sexp.t
  10. | Finished of Cstruct_sexp.t
val tls_handshake_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tls_handshake
val sexp_of_tls_handshake : tls_handshake -> Ppx_sexp_conv_lib.Sexp.t
val tls_alert_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tls_alert
val sexp_of_tls_alert : tls_alert -> Ppx_sexp_conv_lib.Sexp.t
type tls_body =
  1. | TLS_ChangeCipherSpec
  2. | TLS_ApplicationData
  3. | TLS_Alert of tls_alert
  4. | TLS_Handshake of tls_handshake
val tls_body_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tls_body
val sexp_of_tls_body : tls_body -> Ppx_sexp_conv_lib.Sexp.t
type master_secret = Cstruct_sexp.t

the master secret of a TLS connection

val master_secret_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> master_secret
val sexp_of_master_secret : master_secret -> Ppx_sexp_conv_lib.Sexp.t
module Cert : sig ... end
type epoch_data = {
  1. protocol_version : tls_version;
  2. ciphersuite : Ciphersuite.ciphersuite;
  3. peer_random : Cstruct_sexp.t;
  4. peer_certificate_chain : Cert.t list;
  5. peer_certificate : Cert.t option;
  6. peer_name : string option;
  7. trust_anchor : Cert.t option;
  8. received_certificates : Cert.t list;
  9. own_random : Cstruct_sexp.t;
  10. own_certificate : Cert.t list;
  11. own_private_key : Mirage_crypto_pk.Rsa.priv option;
  12. own_name : string option;
  13. master_secret : master_secret;
  14. session_id : SessionID.t;
  15. extended_ms : bool;
  16. alpn_protocol : string option;
}

information about an open session

val epoch_data_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> epoch_data
val sexp_of_epoch_data : epoch_data -> Ppx_sexp_conv_lib.Sexp.t
val supports_key_usage : ?not_present:bool -> X509.Certificate.t -> X509.Extension.key_usage -> bool
val supports_extended_key_usage : ?not_present:bool -> X509.Certificate.t -> X509.Extension.extended_key_usage -> bool
OCaml

Innovation. Community. Security.