RFC 9258 | Importing External PSKs for TLS 1.3 | July 2022 |
Benjamin & Wood | Standards Track | [Page] |
This document describes an interface for importing external Pre-Shared Keys (PSKs) into TLS 1.3.¶
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/rfc9258.¶
Copyright (c) 2022 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 Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
TLS 1.3[RFC8446] supports Pre-Shared Key (PSK) authentication, wherein PSKscan be established via session tickets from prior connections or via some external, out-of-bandmechanism. 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 theTLS 1.2 pseudorandom function (PRF). While there is no known way in which the sameexternal PSK might produce related output in TLS 1.3 and prior versions, only limitedanalysis has been done. ApplicationsSHOULD provision separate PSKs for (D)TLS 1.3 andprior versions. In cases where this is not possible (e.g., there are already-deployedexternal PSKs or provisioning is otherwise limited), reusing external PSKs across differentversions of TLS may produce related outputs, which may, in turn, lead to security problems;seeAppendix E.7 of [RFC8446].¶
To mitigate such problems, this document specifies a PSK importerinterface by which external PSKs may be imported and subsequently bound to a specifickey derivation function (KDF) and hash function for use in TLS 1.3[RFC8446]and DTLS 1.3[RFC9147]. In particular, it describes amechanism for importing PSKs derived from external PSKs by including the target KDF,(D)TLS protocol version, and an optional context string to ensure uniqueness. This process yields a set of candidatePSKs, each of which are bound to a target KDF and protocol, that are separate from thoseused in (D)TLS 1.2 and prior versions. This expands what would normally have been a singlePSK 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 following terms are used throughout this document:¶
This document uses presentation language fromSection 3 of [RFC8446].¶
The PSK importer interface mirrors that of the TLS exporter interface (see[RFC8446])in that it diversifies a key based on some contextual information. In contrast to the exporterinterface, wherein output uniqueness is achieved via an explicit label and context string,the PSK importer interface defined herein takes an external PSK and identity and "imports" it intoTLS, creating a set of "derived" PSKs and identities that are each unique. Each of thesederived PSKs are bound to a target protocol, KDF identifier, and optional context string.Additionally, the resulting PSK binder keys are modified with a new derivation labelto prevent confusion with non-imported PSKs. Through this interface, importing externalPSKs with different identities yields distinct PSK binder keys.¶
Imported keys do not require negotiation for use since a client and server will not agree uponidentities if imported incorrectly. Endpoints may incrementally deploy PSK importer supportby offering non-imported PSKs for TLS versions prior to TLS 1.3.Non-imported and imported PSKsare not equivalent since their identities are different. SeeSection 7 for more details.¶
Endpoints that import external keysMUST NOT use the keys that are input to theimport process for any purpose other than the importer, and theyMUST NOT use the derivedkeys for any purpose other than TLS PSKs. Moreover, each external PSK fed to theimporter processMUST be associated with one hash function at most. Thisis analogous to the rules inSection 4.2.11 of [RFC8446]. SeeSection 8 formore discussion.¶
This section describes the PSK importer interface and its underlying diversificationmechanism and binder key computation modification.¶
As input, the PSK importer interface takes an EPSK with External Identityexternal_identity
and base keyepsk
(as defined inSection 3) along with an optional context. It then transforms the input into a set of PSKsand imported identities for use in a connection based on target protocols and KDFs.In particular, for each supported target protocoltarget_protocol
and KDFtarget_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 ImportedIdentity.target_kdf values is maintained by IANA as described inSection 10.External PSKsMUST NOT be imported for (D)TLS 1.2 or prior versions. SeeSection 7 fordiscussion on how imported PSKs for TLS 1.3 and non-imported PSKs for earlier versionscoexist for incremental deployment.¶
ImportedIdentity.contextMUST include the context used to determine the EPSK, if any exists.For example, ImportedIdentity.context may include information about peer roles or identitiesto mitigate Selfie-style reflection attacks[Selfie]. SeeAppendix A for more details.Since the EPSK is a key derived from an external protocol or sequence of protocols,ImportedIdentity.contextMUST include a channel binding for the deriving protocols[RFC5056]. The details of this binding are protocol specific and out of scope forthis document.¶
ImportedIdentity.target_protocolMUST be the (D)TLS protocol version for which thePSK is being imported. For example, TLS 1.3[RFC8446] uses 0x0304, which willtherefore also be used by QUICv1[QUIC]. Note that this means the numberof PSKs derived from an EPSK is a function of the number of target protocols.¶
Given an ImportedIdentity and corresponding EPSK with base keyepsk
, an imported PSKIPSK with base keyipskx
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 inSection 10. For hash-based KDFs, such as HKDF_SHA256 (0x0001), this is the length of the hash functionoutput, e.g., 32 octets for SHA256. This is required for the IPSK to be of length suitablefor supported ciphersuites. Internally, HKDF-Expand-Label uses a label corresponding toImportedIdentity.target_protocol (e.g., "tls13" for TLS 1.3, as perSection 7.1 of [RFC8446]or "dtls13" for DTLS 1.3, as perSection 5.10 of [RFC9147]).¶
The identity ofipskx
as sent on the wire is ImportedIdentity, i.e., the serialized contentof ImportedIdentity is used as the content of PskIdentity.identity in the PSK extension.The corresponding PSK input for the TLS 1.3 key schedule is "ipskx".¶
As the maximum size of the PSK extension is 216 - 1 octets, an Imported Identity that exceedsthis size is likely to cause a decoding error. Therefore, the PSK importer interfaceSHOULD rejectany ImportedIdentity that exceeds this size.¶
The hash function used for HMAC-based Key Derivation Function (HKDF)[RFC5869] is that which is associated with the EPSK.It is not the hash function associated with ImportedIdentity.target_kdf. If the EPSKdoes not have such an associated hash function, SHA-256[SHA2]SHOULD be used.Diversifying EPSK by ImportedIdentity.target_kdf ensuresthat an IPSK is only used as input keying material to one KDF at most, thus satisfyingthe requirements in[RFC8446]. SeeSection 8 for more details.¶
EndpointsSHOULD generate a compatibleipskx
for each target ciphersuite they offer.For example, importing a key for TLS_AES_128_GCM_SHA256 and TLS_AES_256_GCM_SHA384 wouldyield two PSKs: one for HKDF-SHA256 and another for HKDF-SHA384. In contrast, ifTLS_AES_128_GCM_SHA256 and TLS_CHACHA20_POLY1305_SHA256 are supported, only onederived key is necessary. Each ciphersuite uniquely identifies the target KDF.Future specifications that change the way the KDF is negotiated will need to update thisspecification to make clear how target KDFs are determined for the import process.¶
EPSKsMAY be imported before the start of a connection if the target KDFs, protocols, andcontext string(s) are known a priori. EPSKsMAY also be imported for early data useif they are bound to the protocol settings and configuration that are required forsending early data. Minimally, this means that the Application-Layer Protocol Negotiation (ALPN) value[RFC7301], QUIC transport parameters (if used for QUIC), and any other relevantparameters that are negotiated for early dataMUST be provisioned alongside these EPSKs.¶
To prevent confusion between imported and non-imported PSKs, imported PSKs changethe PSK binder key derivation label. In particular, the standard TLS 1.3 PSK binderkey computation is defined as follows:¶
0 | v PSK -> HKDF-Extract = Early Secret | +-----> Derive-Secret(., "ext binder" | "res binder", "") | = binder_key V¶
Imported PSKs use the string "imp binder" rather than "ext binder" or "res binder"when derivingbinder_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 ifand only if (a) both endpoints import the PSK or (b) neither endpoint imports thePSK. Asbinder_key
is a leaf key, changing its computation does not affect anyother key.¶
If a client or server wishes to deprecate a hash function and no longer use it for TLS 1.3,it removes 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.¶
In deployments that already have PSKs provisioned and in use with TLS 1.2, attemptingto incrementally deploy the importer mechanism would result in concurrent use ofthe already-provisioned PSK directly as both a TLS 1.2 PSK and an EPSK, which, in turn, could mean that the same KDF and key would be used in two different protocol contexts.This is not a recommended configuration; seeSection 8 for more details.However, the benefits of using TLS 1.3 and PSK importers may prove sufficientlycompelling that existing deployments choose to enable this noncompliant configuration fora brief transition period while new software (using TLS 1.3 and importers) is deployed.Operators are advised to make any such transition period as short as possible.¶
The PSK importer security goals can be roughly stated as follows: avoid PSK reuse across KDFs while properly authenticating endpoints. When modeled as computational extractors, KDFsassume that input keying material (IKM) is sampled from some "source" probability distributionand 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 differentKDFs.¶
PSK-based authentication is functionally equivalent to session resumption in that a connectionuses existing key material to authenticate both endpoints. Following the work of[BAA15], this is a form of compound authentication. Looselyspeaking, compound authentication is the property that an execution of multiple authenticationprotocols, wherein at least one is uncompromised, jointly authenticates all protocols. Therefore, authenticating with an externally provisioned PSK should ideally authenticate boththe TLS connection and the external provisioning process. Typically, the external provisioning processproduces a PSK and corresponding context from which the PSK was derived and in which it shouldbe used. If available, this is used as the ImportedIdentity.context value. We refer to anexternal PSK without such context as "context-free".¶
Thus, in considering the source-independence and compound authentication requirements, the PSKimporter interface described in this document aims to achieve the following goals:¶
There are no known related outputs or security issues caused from the processfor computing imported PSKs from an external PSK and the processing of existingexternal PSKs used in (D)TLS 1.2 and below, as noted inSection 7. However,only limited analysis has been done, which is an additional reason why applicationsSHOULD provision separate PSKs for (D)TLS 1.3 and prior versions, even when theimporter interface is used in (D)TLS 1.3.¶
The PSK importer does not prevent applications from constructing non-importer PSK identitiesthat collide with imported PSK identities.¶
External PSK identities are commonly static by design so that endpoints may use them tolook up keying material. As a result, for some systems and use cases, this identitymay become a persistent tracking identifier.¶
Note also that ImportedIdentity.context is visible in cleartext on the wire as part ofthe PSK identity. Unless otherwise protected by a mechanism such as TLS EncryptedClientHello[ECH], applicationsSHOULD NOT put sensitive informationin this field.¶
IANA has created the "TLS KDF Identifiers" registry under the existing "Transport Layer Security (TLS) Parameters" registry.¶
The entries in the registry are as follows:¶
Value | KDF Description | Reference |
---|---|---|
0x0000 | Reserved | RFC 9258 |
0x0001 | HKDF_SHA256 | [RFC5869] |
0x0002 | HKDF_SHA384 | [RFC5869] |
New target KDF values are allocated according to the following process:¶
The procedures for requesting values in the Specification Required space are specified inSection 17 of [RFC8447].¶
The Selfie attack[Selfie] relies on a misuse of the PSK interface.The PSK interface makes the implicit assumption that each PSKis known only to one client and one server. If multiple clients ormultiple servers with distinct roles share a PSK, TLS onlyauthenticates the entire group. A node successfully authenticatesits peer as being in the group whether the peer is another nodeor itself. Note that this case can also occur when there are two nodes sharing a PSK without predetermined roles.¶
Applications that require authenticating finer-grained roles while stillconfiguring a single shared PSK across all nodes can resolve thismismatch either by exchanging roles over the TLS connection afterthe handshake or by incorporating the roles of both the client and the serverinto the IPSK context string. For instance, if an applicationidentifies each node by the Media Access Control (MAC) address, it could use the followingcontext string.¶
struct { opaque client_mac<0..2^8-1>; opaque server_mac<0..2^8-1>; } Context;¶
If an attacker then redirects a ClientHello intended for one node to a differentnode, including the node that generated the ClientHello, the receiver willcompute 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.¶
The authors thankEric Rescorla andMartin Thomson for discussions that led to theproduction of this document, as well asChristian Huitema for input regarding privacyconsiderations of external PSKs.John Preuß Mattsson provided input regarding PSK importerdeployment considerations.Hugo Krawczyk provided guidance for the security considerations.Martin Thomson,Jonathan Hoyland,Scott Hollenbeck,Benjamin Kaduk, and others allprovided reviews, feedback, and suggestions for improving the document.¶