abla/tls/pure/tls12

Generated from source.

Import with import "abla/tls/pure/tls12".

Source: abla/tls/pure/tls12/entry.ab

TLS12_ECDHE_ECDSA_AES_128_GCM_SHA256 (val)

val TLS12_ECDHE_ECDSA_AES_128_GCM_SHA256

Identifies the TLS 1.2 ECDHE-ECDSA suite with AES-128-GCM and SHA-256.

TLS12_ECDHE_ECDSA_AES_256_GCM_SHA384 (val)

val TLS12_ECDHE_ECDSA_AES_256_GCM_SHA384

Identifies the TLS 1.2 ECDHE-ECDSA suite with AES-256-GCM and SHA-384.

TLS12_ECDHE_RSA_AES_128_GCM_SHA256 (val)

val TLS12_ECDHE_RSA_AES_128_GCM_SHA256

Identifies the TLS 1.2 ECDHE-RSA suite with AES-128-GCM and SHA-256.

TLS12_ECDHE_RSA_AES_256_GCM_SHA384 (val)

val TLS12_ECDHE_RSA_AES_256_GCM_SHA384

Identifies the TLS 1.2 ECDHE-RSA suite with AES-256-GCM and SHA-384.

TLS12_ECDHE_RSA_CHACHA20_POLY1305_SHA256 (val)

val TLS12_ECDHE_RSA_CHACHA20_POLY1305_SHA256

Identifies the TLS 1.2 ECDHE-RSA suite with ChaCha20-Poly1305 and SHA-256.

TLS12_ECDHE_ECDSA_CHACHA20_POLY1305_SHA256 (val)

val TLS12_ECDHE_ECDSA_CHACHA20_POLY1305_SHA256

Identifies the TLS 1.2 ECDHE-ECDSA suite with ChaCha20-Poly1305 and SHA-256.

TLS12_SERVER_KEY_EXCHANGE (val)

val TLS12_SERVER_KEY_EXCHANGE

The 1.2 handshake message types that 1.3 does not have.

TLS12_SERVER_HELLO_DONE (val)

val TLS12_SERVER_HELLO_DONE

Identifies the TLS 1.2 ServerHelloDone handshake message.

TLS12_CLIENT_KEY_EXCHANGE (val)

val TLS12_CLIENT_KEY_EXCHANGE

Identifies the TLS 1.2 ClientKeyExchange handshake message.

TLS_EXT_EC_POINT_FORMATS (val)

val TLS_EXT_EC_POINT_FORMATS

Identifies the extension carrying supported elliptic curve point encodings.

TLS_EXT_EXTENDED_MASTER_SECRET (val)

val TLS_EXT_EXTENDED_MASTER_SECRET

Identifies the TLS extended master secret extension.

TLS_EXT_RENEGOTIATION_INFO (val)

val TLS_EXT_RENEGOTIATION_INFO

Identifies the secure renegotiation extension.

TLS_SIG_RSA_PKCS1_SHA256 (val)

val TLS_SIG_RSA_PKCS1_SHA256

Identifies the RSA PKCS#1 v1.5 signature scheme with SHA-256.

TLS_SIG_RSA_PKCS1_SHA384 (val)

val TLS_SIG_RSA_PKCS1_SHA384

Identifies the RSA PKCS#1 v1.5 signature scheme with SHA-384.

TLS_SIG_RSA_PKCS1_SHA512 (val)

val TLS_SIG_RSA_PKCS1_SHA512

Identifies the RSA PKCS#1 v1.5 signature scheme with SHA-512.

Tls12Suite (class)

class Tls12Suite(val code: int, val aead: int, val hash: int, val keyLength: int, val ivLength: int, val ecdsa: bool)

A TLS 1.2 cipher suite: its AEAD (TLS_AEAD_*), the hash of its PRF and transcript (HKDF_SHA256 / HKDF_SHA384), the key length, the length of the fixed part of the nonce (4 for AES-GCM, 12 for ChaCha20-Poly1305), and whether the server's key is an ECDSA key (else RSA).

tls12Suite (fun)

fun tls12Suite(code: int): Tls12Suite?

Returns the supported TLS 1.2 cipher suite matching a wire code, or null for an unknown code.

tls12Prf (fun)

fun tls12Prf(hash: int, secret: string, label: string, seed: string, length: int): string

PRF(secret, label, seed) = P_hash(secret, label + seed), length bytes.

tls12MasterSecret (fun)

fun tls12MasterSecret(hash: int, premaster: string, sessionHash: string): string

The extended master secret (RFC 7627): PRF(premaster, "extended master secret", session hash), 48 bytes, where the session hash is the hash of the handshake messages through the ClientKeyExchange.

Tls12Keys (class)

class Tls12Keys(val clientKey: string, val serverKey: string, val clientIv: string, val serverIv: string)

The key block's four parts for a suite.

tls12DeriveKeys (fun)

fun tls12DeriveKeys(suite: Tls12Suite, master: string, serverRandom: string, clientRandom: string): Tls12Keys

Returns separate client and server write keys and fixed IVs derived from the master secret and hello randoms.

tls12FinishedData (fun)

fun tls12FinishedData(hash: int, master: string, label: string, messagesHash: string): string

