Idris2Doc : Network.TLS.Core

Network.TLS.Core

(source)

Definitions

tls13_supported_cipher_suites : List1CipherSuite
  All the implemented TLS 1.3 cipher suites

Visibility: public export
tls12_supported_cipher_suites : List1CipherSuite
  All the implemented TLS 1.2 cipher suites

Visibility: public export
supported_groups : List1SupportedGroup
  All the implemented groups for key exchange

Visibility: public export
supported_signature_algorithms : List1SignatureAlgorithm
  All the implemented signature algorithms for handshake verification

Visibility: public export
sig_alg_get_params : SignatureAlgorithm->SignatureParameter
Visibility: export
get_server_version : ServerHello->TLSVersion
  Get the server's TLS version from the ServerHello record
Since TLS 1.3 records are masqueraded as TLS 1.2 records
Using (.version) directly may not yield the current result
This function checks for the SupportedVersions extension
If there is one, the version specified in the extension will
be used, otherwise, returns the specified version in the main body

Visibility: public export
get_server_handshake_key : ServerHello->EitherString (SupportedGroup, ListBits8)
  Get the server's handshake public key for key exchange

Visibility: public export
CertificateCheck : (Type->Type) ->Type
  A type alias for a function that will be used to verify handshake
It takes a Certificate record extension, containing all the certificates
as raw bytes, along with the certificate extensions fields, and returns a
public key that will be used to verify the current handshake hash digest

Visibility: public export
recordTLSInitialState : Type
  The initial TLS state, before any communication with the server is made

Totality: total
Visibility: public export
Constructor: 
MkTLSInitialState : String->Vect32Bits8->ListBits8->List1CipherSuite->List1SignatureAlgorithm->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg)) ->TLSInitialState

Projections:
.cipher_suites : TLSInitialState->List1CipherSuite
.client_random : TLSInitialState->Vect32Bits8
.dh_keys : TLSInitialState->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg))
.server_hostname : TLSInitialState->String
.session_id : TLSInitialState->ListBits8
.signature_algos : TLSInitialState->List1SignatureAlgorithm
.server_hostname : TLSInitialState->String
Visibility: public export
server_hostname : TLSInitialState->String
Visibility: public export
.client_random : TLSInitialState->Vect32Bits8
Visibility: public export
client_random : TLSInitialState->Vect32Bits8
Visibility: public export
.session_id : TLSInitialState->ListBits8
Visibility: public export
session_id : TLSInitialState->ListBits8
Visibility: public export
.cipher_suites : TLSInitialState->List1CipherSuite
Visibility: public export
cipher_suites : TLSInitialState->List1CipherSuite
Visibility: public export
.signature_algos : TLSInitialState->List1SignatureAlgorithm
Visibility: public export
signature_algos : TLSInitialState->List1SignatureAlgorithm
Visibility: public export
.dh_keys : TLSInitialState->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg))
Visibility: public export
dh_keys : TLSInitialState->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg))
Visibility: public export
recordTLSClientHelloState : Type
  The TLS state after sending client hello to the server

Totality: total
Visibility: export
Constructor: 
MkTLSClientHelloState : ListBits8->Vect32Bits8->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg)) ->TLSClientHelloState

Projections:
.b_client_hello : TLSClientHelloState->ListBits8
.client_random : TLSClientHelloState->Vect32Bits8
.dh_keys : TLSClientHelloState->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg))
dataTLS3ServerHelloVerificationState : Type
  ADT to represent the state of certificate verification in TLS 1.3 handshake

Totality: total
Visibility: export
Constructors:
NotVerified : TLS3ServerHelloVerificationState
HasCertificate : Certificate->TLS3ServerHelloVerificationState
Verified : TLS3ServerHelloVerificationState
dataTLS3ServerHelloState : (aead : Type) ->AEADaead-> (algo : Type) ->Hashalgo->Type
  The TLS state after receiving server hello from a TLS 1.3 server

Totality: total
Visibility: export
Constructor: 
MkTLS3ServerHelloState : TLS3ServerHelloVerificationState-> (a' : AEADa) -> (h' : Hashh) ->h->HandshakeKeysfixed_iv_lengthenc_key_length->Nat->TLS3ServerHelloStateaa'hh'
dataTLS3ApplicationState : (aead : Type) ->AEADaead->Type
  The TLS state when communication over TLS 1.3 is ready

