package tls

  1. Overview
  2. Docs

Core type definitions

val (<+>) : Cstruct.t -> Cstruct.t -> Cstruct.t
val let* : ('a, 'b) result -> ('a -> ('c, 'b) result) -> ('c, 'b) result
val guard : bool -> 'a -> (unit, 'a) result
val map_reader_error : ('a, 'b) result -> ('a, [> `Fatal of [> `ReaderError of 'b ] ]) result
type tls13 = [
  1. | `TLS_1_3
]
val sexp_of_tls13 : tls13 -> Sexplib0.Sexp.t
type tls_before_13 = [
  1. | `TLS_1_0
  2. | `TLS_1_1
  3. | `TLS_1_2
]
val sexp_of_tls_before_13 : tls_before_13 -> Sexplib0.Sexp.t
type tls_version = [
  1. | tls13
  2. | tls_before_13
]
val sexp_of_tls_version : tls_version -> Sexplib0.Sexp.t
val pair_of_tls_version : [< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] -> int * int
val compare_tls_version : [< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] -> [< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] -> int
val next : [< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] -> [> `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] option
val all_versions : ([< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 TLS_1_1 TLS_1_2 TLS_1_3 ] as 'a * [< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ]) -> 'a list
val tls_version_of_pair : (int * int) -> [> `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] option
type tls_any_version = [
  1. | tls_version
  2. | `SSL_3
  3. | `TLS_1_X of int
]
val sexp_of_tls_any_version : tls_any_version -> Sexplib0.Sexp.t
val any_version_to_version : [> tls_version ] -> [> `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] option
val version_eq : [> tls_version ] -> [< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] -> bool
val version_ge : [< `SSL_3 | `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 | `TLS_1_X of 'a ] -> [< `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 ] -> bool
val tls_any_version_of_pair : (int * int) -> [> `SSL_3 | `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 | `TLS_1_X of int ] option
val pair_of_tls_any_version : [< `SSL_3 | `TLS_1_0 | `TLS_1_1 | `TLS_1_2 | `TLS_1_3 | `TLS_1_X of int ] -> 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 sexp_of_tls_hdr : tls_hdr -> Sexplib0.Sexp.t
module SessionID : sig ... end
module PreSharedKeyID : sig ... end
type psk_identity = (Cstruct_sexp.t * int32) * Cstruct_sexp.t
val sexp_of_psk_identity : psk_identity -> Sexplib0.Sexp.t
val binders_len : ('a * Cstruct.t) list -> int
type group = [
  1. | `FFDHE2048
  2. | `FFDHE3072
  3. | `FFDHE4096
  4. | `FFDHE6144
  5. | `FFDHE8192
  6. | `X25519
  7. | `P256
  8. | `P384
  9. | `P521
]
val sexp_of_group : group -> Sexplib0.Sexp.t
val named_group_to_group : Packet.named_group -> [> `FFDHE2048 | `FFDHE3072 | `FFDHE4096 | `FFDHE6144 | `FFDHE8192 | `P256 | `P384 | `P521 | `X25519 ] option
val group_to_named_group : [< `FFDHE2048 | `FFDHE3072 | `FFDHE4096 | `FFDHE6144 | `FFDHE8192 | `P256 | `P384 | `P521 | `X25519 ] -> Packet.named_group
val group_to_impl : [< `FFDHE2048 | `FFDHE3072 | `FFDHE4096 | `FFDHE6144 | `FFDHE8192 | `P256 | `P384 | `P521 | `X25519 ] -> [> `Finite_field of Mirage_crypto_pk.Dh.group | `P256 | `P384 | `P521 | `X25519 ]
type signature_algorithm = [
  1. | `RSA_PKCS1_MD5
  2. | `RSA_PKCS1_SHA1
  3. | `RSA_PKCS1_SHA224
  4. | `RSA_PKCS1_SHA256
  5. | `RSA_PKCS1_SHA384
  6. | `RSA_PKCS1_SHA512
  7. | `ECDSA_SECP256R1_SHA1
  8. | `ECDSA_SECP256R1_SHA256
  9. | `ECDSA_SECP384R1_SHA384
  10. | `ECDSA_SECP521R1_SHA512
  11. | `RSA_PSS_RSAENC_SHA256
  12. | `RSA_PSS_RSAENC_SHA384
  13. | `RSA_PSS_RSAENC_SHA512
  14. | `ED25519
]
val sexp_of_signature_algorithm : signature_algorithm -> Sexplib0.Sexp.t
val hash_of_signature_algorithm : [< `ECDSA_SECP256R1_SHA1 | `ECDSA_SECP256R1_SHA256 | `ECDSA_SECP384R1_SHA384 | `ECDSA_SECP521R1_SHA512 | `ED25519 | `RSA_PKCS1_MD5 | `RSA_PKCS1_SHA1 | `RSA_PKCS1_SHA224 | `RSA_PKCS1_SHA256 | `RSA_PKCS1_SHA384 | `RSA_PKCS1_SHA512 | `RSA_PSS_RSAENC_SHA256 | `RSA_PSS_RSAENC_SHA384 | `RSA_PSS_RSAENC_SHA512 ] -> [> `MD5 | `SHA1 | `SHA224 | `SHA256 | `SHA384 | `SHA512 ]
val signature_scheme_of_signature_algorithm : [< `ECDSA_SECP256R1_SHA1 | `ECDSA_SECP256R1_SHA256 | `ECDSA_SECP384R1_SHA384 | `ECDSA_SECP521R1_SHA512 | `ED25519 | `RSA_PKCS1_MD5 | `RSA_PKCS1_SHA1 | `RSA_PKCS1_SHA224 | `RSA_PKCS1_SHA256 | `RSA_PKCS1_SHA384 | `RSA_PKCS1_SHA512 | `RSA_PSS_RSAENC_SHA256 | `RSA_PSS_RSAENC_SHA384 | `RSA_PSS_RSAENC_SHA512 ] -> [> `ECDSA | `ED25519 | `RSA_PKCS1 | `RSA_PSS ]
val rsa_sigalg : [< `ECDSA_SECP256R1_SHA1 | `ECDSA_SECP256R1_SHA256 | `ECDSA_SECP384R1_SHA384 | `ECDSA_SECP521R1_SHA512 | `ED25519 | `RSA_PKCS1_MD5 | `RSA_PKCS1_SHA1 | `RSA_PKCS1_SHA224 | `RSA_PKCS1_SHA256 | `RSA_PKCS1_SHA384 | `RSA_PKCS1_SHA512 | `RSA_PSS_RSAENC_SHA256 | `RSA_PSS_RSAENC_SHA384 | `RSA_PSS_RSAENC_SHA512 ] -> bool
val tls13_sigalg : [< `ECDSA_SECP256R1_SHA1 | `ECDSA_SECP256R1_SHA256 | `ECDSA_SECP384R1_SHA384 | `ECDSA_SECP521R1_SHA512 | `ED25519 | `RSA_PKCS1_MD5 | `RSA_PKCS1_SHA1 | `RSA_PKCS1_SHA224 | `RSA_PKCS1_SHA256 | `RSA_PKCS1_SHA384 | `RSA_PKCS1_SHA512 | `RSA_PSS_RSAENC_SHA256 | `RSA_PSS_RSAENC_SHA384 | `RSA_PSS_RSAENC_SHA512 ] -> bool
val pk_matches_sa : [> `ED25519 of 'a | `P256 of 'b | `P384 of 'c | `P521 of 'd | `RSA of 'e ] -> [< `ECDSA_SECP256R1_SHA1 | `ECDSA_SECP256R1_SHA256 | `ECDSA_SECP384R1_SHA384 | `ECDSA_SECP521R1_SHA512 | `ED25519 | `RSA_PKCS1_MD5 | `RSA_PKCS1_SHA1 | `RSA_PKCS1_SHA224 | `RSA_PKCS1_SHA256 | `RSA_PKCS1_SHA384 | `RSA_PKCS1_SHA512 | `RSA_PSS_RSAENC_SHA256 | `RSA_PSS_RSAENC_SHA384 | `RSA_PSS_RSAENC_SHA512 ECDSA_SECP256R1_SHA1 ECDSA_SECP256R1_SHA256 ECDSA_SECP384R1_SHA384 ECDSA_SECP521R1_SHA512 ED25519 ] -> bool
module Peer_name : sig ... end
type client_extension = [
  1. | `Hostname of Peer_name.t
  2. | `MaxFragmentLength of Packet.max_fragment_length
  3. | `SupportedGroups of Packet.named_group list
  4. | `SecureRenegotiation of Cstruct_sexp.t
  5. | `Padding of int
  6. | `SignatureAlgorithms of signature_algorithm list
  7. | `ExtendedMasterSecret
  8. | `ALPN of string list
  9. | `KeyShare of (Packet.named_group * Cstruct_sexp.t) list
  10. | `EarlyDataIndication
  11. | `PreSharedKeys of psk_identity list
  12. | `SupportedVersions of tls_any_version list
  13. | `PostHandshakeAuthentication
  14. | `Cookie of Cstruct_sexp.t
  15. | `PskKeyExchangeModes of Packet.psk_key_exchange_mode list
  16. | `ECPointFormats
  17. | `UnknownExtension of int * Cstruct_sexp.t
]
val sexp_of_client_extension : client_extension -> Sexplib0.Sexp.t
type server13_extension = [
  1. | `KeyShare of group * Cstruct_sexp.t
  2. | `PreSharedKey of int
  3. | `SelectedVersion of tls_version
]
val sexp_of_server13_extension : server13_extension -> Sexplib0.Sexp.t
type server_extension = [
  1. | server13_extension
  2. | `Hostname
  3. | `MaxFragmentLength of Packet.max_fragment_length
  4. | `SecureRenegotiation of Cstruct_sexp.t
  5. | `ExtendedMasterSecret
  6. | `ALPN of string
  7. | `ECPointFormats
  8. | `UnknownExtension of int * Cstruct_sexp.t
]
val sexp_of_server_extension : server_extension -> Sexplib0.Sexp.t
type encrypted_extension = [
  1. | `Hostname
  2. | `MaxFragmentLength of Packet.max_fragment_length
  3. | `SupportedGroups of group list
  4. | `ALPN of string
  5. | `EarlyDataIndication
  6. | `UnknownExtension of int * Cstruct_sexp.t
]
val sexp_of_encrypted_extension : encrypted_extension -> Sexplib0.Sexp.t
type hello_retry_extension = [
  1. | `SelectedGroup of group
  2. | `Cookie of Cstruct_sexp.t
  3. | `SelectedVersion of tls_version
  4. | `UnknownExtension of int * Cstruct_sexp.t
]
val sexp_of_hello_retry_extension : hello_retry_extension -> Sexplib0.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 sexp_of_client_hello : client_hello -> Sexplib0.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 sexp_of_server_hello : server_hello -> Sexplib0.Sexp.t
type dh_parameters = {
  1. dh_p : Cstruct_sexp.t;
  2. dh_g : Cstruct_sexp.t;
  3. dh_Ys : Cstruct_sexp.t;
}
val sexp_of_dh_parameters : dh_parameters -> Sexplib0.Sexp.t
type hello_retry = {
  1. retry_version : tls_version;
  2. ciphersuite : Ciphersuite.ciphersuite13;
  3. sessionid : SessionID.t option;
  4. selected_group : group;
  5. extensions : hello_retry_extension list;
}
val sexp_of_hello_retry : hello_retry -> Sexplib0.Sexp.t
type session_ticket_extension = [
  1. | `EarlyDataIndication of int32
  2. | `UnknownExtension of int * Cstruct_sexp.t
]
val sexp_of_session_ticket_extension : session_ticket_extension -> Sexplib0.Sexp.t
type session_ticket = {
  1. lifetime : int32;
  2. age_add : int32;
  3. nonce : Cstruct_sexp.t;
  4. ticket : Cstruct_sexp.t;
  5. extensions : session_ticket_extension list;
}
val sexp_of_session_ticket : session_ticket -> Sexplib0.Sexp.t
type certificate_request_extension = [
  1. | `SignatureAlgorithms of signature_algorithm list
  2. | `CertificateAuthorities of X509.Distinguished_name.t list
  3. | `UnknownExtension of int * Cstruct_sexp.t
]
type tls_handshake =
  1. | HelloRequest
  2. | HelloRetryRequest of hello_retry
  3. | EncryptedExtensions of encrypted_extension list
  4. | ServerHelloDone
  5. | ClientHello of client_hello
  6. | ServerHello of server_hello
  7. | Certificate of Cstruct_sexp.t
  8. | ServerKeyExchange of Cstruct_sexp.t
  9. | CertificateRequest of Cstruct_sexp.t
  10. | ClientKeyExchange of Cstruct_sexp.t
  11. | CertificateVerify of Cstruct_sexp.t
  12. | Finished of Cstruct_sexp.t
  13. | SessionTicket of session_ticket
  14. | KeyUpdate of Packet.key_update_request_type
  15. | EndOfEarlyData
val sexp_of_tls_handshake : tls_handshake -> Sexplib0.Sexp.t
val sexp_of_tls_alert : tls_alert -> Sexplib0.Sexp.t
type master_secret = Cstruct_sexp.t

the master secret of a TLS connection

val sexp_of_master_secret : master_secret -> Sexplib0.Sexp.t
module Cert : sig ... end
module Priv : sig ... end
module Ptime : sig ... end
type psk13 = {
  1. identifier : Cstruct_sexp.t;
  2. obfuscation : int32;
  3. secret : Cstruct_sexp.t;
  4. lifetime : int32;
  5. early_data : int32;
  6. issued_at : Ptime.t;
}
val sexp_of_psk13 : psk13 -> Sexplib0.Sexp.t
type epoch_state = [
  1. | `ZeroRTT
  2. | `Established
]
val sexp_of_epoch_state : epoch_state -> Sexplib0.Sexp.t
type epoch_data = {
  1. state : epoch_state;
  2. protocol_version : tls_version;
  3. ciphersuite : Ciphersuite.ciphersuite;
  4. peer_random : Cstruct_sexp.t;
  5. peer_certificate_chain : Cert.t list;
  6. peer_certificate : Cert.t option;
  7. peer_name : Peer_name.t option;
  8. trust_anchor : Cert.t option;
  9. received_certificates : Cert.t list;
  10. own_random : Cstruct_sexp.t;
  11. own_certificate : Cert.t list;
  12. own_private_key : Priv.t option;
  13. own_name : Peer_name.t option;
  14. master_secret : master_secret;
  15. session_id : SessionID.t;
  16. extended_ms : bool;
  17. alpn_protocol : string option;
}

information about an open session

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

Innovation. Community. Security.