Transport Layer Security (TLS) Cached Information Extension

Abstract

Transport Layer Security (TLS) handshakes often include fairly static
information, such as the server certificate and a list of trusted
certification authorities (CAs). This information can be of
considerable size, particularly if the server certificate is bundled
with a complete certificate chain (i.e., the certificates of
intermediate CAs up to the root CA).

This document defines an extension that allows a TLS client to inform
a server of cached information, thereby enabling the server to omit
already available information.

Status of This Memo

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 at
http://www.rfc-editor.org/info/rfc7924.

Copyright Notice

This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://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.

1. Introduction

Reducing the amount of information exchanged during a Transport Layer
Security handshake to a minimum helps to improve performance in
environments where devices are connected to a network with a low
bandwidth and lossy radio technology. With the Internet of Things,
such environments exist, for example, when devices use IEEE 802.15.4,
Bluetooth Low Energy, or low power wide area networks. For more
information about the challenges with smart object deployments,
please see [RFC6574].

This specification defines a TLS extension that allows a client and a
server to exclude transmission information cached in an earlier TLS
handshake.

A typical example exchange may therefore look as follows. First, the
client and the server execute the full TLS handshake. The client
then caches the certificate provided by the server. When the TLS
client connects to the TLS server some time in the future, without
using session resumption, it then attaches the "cached_info"
extension defined in this document to the ClientHello message to
indicate that it has cached the certificate, and it provides the
fingerprint of it. If the server's certificate has not changed, then
the TLS server does not need to send its certificate and the
corresponding certificate chain again. In case information has
changed, which can be seen from the fingerprint provided by the
client, the certificate payload is transmitted to the client to allow
the client to update the cache.

2. Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "MUST", "MUST NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].

This document refers to the TLS protocol, but the description is
equally applicable to Datagram Transport Layer Security (DTLS) as
well.

3. Cached Information Extension

This document defines a new extension type (cached_info(25)), which
is used in ClientHello and ServerHello messages. The extension type
is specified as follows.

enum {
cached_info(25), (65535)
} ExtensionType;

The extension_data field of this extension, when included in the
ClientHello, MUST contain the CachedInformation structure. The
client MAY send multiple CachedObjects of the same
CachedInformationType. This may, for example, be the case when the
client has cached multiple certificates from a server.

With the type field set to 'cert', the client MUST include the
fingerprint of the Certificate message in the hash_value field.
For this type, the fingerprint MUST be calculated using the
procedure described in Section 5 with the Certificate message as
input data.

'cert_req' Type for not sending the complete CertificateRequest

Message:

With the type set to 'cert_req', the client MUST include the
fingerprint of the CertificateRequest message in the hash_value
field. For this type, the fingerprint MUST be calculated using
the procedure described in Section 5 with the CertificateRequest
message as input data.

New cached info types can be added following the policy described in
the IANA Considerations (Section 8). New message digest algorithms
for use with these types can also be added by registering a new type
that makes use of the updated message digest algorithm. For
practical reasons, we recommend reusing hash algorithms already
available with TLS ciphersuites. To avoid additional code and to
keep the collision probability low, new hash algorithms MUST NOT have
a collision resistance worse than SHA-256.

4. Exchange Specification

Clients supporting this extension MAY include the "cached_info"
extension in the (extended) ClientHello. If the client includes the
extension, then it MUST contain one or more CachedObject attributes.

A server supporting this extension MAY include the "cached_info"
extension in the (extended) ServerHello. By returning the
"cached_info" extension, the server indicates that it supports the
cached info types. For each indicated cached info type, the server
MUST alter the transmission of respective payloads, according to the
rules outlined with each type. If the server includes the extension,
it MUST only include CachedObjects of a type also supported by the
client (as expressed in the ClientHello). For example, if a client
indicates support for 'cert' and 'cert_req', then the server cannot
respond with a "cached_info" attribute containing support for
('foo-bar').

Since the client includes a fingerprint of information it cached (for
each indicated type), the server is able to determine whether cached
information is stale. If the server supports this specification and
notices a mismatch between the data cached by the client and its own
information, then the server MUST include the information in full and
MUST NOT list the respective type in the "cached_info" extension.

Note: If a server is part of a hosting environment, then the client
may have cached multiple data items for a single server. To allow
the client to select the appropriate information from the cache, it
is RECOMMENDED that the client utilizes the Server Name Indication
(SNI) extension [RFC6066].

Following a successful exchange of the "cached_info" extension in the
ClientHello and ServerHello, the server alters sending the
corresponding handshake message. How information is altered from the
handshake messages and for the types defined in this specification is
defined in Sections 4.1 and 4.2, respectively.

4.1. Server Certificate Message

When a ClientHello message contains the "cached_info" extension with
a type set to 'cert', then the server MAY send the Certificate
message shown in Figure 1 under the following conditions:

The server software implements the "cached_info" extension defined
in this specification.

The 'cert' "cached_info" extension is enabled (for example, a
policy allows the use of this extension).

The server compared the value in the hash_value field of the
client-provided "cached_info" extension with the fingerprint of
the Certificate message it normally sends to clients. This check
ensures that the information cached by the client is current. The
procedure for calculating the fingerprint is described in
Section 5.

The original certificate handshake message syntax is defined in
[RFC5246] and has been extended with [RFC7250]. RFC 7250 allows the
certificate payload to contain only the SubjectPublicKeyInfo instead
of the full information typically found in a certificate. Hence,
when this specification is used in combination with [RFC7250] and the
negotiated certificate type is a raw public key, then the TLS server
omits sending a certificate payload that contains an ASN.1
certificate structure with the included SubjectPublicKeyInfo rather
than the full certificate chain. As such, this extension is
compatible with the raw public key extension defined in RFC 7250.
Note: We assume that the server implementation is able to select the
appropriate certificate or SubjectPublicKeyInfo from the received
hash value. If the SNI extension is used by the client, then the
server has additional information to guide the selection of the
appropriate cached info.