Totality: total
Visibility: export
Constructor: 
MkTLS3ApplicationState : (a' : AEADa) ->ApplicationKeysfixed_iv_lengthenc_key_length->Nat->Nat->TLS3ApplicationStateaa'
recordTLS2ServerHelloState : Type->Type
  The TLS state after receiving server hello from a TLS 1.2 server

Totality: total
Visibility: export
Constructor: 
MkTLS2ServerHelloState : Vect32Bits8->Vect32Bits8->CipherSuite->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg)) ->Hashalgo->algo->TLS2ServerHelloStatealgo

Projections:
.cipher_suite : TLS2ServerHelloStatealgo->CipherSuite
.client_random : TLS2ServerHelloStatealgo->Vect32Bits8
.dh_keys : TLS2ServerHelloStatealgo->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg))
.digest_state : TLS2ServerHelloStatealgo->algo
.digest_wit : TLS2ServerHelloStatealgo->Hashalgo
.server_random : TLS2ServerHelloStatealgo->Vect32Bits8
recordTLS2ServerCertificateState : Type->Type
  The TLS state after receiving server certificate from a TLS 1.2 server

Totality: total
Visibility: export
Constructor: 
MkTLS2ServerCertificateState : TLS2ServerHelloStatealgo->Certificate->CipherSuite->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg)) ->Hashalgo->algo->TLS2ServerCertificateStatealgo

Projections:
.certificate : TLS2ServerCertificateStatealgo->Certificate
.cipher_suite : TLS2ServerCertificateStatealgo->CipherSuite
.dh_keys : TLS2ServerCertificateStatealgo->List1 (g : SupportedGroup** (curve_group_to_scalar_typeg, curve_group_to_element_typeg))
.digest_state : TLS2ServerCertificateStatealgo->algo
.digest_wit : TLS2ServerCertificateStatealgo->Hashalgo
.server_hello : TLS2ServerCertificateStatealgo->TLS2ServerHelloStatealgo
dataTLS2ServerKEXState : (aead : Type) ->AEADaead-> (algo : Type) ->Hashalgo->Type
  The TLS state after receiving server key exchange from a TLS 1.2 server

Totality: total
Visibility: export
Constructor: 
MkTLS2ServerKEXState : (a' : AEADa) -> (h' : Hashh) ->h->Nat->ListBits8->Application2Keysfixed_iv_lengthenc_key_lengthmac_key_length->TLS2ServerKEXStateaa'hh'
recordTLS2ServerKEXDoneState : (a : Type) ->AEADa-> (c : Type) ->Hashc->Type
  The TLS state after receiving server key exchange done from a TLS 1.2 server

Totality: total
Visibility: export
Constructor: 
MkTLS2ServerKEXDoneState : TLS2ServerKEXStateabcd->TLS2ServerKEXDoneStateabcd

Projection: 
.kex_state : TLS2ServerKEXDoneStateabcd->TLS2ServerKEXStateabcd
recordTLS2AppReadyState : (a : Type) ->AEADa-> (c : Type) ->Hashc->Type
  The TLS state after receiving change cipher spec done from a TLS 1.2 server
This indicates the server will now begin communicating over an encrypted channel,
and that the server is ready to receive application data from the client

Totality: total
Visibility: export
Constructor: 
MkTLS2AppReadyState : TLS2ServerKEXStateabcd->TLS2AppReadyStateabcd

Projection: 
.kex_state : TLS2AppReadyStateabcd->TLS2ServerKEXStateabcd
dataTLS2ApplicationState : (aead : Type) ->AEADaead->Type
  The TLS state when communication over TLS 1.2 is ready

