Internet-Draft | Importing External PSKs for TLS | April 2020 |
Benjamin & Wood | Expires 10 October 2020 | [Page] |
This document describes an interface for importing external Pre-Shared Keys (PSKs) into TLS 1.3.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 10 October 2020.¶
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.¶
TLS 1.3 [RFC8446] supports Pre-Shared Key (PSK) authentication, wherein PSKs can be established via session tickets from prior connections or externally via some out-of-band mechanism. The protocol mandates that each PSK only be used with a single hash function. This was done to simplify protocol analysis. TLS 1.2 [RFC5246], in contrast, has no such requirement, as a PSK may be used with any hash algorithm and the TLS 1.2 PRF. This means that external PSKs could possibly be re-used in two different contexts with the same hash functions during key derivation. Moreover, it requires external PSKs to be provisioned for specific hash functions.¶
To mitigate these problems, this document specifies a PSK Importer interface by which external PSKs may be imported and subsequently bound to a specific KDF and hash function for use in TLS 1.3. In particular, it describes a mechanism for differentiating external PSKs by the target KDF, (D)TLS protocol version, and an optional context string. This process yields a set of candidate PSKs, each of which are bound to a target KDF and protocol. This expands what would normally have been a single PSK and identity into a set of PSKs and identities.¶
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.¶
The PSK Importer interface mirrors that of the TLS Exporters interface in that it diversifies a key based on some contextual information. In contrast to the Exporters interface, wherein differentiation is done via an explicit label and context string, the PSK Importer interface defined herein takes an external PSK and identity and "imports" it into TLS, creating a set of "derived" PSKs and identities. Each of these derived PSKs are bound a target protocol, KDF identifier, and optional context string. Additionally, the resulting PSK binder keys are modified with a new derivation label to prevent confusion with non-imported PSKs.¶
Imported keys do not require negotiation for use since a client and server will not agree upon identities if imported incorrectly. Endpoints may incrementally deploy PSK Importer support by offering non-imported keys for TLS versions prior to TLS 1.3. Non-imported and imported PSKs are distinct since their identities are different on the wire. See Section 6 for more details.¶
Clients which import external keys MUST NOT use either the external keys or the derived keys for any other purpose. Moreover, each external PSK MUST be associated with at most one hash function, as per the rules in Section 4.2.11 from [RFC8446]. See Section 7 for more discussion.¶
This section describes the PSK Importer interface and its underlying diversification mechanism and binder key computation modification.¶
The PSK Importer interface takes as input an EPSK with External Identity external_identity
and base key epsk
,
as defined in Section 3.1, along with an optional context, and transforms it into a set of PSKs
and imported identities for use in a connection based on target protocols and KDFs.
In particular, for each supported target protocol target_protocol
and KDF target_kdf
,
the importer constructs an ImportedIdentity structure as follows:¶
struct { opaque external_identity<1...2^16-1>; opaque context<0..2^16-1>; uint16 target_protocol; uint16 target_kdf; } ImportedIdentity;¶
The list of target_kdf
values is maintained by IANA as described in Section 9.
External PSKs MUST NOT be imported for (D)TLS 1.2 or prior versions. See Section 6 for discussion on
how imported PSKs for TLS 1.3 and non-imported PSKs for earlier versions co-exist for incremental
deployment.¶
ImportedIdentity.context MUST include the context used to derive the EPSK, if any exists. For example, ImportedIdentity.context may include information about peer roles or identities to mitigate Selfie-style reflection attacks. See Appendix B for more details. If the EPSK is a key derived from some other protocol or sequence of protocols, ImportedIdentity.context MUST include a channel binding for the deriving protocols [RFC5056].¶
ImportedIdentity.target_protocol MUST be the (D)TLS protocol version for which the PSK is being imported. For example, TLS 1.3 [RFC8446] and QUICv1 [QUIC] use 0x0304. Note that this means future versions of TLS will increase the number of PSKs derived from an external PSK.¶
Given an ImportedIdentity and corresponding EPSK with base key epsk
, an Imported PSK
IPSK with base key ipskx
is computed as follows:¶
epskx = HKDF-Extract(0, epsk) ipskx = HKDF-Expand-Label(epskx, "derived psk", Hash(ImportedIdentity), L)¶
L corresponds to the KDF output length of ImportedIdentity.target_kdf as defined in Section 9. For hash-based KDFs, such as HKDF_SHA256(0x0001), this is the length of the hash function output, i.e., 32 octets. This is required for the IPSK to be of length suitable for supported ciphersuites.¶
The identity of ipskx
as sent on the wire is ImportedIdentity, i.e., the serialized content
of ImportedIdentity is used as the content of PskIdentity.identity in the PSK extension.
The corresponding TLS 1.3 binder key is ipskx
.¶
The hash function used for HKDF [RFC5869] is that which is associated with the EPSK. It is not the hash function associated with ImportedIdentity.target_kdf. If no hash function is specified, SHA-256 MUST be used. Diversifying EPSK by ImportedIdentity.target_kdf ensures that an IPSK is only used as input keying material to at most one KDF, thus satisfying the requirements in [RFC8446]. See Section 7 for more details.¶
Endpoints SHOULD generate a compatible ipskx
for each target ciphersuite they offer.
For example, importing a key for TLS_AES_128_GCM_SHA256 and TLS_AES_256_GCM_SHA384 would
yield two PSKs, one for HKDF-SHA256 and another for HKDF-SHA384. In contrast, if
TLS_AES_128_GCM_SHA256 and TLS_CHACHA20_POLY1305_SHA256 are supported, only one
derived key is necessary.¶
EPSKs may be imported before the start of a connection if the target KDFs, protocols, and context string(s) are known a priori. EPSKs may also be imported for early data use if they are bound to protocol settings and configurations that would otherwise be required for early data with normal (ticket-based PSK) resumption. Minimally, that means ALPN, QUIC transport parameters (if used for QUIC), etc., must be provisioned alongside these EPSKs.¶
To prevent confusion between imported and non-imported PSKs, imported PSKs change the PSK binder key derivation label. In particular, the standard TLS 1.3 PSK binder key computation is defined as follows:¶
0 | v PSK -> HKDF-Extract = Early Secret | +-----> Derive-Secret(., "ext binder" | "res binder", "") | = binder_key V¶
Imported PSKs replace the string "ext binder" with "imp binder" when deriving binder_key
.
This means the binder key is computed as follows:¶
0 | v PSK -> HKDF-Extract = Early Secret | +-----> Derive-Secret(., "ext binder" | | "res binder" | | "imp binder", "") | = binder_key V¶
This new label ensures a client and server will negotiate use of an external PSK if
and only if (a) both endpoints import the PSK or (b) neither endpoint imports the
PSK. As binder_key
is a leaf key, changing its computation does not affect any
other key.¶
If a client or server wish to deprecate a hash function and no longer use it for TLS 1.3, they remove the corresponding KDF from the set of target KDFs used for importing keys. This does not affect the KDF operation used to derive Imported PSKs.¶
Recall that TLS 1.2 permits computing the TLS PRF with any hash algorithm and PSK. Thus, an EPSK may be used with the same KDF (and underlying HMAC hash algorithm) as TLS 1.3 with importers. However, critically, the derived PSK will not be the same since the importer differentiates the PSK via the identity and target KDF and protocol. Thus, PSKs imported for TLS 1.3 are distinct from those used in TLS 1.2, and thereby avoid cross-protocol collisions. Note that this does not preclude endpoints from using non-imported PSKs for TLS 1.2. Indeed, this is necessary for incremental deployment.¶
The PSK Importer security goals can be roughly stated as follows: avoid PSK re-use across KDFs while properly authenticating endpoints. When modeled as computational extractors, KDFs assume that input keying material (IKM) is sampled from some "source" probability distribution and that any two IKM values are chosen independently of each other [Kraw10]. This source-independence requirement implies that the same IKM value cannot be used for two different KDFs.¶
PSK-based authentication is functionally equivalent to session resumption in that a connection uses existing key material to authenticate both endpoints. Following the work of [BAA15], this is a form of compound authentication. Loosely speaking, compound authentication is the property that an execution of multiple authentication protocols, wherein at least one is uncompromised, jointly authenticates all protocols. Authenticating with an externally provisioned PSK, therefore, should ideally authenticate both the TLS connection and the external provisioning process. Typically, the external provision process produces a PSK and corresponding context from which the PSK was derived and in which it should be used. If available, this is used as the ImportedIdentity.context value. We refer to an external PSK without such context as "context-free".¶
Thus, in considering the source-independence and compound authentication requirements, the PSK Import interface described in this document aims to achieve the following goals:¶
External PSK identities are typically static by design so that endpoints may use them to lookup keying material. However, for some systems and use cases, this identity may become a persistent tracking identifier.¶
This specification introduces a new registry for TLS KDF identifiers and defines the following target KDF values:¶
KDF Description | Value |
---|---|
Reserved | 0x0000 |
HKDF_SHA256 | 0x0001 |
HKDF_SHA384 | 0x0002 |
New target KDF values are allocated according to the following process:¶
The authors thank Eric Rescorla and Martin Thomson for discussions that led to the production of this document, as well as Christian Huitema for input regarding privacy considerations of external PSKs. John Mattsson provided input regarding PSK importer deployment considerations. Hugo Krawczyk provided guidance for the security considerations.¶
The Selfie attack [Selfie] relies on a misuse of the PSK interface. The PSK interface makes the implicit assumption that each PSK is known only to one client and one server. If multiple clients or multiple servers with distinct roles share a PSK, TLS only authenticates the entire group. A node successfully authenticates its peer as being in the group whether the peer is another node or itself.¶
Applications which require authenticating finer-grained roles while still configuring a single shared PSK across all nodes can resolve this mismatch either by exchanging roles over the TLS connection after the handshake or by incorporating the roles of both the client and server into the IPSK context string. For instance, if an application identifies each node by MAC address, it could use the following context string.¶
struct { opaque client_mac<0..2^16-1>; opaque server_mac<0..2^16-1>; } Context;¶
If an attacker then redirects a ClientHello intended for one node to a different node, the receiver will compute a different context string and the handshake will not complete.¶
Note that, in this scenario, there is still a single shared PSK across all nodes, so each node must be trusted not to impersonate another node's role.¶