When the cached info specification is used, then a modified version
of the Certificate message is exchanged. The modified structure is
shown in Figure 1.

struct {
opaque hash_value<1..255>;
} Certificate;

Figure 1: Cached Info Certificate Message

4.2. CertificateRequest Message

When a fingerprint for an object of type 'cert_req' is provided in
the ClientHello, the server MAY send the CertificateRequest message
shown in Figure 2 under the following conditions:

The server software implements the "cached_info" extension defined
in this specification.

The 'cert_req' "cached_info" extension is enabled (for example, a
policy allows the use of this extension).

The server compared the value in the hash_value field of the
client-provided "cached_info" extension with the fingerprint of
the CertificateRequest message it normally sends to clients. This
check ensures that the information cached by the client is
current. The procedure for calculating the fingerprint is
described in Section 5.

The server wants to request a certificate from the client.

The original CertificateRequest handshake message syntax is defined
in [RFC5246]. The modified structure of the CertificateRequest
message is shown in Figure 2.

struct {
opaque hash_value<1..255>;
} CertificateRequest;

Figure 2: Cached Info CertificateRequest Message

The CertificateRequest payload is the input parameter to the
fingerprint calculation described in Section 5.

5. Fingerprint Calculation

The fingerprint for the two cached info objects defined in this
document MUST be computed as follows:

Compute the SHA-256 [RFC6234] hash of the input data. The input
data depends on the cached info type. This document defines two
cached info types, described in Sections 4.1 and in 4.2. Note
that the computed hash only covers the input data structure (and
not any type and length information of the record layer).
Appendix A shows an example.

Use the output of the SHA-256 hash.

The purpose of the fingerprint provided by the client is to help the
server select the correct information. For example, in case of a
Certificate message, the fingerprint identifies the server
certificate (and the corresponding private key) for use with the rest
of the handshake. Servers may have more than one certificate, and
therefore a hash needs to be long enough to keep the probably of hash
collisions low. On the other hand, the cached info design aims to
reduce the amount of data being exchanged. The security of the
handshake depends on the private key and not on the size of the
fingerprint. Hence, the fingerprint is a way to prevent the server
from accidentally selecting the wrong information. If an attacker
injects an incorrect fingerprint, then two outcomes are possible: (1)
the fingerprint does not relate to any cached state and the server
has to fall back to a full exchange, and (2) if the attacker manages
to inject a fingerprint that refers to data the client has not
cached, then the exchange will fail later when the client continues
with the handshake and aims to verify the digital signature. The
signature verification will fail since the public key cached by the
client will not correspond to the private key that was used by the
server to sign the message.

6. Example

In the regular, full TLS handshake exchange, shown in Figure 3, the
TLS server provides its certificate in the certificate payload to the
client; see step (1). This allows the client to store the
certificate for future use. After some time, the TLS client again
interacts with the same TLS server and makes use of the TLS
"cached_info" extension, as shown in Figure 4. The TLS client
indicates support for this specification via the "cached_info"
extension, see step (2), and indicates that it has stored the
certificate from the earlier exchange (by indicating the 'cert'
type). With step (3), the TLS server acknowledges the support of the
'cert' type and by including the value in the ServerHello, it informs
the client that the content of the certificate payload contains the
fingerprint of the certificate instead of the payload, defined in RFC
5246, of the Certificate message; see step (4).

Figure 3: Example Message Exchange: Initial (Full) Exchange

<- [ChangeCipherSpec]

Finished

Application Data <-------> Application Data

Figure 4: Example Message Exchange: TLS Cached Extension Usage

7. Security Considerations

This specification defines a mechanism to reference stored state
using a fingerprint. Sending a fingerprint of cached information in
an unencrypted handshake, as the ClientHello and ServerHello does,
may allow an attacker or observer to correlate independent TLS
exchanges. While some information elements used in this
specification, such as server certificates, are public objects and
usually do not contain sensitive information, other types that are
not yet defined may. Those who implement and deploy this
specification should therefore make an informed decision whether the
cached information is in line with their security and privacy goals.
In case of concerns, it is advised to avoid sending the fingerprint
of the data objects in clear.

The use of the "cached_info" extension allows the server to send
significantly smaller TLS messages. Consequently, these omitted
parts of the messages are not included in the transcript of the
handshake in the TLS Finish message. However, since the client and
the server communicate the hash values of the cached data in the
initial handshake messages, the fingerprints are included in the TLS
Finish message.

Clients MUST ensure that they only cache information from legitimate
sources. For example, when the client populates the cache from a TLS
exchange, then it must only cache information after the successful
completion of a TLS exchange to ensure that an attacker does not
inject incorrect information into the cache. Failure to do so allows
for man-in-the-middle attacks.

Security considerations for the fingerprint calculation are discussed
in Section 5.

8. IANA Considerations

8.1. New Entry to the TLS ExtensionType Registry

IANA has added an entry to the existing TLS "ExtensionType Values"
registry, defined in [RFC5246], for cached_info(25) defined in this
document.

8.2. New Registry for CachedInformationType

IANA has established a registry titled "TLS CachedInformationType
Values". The entries in the registry are:

Figure 5: ASN.1-Based Certificate: Example

To include the certificate shown in Figure 5 in a TLS/DTLS
Certificate message, it is prepended with a message header. This
Certificate message header in our example is 0b 00 02 36 00 02 33 00
02 00 02 30, which indicates: