RFC 8879 | TLS Certificate Compression | December 2020 |
Ghedini & Vasiliev | Standards Track | [Page] |
In TLS handshakes, certificate chains often take upthe majority of the bytes transmitted.¶
This document describes how certificate chains can be compressed to reduce theamount of data transmitted and avoid some round trips.¶
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained athttps://www.rfc-editor.org/info/rfc8879.¶
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) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
In order to reduce latency and improve performance, it can be useful to reducethe amount of data exchanged during a TLS handshake.¶
[RFC7924] describes a mechanism that allows a client and a server to avoidtransmitting certificates already shared in an earlier handshake, but itdoesn't help when the client connects to a server for the first time anddoesn't already have knowledge of the server's certificate chain.¶
This document describes a mechanism that would allow certificates to becompressed during all handshakes.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14[RFC2119][RFC8174] when, and only when, they appear in all capitals, as shown here.¶
This extension is only supported with TLS 1.3[RFC8446] and newer; if TLS 1.2[RFC5246] or earlier is negotiated, the peersMUST ignore this extension.¶
This document defines a new extension type (compress_certificate(27)), whichcan be used to signal the supported compression formats for the Certificatemessage to the peer. Whenever it is sent by the client as a ClientHello messageextension ([RFC8446],Section 4.1.2), it indicates support forcompressed server certificates. Whenever it is sent by the server as aCertificateRequest extension ([RFC8446],Section 4.3.2), it indicates support for compressed client certificates.¶
By sending a compress_certificate extension, the sender indicates to the peerthe certificate-compression algorithms it is willing to use for decompression.The "extension_data" field of this extensionSHALL contain a CertificateCompressionAlgorithms value:¶
enum { zlib(1), brotli(2), zstd(3), (65535) } CertificateCompressionAlgorithm; struct { CertificateCompressionAlgorithm algorithms<2..2^8-2>; } CertificateCompressionAlgorithms;¶
The compress_certificate extension is a unidirectional indication; nocorresponding response extension is needed.¶
If the peer has indicated that it supports compression, server and clientMAYcompress their corresponding Certificate messages (Section 4.4.2 of [RFC8446])and send them in the form of the CompressedCertificate message (replacing theCertificate message).¶
The CompressedCertificate message is formed as follows:¶
struct { CertificateCompressionAlgorithm algorithm; uint24 uncompressed_length; opaque compressed_certificate_message<1..2^24-1>; } CompressedCertificate;¶
If the specified compression algorithm is zlib, then the Certificate messageMUST be compressed with the ZLIB compression algorithm, as defined in[RFC1950].If the specified compression algorithm is brotli, the Certificate messageMUSTbe compressed with the Brotli compression algorithm, as defined in[RFC7932]. Ifthe specified compression algorithm is zstd, the Certificate messageMUST becompressed with the Zstandard compression algorithm, as defined in[RFC8478].¶
It is possible to define a certificate compression algorithm that uses apreshared dictionary to achieve a higher compression ratio. This document doesnot define any such algorithms, but additional codepoints may be allocated forsuch use per the policy inSection 7.3.¶
If the received CompressedCertificate message cannot be decompressed, theconnectionMUST be terminated with the "bad_certificate" alert.¶
If the format of the Certificate message is altered using theserver_certificate_type or client_certificate_type extensions[RFC7250], theresulting altered message is compressed instead.¶
After decompression, the Certificate messageMUST be processed as if it wereencoded without being compressed. This way, the parsing and the verificationhave the same security properties as they would have in TLS normally.¶
In order for certificate compression to function correctly, the underlyingcompression algorithmMUST output the same datathat was provided as input by the peer.¶
Since certificate chains are typically presented on a per-server-name orper-user basis, a malicious application does not have control over any individual fragmentsin the Certificate message, meaning that they cannot leak information about thecertificate by modifying the plaintext.¶
ImplementationsSHOULD bound the memory usage when decompressing theCompressedCertificate message.¶
ImplementationsMUST limit the size of the resulting decompressed chain tothe specified uncompressed length, and theyMUST abort the connection if thesize of the output of the decompression function exceeds that limit. TLS framingimposes a 16777216-byte limit on the certificate message size, and implementationsMAY impose a limit that is lower than that; in both cases, theyMUST apply the samelimit as if no compression were used.¶
While the Certificate message in TLS 1.3 is encrypted, third parties can drawinferences from the message length observed on the wire. TLS 1.3 provides a paddingmechanism (discussed in Sections5.4 andE.3 of[RFC8446]) to counteract suchanalysis. Certificate compression alters the length of the Certificate message,and the change in length is dependent on the actual contents of the certificate.Any padding scheme covering the Certificate message has to address compressionwithin its design or disable it altogether.¶
It's been observed that a significant number of middleboxes intercept and tryto validate the Certificate message exchanged during a TLS handshake. Thismeans that middleboxes that don't understand the CompressedCertificate messagemight misbehave and drop connections that adopt certificate compression.Because of that, the extension is only supported in the versions of TLS wherethe certificate message is encrypted in a way that prevents middleboxes fromintercepting it -- that is, TLS version 1.3[RFC8446] and higher.¶
IANA has created an entry, compress_certificate(27), in the "TLS ExtensionType Values" registry (defined in[RFC8446]) with the values in the "TLS 1.3" column set to "CH, CR" and the "Recommended" column entry set to "Yes".¶
IANA has created an entry, compressed_certificate(25), in the "TLS Handshake Type" registry (defined in[RFC8446]), with the "DTLS-OK" column value set to"Yes".¶
This document establishes a registry of compression algorithms supported forcompressing the Certificate message, titled "TLS Certificate Compression AlgorithmIDs", under the existing "Transport Layer Security (TLS) Extensions" registry.¶
The entries in the registry are:¶
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 |
The values in this registry shall be allocated under "IETF Review" policy forvalues strictly smaller than 256, under "Specification Required" policy forvalues 256-16383, and under "Experimental Use" otherwise (see[RFC8126] for thedefinition of relevant policies). Experimental Use extensions can be used bothon private networks and over the open Internet.¶
The procedures for requesting values in the Specification Required space arespecified inSection 17 of [RFC8447].¶
Certificate compression was originally introduced in the QUIC Crypto protocol,designed byAdam Langley andWan-Teh Chang.¶
This document has benefited from contributions and suggestions fromDavid Benjamin,Ryan Hamilton,Christian Huitema,Benjamin Kaduk,Ilari Liusvaara,Piotr Sikora,Ian Swett,Martin Thomson,Sean Turner, and many others.¶