Draft: draft-ietf-tls-exported-authenticator

Commentary: I think should land first , and then we should rebase this on top of those changes . Feel free to ignore , too , if we think the best outcome here is to simply clarify inline . 
 unless you hear otherwise merge this after 29 October 2021
This document describes a mechanism in Transport Layer Security (TLS)
for peers to provide a proof of ownership of an identity, such as an
X.509 certificate.  This proof can be exported by one peer,
transmitted out-of-band to the other peer, and verified by the
receiving peer.
This document describes a mechanism that builds on Transport Layer
Security (TLS) or Datagram Transport Layer Security (DTLS) and
enables peers to provide a proof of ownership of an identity, such as
an X.509 certificate.  This proof can be exported by one peer,
transmitted out-of-band to the other peer, and verified by the
receiving peer.
This document provides a way to authenticate one party of a Transport
Layer Security (TLS) or Datagram Transport Layer Security (DTLS)
connection to its peer using authentication messages created after
the session has been established.  This allows both the client and
server to prove ownership of additional identities at any time after
the handshake has completed.  This proof of authentication can be
exported and transmitted out-of-band from one party to be validated
by its peer.
Endpoints can authenticate after a connection is established, in
response to events in a higher-layer protocol, as well as
integrating more context.
Endpoints can authenticate after a connection is established, in
response to events in a higher-layer protocol, as well as
integrating more context (such as context from the application).
Post-handshake authentication is defined in section 4.6.3 of TLS 1.3
TLS13, but it has the disadvantage of requiring additional state to
be stored as part of the TLS state machine.  Furthermore, the
authentication boundaries of TLS 1.3 post-handshake authentication
align with TLS record boundaries, which are often not aligned with
the authentication boundaries of the higher-layer protocol.  For
example, multiplexed connection protocols like HTTP/2 RFC7540 do not
have a notion of which TLS record a given message is a part of.
Post-handshake authentication is defined in section 4.6.3 of TLS 1.3
RFC8446, but it has the disadvantage of requiring additional state to
be stored as part of the TLS state machine.  Furthermore, the
authentication boundaries of TLS 1.3 post-handshake authentication
align with TLS record boundaries, which are often not aligned with
the authentication boundaries of the higher-layer protocol.  For
example, multiplexed connection protocols like HTTP/2 RFC7540 do not
have a notion of which TLS record a given message is a part of.
Exported Authenticators are meant to be used as a building block for
application protocols.  Mechanisms such as those required to
advertise support and handle authentication errors are not handled at
the TLS layer.
Exported Authenticators are meant to be used as a building block for
application protocols.  Mechanisms such as those required to
advertise support and handle authentication errors are not handled by
TLS (or DTLS).
The minimum version of TLS and DTLS required to implement the
mechanisms decribed in this document are TLS 1.2 RFC6347 and DTLS 1.2
RFC5246.
This document uses terminology such as client, server, connection,
handshake, endpoint, peer that are defined in section 1.1 of RFC8446.
The term "initial connection" refers to the (D)TLS connection from
which the exported authenticator messages are derived.
The authenticator request is a structured message that can be created
by either party of a (D)TLS connection using data exported from that
connection.  It can be transmitted to the other party of the (D)TLS
connection at the application layer.  The application layer protocol
used to send the authenticator request SHOULD use a secure transport
channel with equivalent security to TLS, such as QUIC QUIC-TLS, as
its underlying transport to keep the request confidential.  The
application MAY use the existing (D)TLS connection to transport the
authenticator.
An authenticator request message can be constructed by either the
client or the server.  Server-generated authenticator requests use
the CertificateRequest message from Section 4.3.2 of RFC8446.
Client-generated authenticator requests use a new message, called the
ClientCertificateRequest, which uses the same structure as
CertificateRequest.  (Note that the latter is not a request for a
client certificate, but rather a certificate request generated by the
client.)  These message structures are used even if the connection
protocol is TLS 1.2 or DTLS 1.2.
The CertificateRequest and ClientCertificateRequest messages are used
to define the parameters in a request for an authenticator.  These
are encoded as TLS handshake messages, including length and type
fields.  They do not include any TLS record layer framing and are not
encrypted with a handshake or application-data key.
An opaque string which identifies the authenticator request and
which will be echoed in the authenticator message.  A
certificate_request_context value MUST be unique for each
authenticator request within the scope of a connection (preventing
replay and context confusion).  The certificate_request_context
SHOULD be chosen to be unpredictable to the peer (e.g., by
randomly generating it) in order to prevent an attacker who has
temporary access to the peer's private key from pre-computing
valid authenticators.  For example, the application may choose
this value to correspond to a value used in an existing
datastructure in the software to simplify implementation.
An authenticator message can be constructed by either the client or
the server given an established TLS connection, an identity, such as
an X.509 certificate, and a corresponding private key.  Clients MUST
NOT send an authenticator without a preceding authenticator request;
for servers an authenticator request is optional.  For authenticators
that do not correspond to authenticator requests, the
certificate_request_context is chosen by the server.
The uniqueness requirements of the certificate_request_context apply
only to CertificateRequest and ClientCertificateRequest messages that
are used as part of authenticator requests, but do apply across
CertificateRequest and ClientCertificateRequest messages.  A
certificate_request_context value used in a ClientCertificateRequest
cannot be used in an authenticator CertificateRequest on the same
connection, and vice versa.  There is no impact if the value of a
certificate_request_context used in an authenticator request matches
the value of a certificate_request_context in the handshake or in a
post-handshake message.
The authenticator is a structured message that can be exported from
either party of a (D)TLS connection.  It can be transmitted to the
other party of the (D)TLS connection at the application layer.  The
application layer protocol used to send the authenticator SHOULD use
a secure transport channel with equivalent security to TLS, such as
QUIC QUIC-TLS, as its underlying transport to keep the authenticator
confidential.  The application MAY use the existing (D)TLS connection
to transport the authenticator.
An authenticator message can be constructed by either the client or
the server given an established (D)TLS connection, an identity, such
as an X.509 certificate, and a corresponding private key.  Clients
MUST NOT send an authenticator without a preceding authenticator
request; for servers an authenticator request is optional.  For
authenticators that do not correspond to authenticator requests, the
certificate_request_context is chosen by the server.
The Certificate message contains the identity to be used for
authentication, such as the end-entity certificate and any supporting
certificates in the chain.  This structure is defined in TLS13,
Section 4.4.2.
The context_value used for the exporter is empty (zero length) for
all four values.  There is no need to include additional context
information at this stage since the application-supplied context is
included in the authenticator itself.  The length of the exported
value is equal to the length of the output of the hash function
associated with the selected cipher suite (for TLS 1.3) or the hash
function used for the pseudorandom function (PRF) (for (D)TLS 1.2).
Exported authenticators cannot be used with (D)TLS 1.2 cipher suites
that do not use the TLS PRF and with TLS 1.3 cipher suites that do
not have an associated hash function.  This hash is referred to as
the authenticator hash.
To avoid key synchronization attacks, Exported Authenticators MUST
NOT be generated or accepted on (D)TLS 1.2 connections that did not
negotiate the extended master secret extension RFC7627.
An authenticator is formed from the concatenation of TLS 1.3 RFC8446
Certificate, CertificateVerify, and Finished messages.  These
messages are encoded as TLS handshake messages, including length and
type fields.  They do not include any TLS record layer framing and
are not encrypted with a handshake or application-data key.
If the peer populating the certificate_request_context field in an
authenticator's Certificate message has already created or correctly
validated an authenticator with the same value, then no authenticator
should be constructed.  If there is no authenticator request, the
extensions are chosen from those presented in the (D)TLS handshake's
ClientHello.  Only servers can provide an authenticator without a
corresponding request.
ClientHello extensions are used to determine permissible extensions
in the server's unsolicited Certificate message in order to follow
the general model for extensions in (D)TLS in which extensions can
only be included as part of a Certificate message if they were
previously sent as part of a CertificateRequest message or
ClientHello message.  This ensures that the recipient will be able to
process such extensions.
The Certificate message contains the identity to be used for
authentication, such as the end-entity certificate and any supporting
certificates in the chain.  This structure is defined in RFC8446,
Section 4.4.2.
Certificates chosen in the Certificate message MUST conform to the
requirements of a Certificate message in the negotiated version of
TLS.  In particular, the certificate chain MUST be valid for the
signature algorithms indicated by the peer in the
"signature_algorithms" and "signature_algorithms_cert" extension, as
described in Section 4.2.3 of TLS13 for TLS 1.3 or the
"signature_algorithms" extension from Sections 7.4.2 and 7.4.6 of
RFC5246 for TLS 1.2.
In addition to "signature_algorithms" and
"signature_algorithms_cert", the "server_name" RFC6066,
"certificate_authorities" (Section 4.2.4. of TLS13), and
"oid_filters" (Section 4.2.5. of TLS13) extensions are used to guide
certificate selection.
Only the X.509 certificate type defined in TLS13 is supported.
Alternative certificate formats such as RFC7250 Raw Public Keys are
not supported in this version of the specification and their use in
this context has not yet been analysed.
In addition to "signature_algorithms" and
"signature_algorithms_cert", the "server_name" RFC6066,
"certificate_authorities" (Section 4.2.4. of RFC8446), and
"oid_filters" (Section 4.2.5. of RFC8446) extensions are used to
guide certificate selection.
Only the X.509 certificate type defined in RFC8446 is supported.
Alternative certificate formats such as RFC7250 Raw Public Keys are
not supported in this version of the specification and their use in
this context has not yet been analysed.
If an authenticator request was provided, the Certificate message
MUST contain only extensions present in the authenticator request.
Otherwise, the Certificate message MUST contain only extensions
present in the (D)TLS ClientHello.  Unrecognized extensions in the
authenticator request MUST be ignored.
The algorithm field specifies the signature algorithm used (see
Section 4.2.3 of TLS13 for the definition of this field).  The
signature is a digital signature using that algorithm.
The algorithm field specifies the signature algorithm used (see
Section 4.2.3 of RFC8446 for the definition of this field).  The
signature is a digital signature using that algorithm.
If an authenticator request is present, the signature algorithm MUST
be chosen from one of the signature schemes present in the
"signature_algorithms" extensino of the authenticator request.
Otherwise, with spontaneous server authentication, the signature
algorithm used MUST be chosen from the "signature_algorithms" sent by
the peer in the ClientHello of the (D)TLS handshake.  If there are no
available signature algorithms, then no authenticator should be
constructed.
If the party that generates the exported authenticator does so with a
different connection than the party that is validating it, then the
Handshake Context will not match, resulting in a CertificateVerify
message that does not validate.  This includes situations in which
the application data is sent via TLS-terminating proxy.  Given a
failed CertificateVerify validation, it may be helpful for the
application to confirm that both peers share the same connection
using a value derived from the connection secrets before taking a
user-visible action.
A HMAC HMAC over the hashed authenticator transcript, which is the
concatenated Handshake Context, authenticator request (if present),
Certificate, and CertificateVerify.  The HMAC is computed using the
authenticator hash, using the Finished MAC Key as a key.
If the party that generates the exported authenticator does so with a
different connection than the party that is validating it, then the
Handshake Context will not match, resulting in a CertificateVerify
message that does not validate.  This includes situations in which
the application data is sent via TLS-terminating proxy.  Given a
failed CertificateVerify validation, it may be helpful for the
application to confirm that both peers share the same connection
using a value derived from the connection secrets (such as the
Handshake Context) before taking a user-visible action.
An HMAC HMAC over the hashed authenticator transcript, which is the
concatenation of the Handshake Context, authenticator request (if
present), Certificate, and CertificateVerify.  The HMAC is computed
using the authenticator hash, using the Finished MAC Key as a key.
An authenticator is valid if the CertificateVerify message is
correctly constructed given the authenticator request (if used) and
the Finished message matches the expected value.  When validating an
authenticator, constant-time comparisons SHOULD be used for signature
and MAC validation.
The creation and validation of both authenticator requests and
authenticators SHOULD be implemented inside the TLS library even if
it is possible to implement it at the application layer.  TLS
implementations supporting the use of exported authenticators SHOULD
provide application programming interfaces by which clients and
servers may request and verify exported authenticator messages.
If, given an authenticator request, the endpoint does not have an
appropriate identity or does not want to return one, it constructs an
authenticated refusal called an empty authenticator.  This is a
Finished message sent without a Certificate or CertificateVerify.
This message is an HMAC over the hashed authenticator transcript with
a Certificate message containing no CertificateEntries and the
CertificateVerify message omitted.  The HMAC is computed using the
authenticator hash, using the Finished MAC Key as a key.  This
message is encoded as a TLS handshake message, including length and
type field.  It does not include TLS record layer framing and is not
encrypted with a handshake or application-data key.
The creation and validation of both authenticator requests and
authenticators SHOULD be implemented inside the (D)TLS library even
if it is possible to implement it at the application layer.  (D)TLS
implementations supporting the use of exported authenticators SHOULD
provide application programming interfaces by which clients and
servers may request and verify exported authenticator messages.
The following sections describes APIs that are considered necessary
to implement exported authenticators.  These are informative only.
The following sections describe APIs that are considered necessary to
implement exported authenticators.  These are informative only.
It returns the identity, such as the certificate chain and its
extensions, and a status to indicate whether the authenticator is
valid or not after applying the function for validating the
certificate chain to the chain contained in the authenticator.
The API should return a failure if the certificate_request_context of
the authenticator was used in a previously validated authenticator.
Well-formed empty authenticators are returned as invalid.
IANA is requested to add the following entries to the registry for
Exporter Labels (defined in RFC5705): "EXPORTER-server authenticator
handshake context", "EXPORTER-client authenticator finished key" and
"EXPORTER-server authenticator finished key" with "DTLS-OK" and
"Recommended" set to "Y" and this document added to the "Reference"
column.
The Certificate/Verify/Finished pattern intentionally looks like the
TLS 1.3 pattern which now has been analyzed several times.  For
example, SIGMAC presents a relevant framework for analysis.
It returns a status to indicate whether the authenticator is valid or
not after applying the function for validating the certificate chain
to the chain contained in the authenticator.  If validation is
successful, it also returns the identity, such as the certificate
chain and its extensions.
The API should return a failure if the certificate_request_context of
the authenticator was used in a different authenticator that was
previously validated.  Well-formed empty authenticators are returned
as invalid.
When validating an authenticator, constant-time comparison should be
used.
IANA is requested to update the entry for server_name(0) in the
registry for ExtensionType (defined in RFC8446) by replacing the
value in the "TLS 1.3" column with the value "CH, EE, CR" and adding
this document in the "Reference" column.
The addition of the "CR" to the "TLS 1.3" column for the
server_name(0) extension only marks the extension as valid in a
ClientCertificateRequest created as part of client-generated
authenticator requests.
IANA is requested to add the following entries to the registry for
Exporter Labels (defined in RFC5705): "EXPORTER-server authenticator
handshake context", "EXPORTER-client authenticator handshake
context", "EXPORTER-client authenticator finished key" and "EXPORTER-
server authenticator finished key" with "DTLS-OK" and "Recommended"
set to "Y" and this document added to the "Reference" column.
The Certificate/Verify/Finished pattern intentionally looks like the
TLS 1.3 pattern which now has been analyzed several times.  For
example, SIGMAC presents a relevant framework for analysis, and
section 10. of RFC8446 contains a conprehensive set of references.
There is no indication in the TLS layer about which point in time
an authenticator was computed.  Any feedback about the time of
creation or validation of the authenticator should be tracked as
part of the application layer semantics if required.
There is no indication in (D)TLS about which point in time an
authenticator was computed.  Any feedback about the time of
creation or validation of the authenticator should be tracked as
part of the application layer semantics if required.