verify_data of a Finished: the first 12 bytes of PRF(master, label, hash of the handshake messages), with the label "client finished" or "server finished".

Tls12Protection (class)

class Tls12Protection(val aead: int, val key: string, val iv: string, var sequence: int)

One direction's protection: the suite's AEAD, the key, the fixed IV part, and the next sequence number.

tls12Protection (fun)

fun tls12Protection(suite: Tls12Suite, key: string, iv: string): Tls12Protection

Returns record protection for one direction with its sequence number set to zero.

TLS12_MAX_SEQUENCE (val)

val TLS12_MAX_SEQUENCE

A sequence number never wraps: past 2^62 records (a TLS 1.2 key cannot be renegotiated here) nothing more is sealed or opened, as in the TLS 1.3 record layer.

TLS12_MAX_PLAINTEXT (val)

val TLS12_MAX_PLAINTEXT

The most plaintext a TLS 1.2 record carries, and the most its payload may be (RFC 5246 section 6.2).

TLS12_MAX_CIPHERTEXT (val)

val TLS12_MAX_CIPHERTEXT

Caps the accepted TLS 1.2 ciphertext record payload length.

tls12Protect (fun)

fun tls12Protect(var protection: Tls12Protection, type: int, content: string): CryptoResult

Protects one record: the whole record (header, then the AEAD payload). AES-GCM puts the 8-byte explicit nonce (the sequence number) in front of the ciphertext; ChaCha20-Poly1305 has none. ok false for content over 2^14.

tls12Open (fun)

fun tls12Open(var protection: Tls12Protection, record: string): TlsOpenedRecord

Opens one whole record (header included) under protection: authenticates (the sequence number and header are part of what is authenticated) and returns the type and content. The sequence only advances on success.

Tls12ServerHello (class)

class Tls12ServerHello(val ok: bool, val error: string, val random: string, val sessionId: string, val suite: int,
    val extendedMasterSecret: bool, val secureRenegotiation: bool, val alpn: string = "",
    /** The type of every extension the hello carried (the client checks them against what it offered). */
    val extensionTypes: array<int> = [])

A TLS 1.2 ServerHello: the suite, the random, the session id, and which of the two extensions the subset needs the server echoed (extended_master_secret, an empty renegotiation_info).

tls12ParseServerHello (fun)

fun tls12ParseServerHello(body: string): Tls12ServerHello

Returns the selected suite and extensions or an error for malformed fields, an unexpected version or compression.

tls12BuildServerHello (fun)

fun tls12BuildServerHello(random: string, sessionId: string, suite: int): string

A ServerHello message for TLS 1.2 (version 3.3, no supported_versions): the echo of the session id, the suite, extended_master_secret, an empty renegotiation_info, and ec_point_formats (uncompressed) if the client sent it.

tls12BuildCertificate (fun)

fun tls12BuildCertificate(chain: array<string>): string

The Certificate message of TLS 1.2: a three-byte-length list of three-byte-length certificates.

tls12ParseCertificate (fun)

fun tls12ParseCertificate(body: string): TlsCertificateMessage

Returns the certificate chain or an error if the TLS 1.2 certificate vectors are malformed.

tls12EcdheParams (fun)

fun tls12EcdheParams(group: int, point: string): string

The ECDHE parameters a ServerKeyExchange carries and its signature covers: a named curve and the public point.

tls12SignedParams (fun)

fun tls12SignedParams(clientRandom: string, serverRandom: string, params: string): string

What a ServerKeyExchange signs: the client random, the server random, the parameters.

tls12BuildServerKeyExchange (fun)

fun tls12BuildServerKeyExchange(group: int, point: string, scheme: int, signature: string): string

Returns a complete ServerKeyExchange handshake message containing the named curve, public point and signature.

Tls12ServerKeyExchange (class)

class Tls12ServerKeyExchange(val ok: bool, val error: string, val group: int, val point: string, val params: string,
    val scheme: int, val signature: string)

Holds the parsed ECDHE parameters and signature, or the parse error.

tls12ParseServerKeyExchange (fun)

fun tls12ParseServerKeyExchange(body: string): Tls12ServerKeyExchange

Returns the signed parameters, named curve and signature or an error if the body is malformed or uses an unsupported curve encoding.

tls12BuildClientKeyExchange (fun)

fun tls12BuildClientKeyExchange(point: string): string

Returns a complete ClientKeyExchange handshake message containing the client's public point.

tls12ParseClientKeyExchange (fun)

fun tls12ParseClientKeyExchange(body: string): string

The point of a ClientKeyExchange body, "" when malformed.

tls12BuildServerHelloDone (fun)

fun tls12BuildServerHelloDone(): string

Returns an empty ServerHelloDone handshake message with its header.

tls12BuildCertificateRequest (fun)

fun tls12BuildCertificateRequest(schemes: array<int>): string

A CertificateRequest of TLS 1.2: the certificate types (ecdsa_sign 64, rsa_sign 1), the signature schemes, no certificate authorities.

tls12ParseCertificateRequest (fun)

fun tls12ParseCertificateRequest(body: string): array<int>

The schemes of a 1.2 CertificateRequest, empty when malformed.

tls12Placeholder (fun)

fun tls12Placeholder(): Tls12Suite

A suite value for a protection that is not in use yet.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.