Totality: total
Visibility: export
Constructor: 
MkTLS2ApplicationState : (a' : AEADa) ->Application2Keysfixed_iv_lengthenc_key_lengthmac_key_length->Nat->Nat->TLS2ApplicationStateaa'
dataTLSStep : Type
Totality: total
Visibility: public export
Constructors:
Init : TLSStep
ClientHello : TLSStep
ServerHello2 : TLSStep
ServerHello3 : TLSStep
Application3 : TLSStep
ServerCert2 : TLSStep
ServerKEX2 : TLSStep
ServerKEXDone2 : TLSStep
AppReady2 : TLSStep
Application2 : TLSStep
dataTLSState : TLSStep->Type
Totality: total
Visibility: public export
Constructors:
TLS_Init : TLSInitialState->TLSStateInit
TLS_ClientHello : TLSClientHelloState->TLSStateClientHello
TLS3_ServerHello : TLS3ServerHelloStateabalgod->TLSStateServerHello3
TLS3_Application : TLS3ApplicationStateab->TLSStateApplication3
TLS2_ServerHello : TLS2ServerHelloStatealgo->TLSStateServerHello2
TLS2_ServerCertificate : TLS2ServerCertificateStatealgo->TLSStateServerCert2
TLS2_ServerKEX : TLS2ServerKEXStateabalgod->TLSStateServerKEX2
TLS2_ServerKEXDone : TLS2ServerKEXDoneStateabalgod->TLSStateServerKEXDone2
TLS2_AppReady : TLS2AppReadyStateabalgod->TLSStateAppReady2
TLS2_Application : TLS2ApplicationStateab->TLSStateApplication2
tls_init_to_clienthello : TLSStateInit-> (ListBits8, TLSStateClientHello)
  Transition from TLS Init state to TLS Client Hello state,
and returning the payload that should be sent to the server

Visibility: public export
tls_clienthello_to_serverhello : TLSStateClientHello->ListBits8->EitherString (Either (TLSStateServerHello2) (TLSStateServerHello3))
  Transition from TLS Client Hello to TLS Server Hello state after receiving Server Hello,
return the new state depending on the server's TLS version

Visibility: public export
tls3_serverhello_to_application : Monadm=>TLSStateServerHello3->ListBits8->CertificateCheckm->m (EitherString (Either (TLSStateServerHello3) (ListBits8, TLSStateApplication3)))
  Transition from TLS Server Hello to TLS communication ready state after receiving server's handshake data
note that the encrypted records containing the handshake records can be sent seperately as different records,
or a bunch of handshake records can be concatenated into one encrypted record

Visibility: public export
decrypt_from_record : TLSStateApplication3->ListBits8->EitherString (TLSStateApplication3, ListBits8)
  Decrypt an application wrapper from the server, and updates the TLS state

Visibility: public export
encrypt_to_record : TLSStateApplication3->ListBits8-> (TLSStateApplication3, ListBits8)
  Encrypt an application data wrapper to the server, and updates the TLS state

Visibility: public export
serverhello2_to_servercert : TLSStateServerHello2->ListBits8->EitherString (TLSStateServerCert2)
  Transition from TLS Server Hello to TLS Certificate state after receiving server's certificate

Visibility: public export
servercert_to_serverkex : Monadm=>TLSStateServerCert2->ListBits8->CertificateCheckm->m (EitherString (TLSStateServerKEX2))
  Transition from TLS Server Hello to TLS Certificate state after receiving server's public key for key exchange
This also contains a signature of the public key signed by the server's certificate
The handshake verification step will be done here

Visibility: public export
serverkex_process_serverhellodone : TLSStateServerKEX2->ListBits8->EitherString (TLSStateServerKEXDone2, ListBits8)
  Transition from TLS Key Exchange to TLS Hello Done state after receiving server hello done
Also returns a payload to be sent to the server

Visibility: public export
serverhellodone_to_applicationready2 : TLSStateServerKEXDone2->ListBits8->EitherString (TLSStateAppReady2)
  Transition from TLS Hello Done to TLS server application ready state after receiving change cipher spec

Visibility: public export
applicationready2_to_application2 : TLSStateAppReady2->ListBits8->EitherString (TLSStateApplication2)
  Transition from TLS server application ready state to TLS communication ready state after receiving handshake finished from server

Visibility: public export
encrypt_to_record2 : TLSStateApplication2->ListBits8-> (TLSStateApplication2, ListBits8)
  Encrypt data into TLS payload to be sent to the server

Visibility: public export
decrypt_from_record2 : TLSStateApplication2->ListBits8->EitherString (TLSStateApplication2, ListBits8)
  Decrypt TLS payload into data from the server

Visibility: public export