RFC8446 states that:
the full encoded TLSInnerPlaintext MUST NOT exceed 2^14 + 1 octets
It also states:
length: The length (in bytes) of the following
TLSCiphertext.encrypted_record
, which is the sum of the lengths of the content and the padding, plus one for the inner content type, plus any expansion added by the AEAD algorithm. The length MUST NOT exceed 2^14 + 256 bytes.
This question states the limit simply as 2^14 octets, but that seems to be an oversimplification.
While observing TLS records in Wireshark on my local machine for a particular connection, I noticed that the biggest TLS record sizes never went over 16401 bytes. The observed connection did not use any TLS record length modifying extensions in those largest records.
I went back to reading the RFC to understand how we came to this number in practice, which I wish to run by this community to see if I understand it correctly.
TLSInnerPlaintext MUST NOT exceed 2^14 + 1 octets
Here, the 2^14 seems to refer to the plain text that is about to be encrypted and the "+ 1" is reserved for the byte indicating the real future TLS record type. If I add 16 bytes of AEAD to the 2^14 + 1 length of the plain text, I think I get the maximum length of a TLS record without any extensions. 16384 + 1 + 16 = 16401. Which is the number I am seeing in Wireshark as tls.record.length
in my largest captured records.
length: The length (in bytes) of the following TLSCiphertext.encrypted_record ... MUST NOT exceed 2^14 + 256 bytes.
This seems to indicate that the maximum TLS record (encrypted, which should already include AEAD) is 16640 octets.
Does that mean that if I encounter largest possible TLS record in Wireshark, with all extension space used up, tls.record.length
will never be bigger than 16640 bytes for TLS 1.3 connections?