RFC 8879
TLS Certificate Compression
RFC 8879: TLS Certificate Compression π
Okay bestie, let's get into RFC 8879 β¨ It's TLS Certificate Compression by A. Ghedini (Cloudflare, Inc.) and V. Vasiliev (Google), published in December 2020 as a Standards Track document. It's in the IETF stream with ISSN 2070-1721. The header doesn't list anything it obsoletes or updates, so it's a standalone spec π
Abstract π
So in TLS handshakes, certificate chains are usually the biggest chunk of bytes getting sent, lowkey wild π This doc explains how you can compress those chains so less data gets transmitted and you can skip some round trips. Compression glow-up π
Status of This Memo β¨
This is an Internet Standards Track document π¦
It's a product of the Internet Engineering Task Force (IETF), so it represents the consensus of the IETF community. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG). If you want more on Internet Standards, check Section 2 of RFC 7841. For the current status, errata, and where to send feedback, go to https://www.rfc-editor.org/info/rfc8879 π
Copyright Notice π
Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved π«Ά
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as they were in effect on the date of publication. Please read those carefully, because they spell out your rights and restrictions for this document. Code Components pulled out of this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty, as the Simplified BSD License describes π
Table of Contents π§
1. Introduction
2. Notational Conventions
3. Negotiating Certificate Compression
4. Compressed Certificate Message
5. Security Considerations
6. Middlebox Compatibility
7. IANA Considerations
7.1. TLS ExtensionType Values
7.2. TLS HandshakeType
7.3. Compression Algorithms
8. References
8.1. Normative References
8.2. Informative References
Acknowledgements
Authors' Addresses
1. Introduction β¨
Okay so to cut latency and make things faster, it helps to shrink how much data gets swapped during a TLS handshake πββοΈπ¨
[RFC7924] covers a mechanism where a client and server skip resending certificates they already shared in an earlier handshake. Cute, but it doesn't help when you connect to a server for the very first time and have no clue what its certificate chain looks like π
So this document describes a mechanism that lets certificates get compressed in every handshake, not just the repeat ones. Main character energy π
2. Notational Conventions πΈ
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this doc mean what BCP 14 [RFC2119] [RFC8174] says they mean, but only when they show up in all capitals, just like here π
3. Negotiating Certificate Compression π
Quick heads up: this extension only works with TLS 1.3 [RFC8446] and newer. If TLS 1.2 [RFC5246] or older is what gets negotiated, the peers MUST ignore this extension. Not me ignoring it π ββοΈ
This document defines a new extension type, compress_certificate(27), which signals the compression formats a peer supports for the Certificate message. When a client sends it as a ClientHello message extension ([RFC8446], Section 4.1.2), that means it supports compressed server certificates. When a server sends it as a CertificateRequest extension ([RFC8446], Section 4.3.2), that means it supports compressed client certificates β¨
When you send a compress_certificate extension, you're telling the peer which certificate-compression algorithms you're willing to use for decompression. The "extension_data" field of this extension SHALL contain a CertificateCompressionAlgorithms value, and it looks like this:
enum {
zlib(1),
brotli(2),
zstd(3),
(65535)
} CertificateCompressionAlgorithm;
struct {
CertificateCompressionAlgorithm algorithms<2..2^8-2>;
} CertificateCompressionAlgorithms;
The compress_certificate extension is a one-way vibe. It's unidirectional, so no matching response extension is needed π«Ά
4. Compressed Certificate Message π¦
If the peer has said it supports compression, the server and the client MAY compress their corresponding Certificate messages (Section 4.4.2 of [RFC8446]). Then they send the result as a CompressedCertificate message, which replaces the Certificate message π
The CompressedCertificate message is built like this:
struct {
CertificateCompressionAlgorithm algorithm;
uint24 uncompressed_length;
opaque compressed_certificate_message<1..2^24-1>;
} CompressedCertificate;
Here's what each field does:
algorithm: the algorithm used to compress the certificate. It MUST be one of the algorithms listed in the peer'scompress_certificateextension.uncompressed_length: the length of the Certificate message once it's uncompressed. If the specified length doesn't match the actual length after decompression, the party receiving the invalid message MUST abort the connection with the"bad_certificate"alert. This field is the secret sauce that lets the receiver preallocate the buffer for the uncompressed Certificate message and enforce limits on the message size before it starts decompressing π§compressed_certificate_message: the result of applying the indicated compression algorithm to the encoded Certificate message that would have been sent if certificate compression wasn't in use. The compression algorithm defines how the bytes in this field get converted back into the Certificate message π
Now the algorithm-specific rules, which are a whole vibe π
- If the algorithm is zlib, the Certificate message MUST be compressed with the ZLIB compression algorithm, as defined in [RFC1950].
- If the algorithm is brotli, the Certificate message MUST be compressed with the Brotli compression algorithm, as defined in [RFC7932].
- If the algorithm is zstd, the Certificate message MUST be compressed with the Zstandard compression algorithm, as defined in [RFC8478].
It's possible to define a certificate compression algorithm that uses a preshared dictionary to get a higher compression ratio. This document doesn't define any of those, but extra codepoints can be allocated for them under the policy in Section 7.3 π
If the received CompressedCertificate message can't be decompressed, the connection MUST be terminated with the "bad_certificate" alert π«
Last bit for this section: if the format of the Certificate message gets altered using the server_certificate_type or client_certificate_type extensions [RFC7250], then the altered message is what gets compressed instead π
Part 1 wraps up here. Part 2 picks up at Section 5 (Security Considerations) and keeps the glow going ππ
7.3. Compression Algorithms β¨
okay so this section sets up a brand new registry ποΈ called "TLS Certificate Compression Algorithm IDs", and it lives inside the existing "Transport Layer Security (TLS) Extensions" registry. the whole point is to keep track of which compression algorithms can squish the Certificate message π€π
here's the lineup:
+==================+===============================+===========+
| Algorithm Number | Description | Reference |
+==================+===============================+===========+
| 0 | Reserved | RFC 8879 |
+------------------+-------------------------------+-----------+
| 1 | zlib | RFC 8879 |
+------------------+-------------------------------+-----------+
| 2 | brotli | RFC 8879 |
+------------------+-------------------------------+-----------+
| 3 | zstd | RFC 8879 |
+------------------+-------------------------------+-----------+
| 16384 to 65535 | Reserved for Experimental Use | |
+------------------+-------------------------------+-----------+
Table 1: TLS Certificate Compression Algorithm IDs π
ngl the way the ID ranges are split up is so organized it's giving librarian energy ππ§ new values under 256 get handed out through IETF Review π, values from 256 up to 16383 need Specification Required π, and anything above that is for Experimental Use π§ͺ. and the experimental stuff? totally fair game for both private networks and the open Internet ππ«Ά
if you want the nitty gritty on how those policies actually work, you can check out [RFC8126] π and the procedures for asking for values in the Specification Required space are in Section 17 of [RFC8447] π¦
8. References π
8.1. Normative References π
- [RFC1950] Deutsch, P. and J-L. Gailly, "ZLIB Compressed Data Format Specification version 3.3", RFC 1950, DOI 10.17487/RFC1950, May 1996,
https://www.rfc-editor.org/info/rfc1950. πΈ - [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997,
https://www.rfc-editor.org/info/rfc2119. π§ - [RFC7250] Wouters, P., Ed., Tschofenig, H., Ed., Gilmore, J., Weiler, S., and T. Kivinen, "Using Raw Public Keys in Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS)", RFC 7250, DOI 10.17487/RFC7250, June 2014,
https://www.rfc-editor.org/info/rfc7250. π - [RFC7924] Santesson, S. and H. Tschofenig, "Transport Layer Security (TLS) Cached Information Extension", RFC 7924, DOI 10.17487/RFC7924, July 2016,
https://www.rfc-editor.org/info/rfc7924. ποΈ - [RFC7932] Alakuijala, J. and Z. Szabadka, "Brotli Compressed Data Format", RFC 7932, DOI 10.17487/RFC7932, July 2016,
https://www.rfc-editor.org/info/rfc7932. π₯ - [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 8126, DOI 10.17487/RFC8126, June 2017,
https://www.rfc-editor.org/info/rfc8126. π§Ύ - [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017,
https://www.rfc-editor.org/info/rfc8174. π - [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018,
https://www.rfc-editor.org/info/rfc8446. πβ¨ - [RFC8447] Salowey, J. and S. Turner, "IANA Registry Updates for TLS and DTLS", RFC 8447, DOI 10.17487/RFC8447, August 2018,
https://www.rfc-editor.org/info/rfc8447. ποΈ - [RFC8478] Collet, Y. and M. Kucherawy, Ed., "Zstandard Compression and the application/zstd Media Type", RFC 8478, DOI 10.17487/RFC8478, October 2018,
https://www.rfc-editor.org/info/rfc8478. β‘
8.2. Informative References π·
- [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security (TLS) Protocol Version 1.2", RFC 5246, DOI 10.17487/RFC5246, August 2008,
https://www.rfc-editor.org/info/rfc5246. π°οΈ
Acknowledgements π«Ά
certificate compression first showed up in the QUIC Crypto protocol, designed by Adam Langley and Wan-Teh Chang. iconic origin story π
this document got so much help from contributions and suggestions by David Benjamin, Ryan Hamilton, Christian Huitema, Benjamin Kaduk, Ilari Liusvaara, Piotr Sikora, Ian Swett, Martin Thomson, Sean Turner, and many others. the squad is literally the best ππ
Authors' Addresses π
Alessandro Ghedini Cloudflare, Inc.
Email: alessandro@cloudflare.com
Victor Vasiliev Google
Email: vasilvv@google.com
π¦ where this page comes from
- ietf: rfc8879 2020-12
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms