0Pricing
Cryptology Academy · Lesson

TLS Record Layer & Cipher Suites

Understand record fragmentation, AEAD encryption, and cipher selection.

TLS Record Layer & Cipher Suites is a free Cryptology Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Record Layer Overview

The TLS Record Layer is the transport sublayer of TLS. It fragments data into records of up to 16 KB, optionally compresses (TLS 1.2 only), encrypts with AEAD, and adds a 5-byte header.

Record Header Fields

Bytes 0: ContentType (20=ChangeCipherSpec, 21=Alert, 22=Handshake, 23=ApplicationData). Bytes 1-2: Legacy version (0x0303 for TLS 1.2 compat). Bytes 3-4: Length of the following payload.

AEAD Encryption in Records

In TLS 1.3, each record is encrypted with AEAD (e.g., AES-GCM). The nonce is derived by XORing the implicit sequence number with the traffic IV. The AAD is the 5-byte record header. Authentication tag is appended.

Cipher Suite Naming

TLS_AES_128_GCM_SHA256 = key exchange (implicit ECDHE in TLS 1.3) + AES-128-GCM (AEAD) + SHA-256 (for HKDF). In TLS 1.2: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 names all components explicitly.

Deprecated Cipher Suites

TLS 1.3 bans: RC4 (biased keystream), 3DES (meet-in-middle, Sweet32), CBC mode (BEAST, Lucky13, POODLE), NULL encryption, export-grade (40-bit) ciphers, MD5/SHA-1 in PRF. Only AEAD suites remain.

Record Fragmentation

Large TLS records are split into ≤16 KB fragments. Each fragment is independently encrypted. The receiver reassembles records before passing to the application layer. Fragmentation boundaries carry no semantic meaning.

Alert Protocol

Alerts are sent as TLS records with ContentType=21. Two bytes: level (1=warning, 2=fatal) + description (0=close_notify, 40=handshake_failure, 42=bad_certificate, 70=protocol_version). Fatal alerts terminate the connection.

Sequence Number Nonce

The per-record sequence number starts at 0 and increments by 1. It is padded to the IV length (12 bytes for GCM) and XORed with the traffic IV. This prevents nonce reuse across records without explicit nonce transmission.

Choosing a Cipher Suite

Prefer TLS_AES_256_GCM_SHA384 for 256-bit security. Use TLS_CHACHA20_POLY1305_SHA256 for mobile/embedded devices without AES-NI. Avoid 128-bit suites for highly sensitive long-lived data.

DTLS: TLS over UDP

DTLS (RFC 6347) adapts TLS for UDP. It adds sequence numbers in record headers, handles reordering, and uses a cookie-based handshake to prevent DoS. Used in WebRTC, VPNs, and IoT protocols.

Inspecting Records with Python

Use the ssl module or scapy to capture TLS records. With SSLKEYLOGFILE set, Wireshark decrypts records automatically. Python's ssl.SSLSocket.read() decrypts transparently at the application layer.

Quick Check

What does the sequence number protect against in TLS 1.3 record encryption?

Recap

You understand TLS record structure, AEAD encryption, nonce derivation, and cipher suite selection. Next: how TLS validates server certificates during the handshake.

Frequently asked questions

Is the “TLS Record Layer & Cipher Suites” lesson free?

Yes — the full text of “TLS Record Layer & Cipher Suites” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “TLS Record Layer & Cipher Suites”?

Understand record fragmentation, AEAD encryption, and cipher selection. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “TLS Record Layer & Cipher Suites” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. TLS 1.3 Handshake Step by Step
  2. TLS Record Layer & Cipher Suites
  3. Certificate Validation in TLS
  4. TLS Attacks: BEAST, POODLE & Downgrade
← Back to Cryptology Academy