std.x.tls.record [x] std.x.tls.record.hkdf_label pub fn hkdf_label(length: int, label: str, context: List[byte]) -> List[byte] — The HkdfLabel structure encoded to bytes (§7.1): uint16 length big-endian, then the one-byte-length-prefixed "tls13 " + label, then the one-byte-length-prefixed context. std.x.tls.record.expand_label pub fn expand_label( secret: List[byte], label: str, context: List[byte], length: int, ) -> List[byte] — HKDF-Expand-Label (§7.1): expand secret under the structured HkdfLabel to length bytes. std.x.tls.record.derive_secret pub fn derive_secret(secret: List[byte], label: str, transcript: List[byte]) -> List[byte] — Derive-Secret (§7.1): HKDF-Expand-Label with the transcript hash as context and the digest length (32) as output. std.x.tls.record.extract pub fn extract(salt: List[byte], ikm: List[byte]) -> List[byte] — HKDF-Extract (RFC 5869 §2.2) — the key schedule's extract step, a thin name over sc16's HKDF so a test can build RFC 8448's whole chain through this module alone. std.x.tls.record.traffic_key pub fn traffic_key(secret: List[byte], key_len: int) -> List[byte] — The [sender]_write_key (§7.3): expand the traffic secret under the "key" label to the AEAD's key length (32 for ChaCha20-Poly1305, 16 for AES-128-GCM — the caller states which, since it knows the suite). std.x.tls.record.traffic_iv pub fn traffic_iv(secret: List[byte]) -> List[byte] — The [sender]_write_iv (§7.3): expand the traffic secret under the "iv" label to the 12-byte IV length. std.x.tls.record.finished_key pub fn finished_key(secret: List[byte]) -> List[byte] — The Finished MAC key (§4.4.4): HKDF-Expand-Label(Secret, "finished", "", Hash.length). std.x.tls.record.record_nonce pub fn record_nonce(iv: List[byte], seq: int) -> List[byte] — The per-record nonce (§5.3): iv XOR pad_left(seq, iv_length). std.x.tls.record.content_type_application_data pub fn content_type_application_data() -> int — ContentType application_data (23) — the OUTER opaque_type of every TLSCiphertext (§5.2; the real content type hides inside the encryption). std.x.tls.record.content_type_handshake pub fn content_type_handshake() -> int — ContentType handshake (22) — a common INNER content type (the EncryptedExtensions/Certificate/Finished flight). std.x.tls.record.content_type_alert pub fn content_type_alert() -> int — ContentType alert (21) — an inner content type a record open may have to surface. std.x.tls.record.record_header pub fn record_header(length: int) -> List[byte] — The five-byte TLSCiphertext header for an encrypted record of length bytes: 17 03 03 (§5.2). std.x.tls.record.additional_data pub fn additional_data(cipher_len: int) -> List[byte] — The AEAD additional-data for a record whose ciphertext (including the 16-byte tag) is cipher_len bytes: the record header (§5.2). std.x.tls.record.inner_plaintext pub fn inner_plaintext(content: List[byte], content_type: int, pad: int) -> List[byte] — The TLSInnerPlaintext (§5.2): content || ContentType content_type || zeros[pad]. std.x.tls.record.seal pub fn seal( key: List[byte], iv: List[byte], seq: int, content_type: int, content: List[byte], pad: int, ) -> List[byte] — Seal a record (§5.2): build the TLSInnerPlaintext (content || content_type || pad zeros), AEAD-seal it under the per-record nonce with the record header as additional-data, and frame it as a TLSCiphertext (header || ciphertext || tag). std.x.tls.record.open pub fn open(key: List[byte], iv: List[byte], seq: int, record: List[byte]) -> List[byte] ! { tag, short, unexpected, } — Open a record (§5.2/§5.4): verify the tag BEFORE exposing any plaintext (sc17's discipline — a tag failure returns with ZERO plaintext), then strip the padding by scanning from the end for the content-type octet, and return the deprotected inner plaintext (content || content_type, padding removed). std.x.tls.record.content_type_of pub fn content_type_of(inner: List[byte]) -> int — The inner content type recovered by open: the last octet of the deprotected inner plaintext (§5.4). std.x.tls.record.content_of pub fn content_of(inner: List[byte]) -> List[byte] — The inner content recovered by open: the deprotected inner plaintext with its trailing content-type octet removed (§5.4). std.x.tls.record.to_hex pub fn to_hex(b: List[byte]) -> str — Lowercase hex of a byte list.