<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?rfc toc="yes" ?>
<?rfc compact="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc subcompact="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes" ?>

<rfc ipr="trust200902" docName="draft-vanrein-tls-kdh-07" category="info">

<front>

	<title abbrev="TLS-KDH">Quantum Relief with TLS and Kerberos</title>

	<author initials="R" surname="Van Rein" fullname="Rick van Rein">
		<!-- <organization>OpenFortress B.V.</organization> -->
		<organization>InternetWide.org</organization>
		<address>
			<postal>
				<street>Haarlebrink 5</street>
				<city>Enschede</city>
				<region>Overijssel</region>
				<code>7544 WP</code>
				<country>The Netherlands</country>
			</postal>
			<email>rick@openfortress.nl</email>
		</address>
	</author>

	<author initials="T" surname="Vrancken" fullname="Tom Vrancken">
		<!-- <organization>OpenFortress B.V.</organization> -->
		<organization>InternetWide.org</organization>
		<address>
			<postal>
				<street>Imstenrade 24</street>
				<city>Eindhoven</city>
				<region>Noord-Brabant</region>
				<code>5655 BN</code>
				<country>The Netherlands</country>
			</postal>
			<email>tom.vrancken@arpa2.org</email>
		</address>
	</author>

	<date day="5" month="Jun" year="2021"/>

	<abstract>
		<t>This specification describes a mechanism to use Kerberos
		authentication within the TLS protocol. This gives users of TLS a
		strong alternative to classic PKI-based authentication, and at the same time
		introduces a way to insert entropy into TLS' key schedule such that
		the resulting protocol becomes resistant against attacks from quantum
		computers. We call this Quantum Relief, and specify it as part of a more
		general framework to make it easier for other technologies to achieve
		similar benefits.</t>
<!-- kan niet, standards track: Deprecate RFC2712 -->
	</abstract>

<!--

CHANGES FROM 06 TO 07:
 * Restructered the text to pull the specs of the QR extension and the KDH mechanism apart
 * Many textual rewrites to improve readability and clarify the concepts

CHANGES FROM 05 TO 06:
 * Had time to sink in; many small improvements

RESTARTING IN 05:
 * Moving on to TLS 1.3 (was TLS 1.2)
 * Central theme for Quantum Relief
 * Use of an Extension to negotiate encryption alone
 * Use of Certificate Types for client and server Certificate/Verify
 * Backport the approach to TLS 1.2
 * Many suggestions from Tom Vrancken (fully validating him as co-author)

CHANGES FROM 04 TO UNPUBLISHED 05:
* Showed CAMELLIA-based Cipher Suites in the IANA Considerations as well
* Remarks about post-quantum cryptography
* Done: Consider to drop TicketRequestFlags
* Done: Consider passing additional tickets through authzdata; notify needs too?
* Done: How secure is it to let the server submit its TGT?  Does KDC check enough?

CHANGES FROM 03 TO 04:
* Forbidden KDH-Enhanced with subkey in Authenticator; required it in KDH-Only
* For KDH-Only pre-master secret ignore Ticket, but hash entire Authenticator
* Re-added CAMELLIA128/256/256-based CipherSuites with GCM and SHA256/384/512
* Server Certificate sent in KDH-Only, maybe empty, as with Client Certificate
* Added 512-bit CipherSuites
* Merged "Related Work" into "Comparison to Earlier Work"
* Added deprecation of RFC 2712 (to abstract as textual to-do)
* Wrote Acknowledgements section
* Redefined backend tickets, and removed questioning it
* Ticket length 0 marks refusal to provide a ticket

CHANGES FROM 02 TO 03:
* No longer dependent on exchange of TicketRequestFlags to detect/allow TLS-KDH
* Changed to KerberosTicket as client_certificate_type, RFC 7250
* Enabled a  KerberosTicket as server_certificate_type for user-to-user KDH-only
* Server may choose any server_certificate_type it likes when KDH-enhanced
* Wrote the IANA Considerations section

CHANGES FROM 01 TO 02:
* Simplified the wire representation of TicketRequestFlags
* Added conceptual data per connection: TicketRequestFlags, possibly KDH-only/-enhanced

CHANGES FROM 00 TO 01:
* Taken out protocol-bound DH; this saves about 75% of the complexity
* Pre-master secret now incorporates Kerberos session key and DH shared secret
* Integration with "normal" X.509 certificates; client may use krb5 certificate
* Kerberos Ticket as X.509 pubkeyinfo; Authenticator as signature mechanism
* Define TLS-standardised hashes as ChecksumTypes for use in an Authenticator
* Moved TicketRequestFlags to a TLS Extension; negotiation with min/max flags
* Added descriptions of how to support backend servers in Ticket AuthData

-->

</front>

<middle>

<section title="Introduction" anchor="intro">

<t>TLS protects many application protocols from many security problems.  To
enable this, it habitually relies on public-key cryptography.  But in the
foreseeable future, quantum computers are expected to destroy these public-key
underpinnings.  This endangers TLS, because encrypted data may be captured and stored, ready for decryption as soon as quantum computers hit the playing field.</t>

<t>With present-day applications of TLS threatened by quantum computers, some may not be able to live up to user's legal requirements for long-term encryption.  There even is a risk of future power imbalances between those who have a quantum computer and those who have not.</t>

<t>One solution is to not rely solely on public-key cryptography, but instead mix in secret entropy that a future quantum computing entity cannot decipher.  In this light, Kerberos offers an interesting perspective, as it builds a symmetric-key infrastructure including cross-realm connectivity options.  Kerberos is considered safe from quantum computers, as long as its public-key extensions are avoided.</t>

<t>Herein, we specify a TLS extension called "quantum_relief" [<xref target="qr-ext" />] that facilitates mixing in secret entropy
from another source into the TLS key computations. Additionally, we define a concrete mechanism
that provides (1) a source of secret entropy and (2) an alternative authentication mechanism. This mechanism, which
relies on Kerberos for relief against quantum computing and on
(Elliptic-Curve) Diffie-Hellman for Perfect Forward Secrecy (and to stop the
sphere of influence of the KDC administrator), shall be referred to as Kerberised Diffie-Hellman or KDH [<xref target="tls-kdh" />].  A definition is included for a KDH-Only Application Profile, to facilitate small and simple implementations.</t>

</section>

<section title="Quantum Relief as a General Mechanism" anchor="qr">

<t>The PSK mechanism in TLS 1.3 and 1.2 allows insertion of key material, which is referenced by name alone, into the key schedule.  A naming system is defined, but its interpretation resides under local policy, which is enough for internal use cases, but it is insufficient for general use between any two parties.</t>

<t>Cryptographically however, the entropy from the PSK mechanism in TLS 1.3 is
secret to external observers, and mixed with the DHE material using a series of
HKDF-Extract and -Expand operations [<xref target="RFC5869"/>].  When used on their own, the DHE material can be reversed by quantum computers and any subsequent HKDF computations redone, uncovering the complete key schedule of TLS.  The extra source of entropy inserted for a PSK however, will have to be uncovered separately, and this will not be possible in the general case.</t>

<t>This specification exploits this entropy insertion possibilities by
defining a generic TLS extension called "quantum_relief". The "quantum_relief" extension
replaces the locally useful PSK scheme with a generally usable mechanism for
the insertion of secret entropy into the TLS 1.3 key schedule at the position
otherwise used by the PSK. While enabling relief against quantum computer attacks,
this mechanism, however, sacrifices support for 0-RTT data in TLS 1.3.
For TLS 1.2, an extension to the computation of the master secret
inserts the extra entropy.</t>

<t>In order to provide sufficient Quantum Relief, the added entropy must meet
the following conditions:
<list style="symbols" hangIndent="6">
<t>The amount of entropy must on its own suffice for the desired security level of the TLS connection.</t>
<t>The entropy should only be known to parties that are not expected to operate a quantum computer (for example because they are nearby, contractually bound, or otherwise within batting range).</t>
<t>Only quantum-proof mechanisms should be used for the generation of the entropy.</t>
</list></t>

<t>In terms of algorithms that are commonplace today, the third requirement is generally believed to be met by secure hashes and symmetric encryption.  The problem with these is sharing random information secretely and at the same time controlling who has access to these secrets.</t>

<section title="Peer-to-Peer Flow" anchor="qr-p2p">
<t>Besides the customary client-to-server flow there is also support for a peer-to-peer flow under Quantum Relief.  When this is used, the ClientHello sent to a TLS server by an initiating peer holds a peernametype other than "none" followed by a corresponding name for the designated peer.</t>

<t>Without documenting it here, the TLS server is assumed to have some method of designating a peer with this information, and will proxies the TLS connection to its peer.  The TLS server is not involved in cryptographic computations for the relayed TLS connection; its only task is to relay TLS data from the client to the designated peer and vice versa.</t>

</section>

</section>

<section title="The quantum_relief TLS extension" anchor="qr-ext">

<t>This section defines a new TLS extension called "quantum_relief" that
enables relief against quantum computer attacks for TLS as defined in <xref target="qr"/>.
The extension is designed such that it can be applied generically. Its purpose is to

<list style="symbols" hangIndent="6">
<t>Negotiate a concrete Quantum Relief mechanism / method</t>
<t>Initiate / execute the negotiated method</t>
<t>Inject the secret entropy, which is produced by the negotiated Quantum Relief method, into the TLS key schedule</t>
</list>
</t>

<t>A concrete Quantum Relief method that leverages this "quantum_relief" extension is TLS-KDH,
which is defined in <xref target="tls-kdh" />. Future mechanisms may be added by extending
the data structures defined for the "quantum_relief" extension.</t>

<section title="Extension data structures">
<t>In order to distinguish between different Quantum Relief methods, a
QuantumReliefMethod tag is defined. Every (future) method must be assigned
a unique identifier in order to be able to deterministically negotiate a
Quantum Relief method between client and server.</t>

<figure><artwork><![CDATA[
enum {
    none(0),
    (65535)
} QuantumReliefMethod;
]]></artwork></figure>

<t>A TLS ClientHello can additionally specify a name for a peer that it
wants to respond, for which various application-independent forms may be anticipated.
This is captured in yet another tag called PeerNameType.</t>
<!-- TOmDO: SNI is generiek opgezet maar later ingeperkt tot hostname-only om kortzichtige implementaties te ondersteunen.  Encryptie zoals ik gezien heb betreft algemene velden, niet slechts SNI. -->
<figure><artwork><![CDATA[
enum {
    none(0),
    (65535)
} PeerNameType;
]]></artwork></figure>

<t>The value "none" in both tags is defined as default value and signifies no use of a Quantum Relief method or alternative peer name respectively.
They are used for regular client-to-server TLS connections. Additional values and
their corresponding data structures may be defined by concrete Quantum Relief mechanisms.</t>

<t>The "quantum_relief" extension structure is now defined as follows:</t>

<figure><artwork><![CDATA[
struct {
    QuantumReliefMethod qr_method;
    select (qr_method) {
        case none:
            /* Do not send this extension */
            Empty;
    }
    PeerNameType peernametype;
    select (peernametype) {
        case none:
            /* No peer name type */
            Empty;
    }
} QuantumRelief;
]]></artwork></figure>

<t>This structure is used as extension_data corresponding to the
"quantum_relief"(TBD:QREXTTYPE) extension_type,
to occur only during ClientHello and ServerHello.</t>
</section>

<section title="Extension behavior">
<t>When negotiating a Quantum Relief method and a peer name type, the following rules must
be followed.</t>

<t>A TLS client MUST only advertise a Quantum Relief method that it is capable of and willing
to perform. The default Quantum Relief method is none(0) and in that case the "quantum_relief"
extension MUST NOT be sent. In case another Quantum Relief method is set, the client
SHOULD wait with the execution of this method until it receives a method confirmation from
the server in the ServerHello. In case the server sends no confirmation or replies with a different
Quantum Relief method than was advertised, no Quantum Relief method MUST be executed. In that case,
the client MAY decide to either continue or abort the handshake.</t>

<t>A TLS server MUST only accept a Quantum Relief method that it is capable of and willing to perform.
In case a server accepts the method that was advertised by the client, it MAY initiate the execution of
this method. When it does, it MUST confirm this method to the client in its ServerHello message.
Furthermore, it MUST NOT make any PSK references.
In case a server does not accept the method that was advertised by the client, it MUST refrain from
sending this extension.</t>

<t>A TLS client MUST only set a peer name type and corresponding peer name specification if the client
wishes to address a peer other than the TLS server. How this peer name should be interpreted and processed
is up to the negotiated Quantum Relief method.</t>

<t>A TLS server MUST confirm the peer name type to the client in its ServerHello if the server is able to,
and going to process the provided peer name. A server MUST never set a peer name specification itself.</t>

<t>When a ClientHello message contains the "quantum_relief" extension, it
MUST NOT include any references to a PSK.  It MAY independently negotiate
client and server certificate types <xref target="RFC7250"/> and
cipher suites.</t>

</section>

</section>

<section title="TLS-KDH for Quantum Relief through Kerberos" anchor="tls-kdh">

<t>This section defines a mechanism called TLS-KDH. TLS-KDH is a mode of using TLS that was designed to provide two things:

<list style="symbols" hangIndent="6">
<t>An alternative to PKIX credentials in TLS <xref target="RFC5280"/></t>
<t>Quantum Relief for TLS connections</t>
</list>

</t>

<t>The key derivation mechanisms in Kerberos are helpful in a Quantum Relief mechanism; locally controlled secrets are gradually adapted to more specific uses in a non-reversible manner.  The various uses cannot use one token to derive another, whether it is for TLS-KDH or another secure service.</t>

<t>To achieve Quantum Relief, (external) secret entropy needs to be generated and inserted into the TLS key schedule.
In the TLS 1.3 key schedule, the "quantum_relief" extension inserts this entropy at the position where normally the PSK is input;
The two extensions (i.e., "quantum_relief" and PSK) are not considered useful when combined.
In TLS 1.2, a similar result is achieved by enhancing the pre-master secret independently of the negotiated cipher suite.</t>

<t>In addition to Quantum Relief, TLS-KDH can offer authentication based on
Kerberos tickets.  This introduces new facilities into TLS, such as deferred
authentication, anonymous realm users, and centralised facilitation of realm
crossover.</t>

<section title="Client-to-Server Flow" anchor="kdh-c2s">
<t>The flow of TLS 1.3 works best when encryption is provided early, and
authentication is provided late.  These aspects are often combined in Kerberos,
but KDH splits them to resemble TLS patterns more closely,
offering separate Kerberos-based protocol fragments for (1) additional secret entropy for encryption, (2) client authentication through Kerberos Tickets and (3) server authentication through Kerberos Tickets.  Only (1) provides Quantum Relief.  <!-- The server cannot initiate Kerberos, so (3) without (1) is not possible.-->  When (2) is used without (1), Quantum Relief is not achieved.</t>

<t>The TLS-KDH mechanism
uses ClientHello and ServerHello for a Kerberos-protected exchange of entropy,
but it completely ignores the client identity during this phase.  This allows clients to use an anonymous Ticket in the ClientHello message and consider authenticating with an identifying Ticket in later client Certificate and CertificateVerify messages.</t>

<t>Server identity however, is observed in all Tickets, so any use of the Ticket’s contained key by the server suffices as proof of its identity.  This renders the server Certificate and CertificateVerify messages redundant if the server accepts the KDH method for authentication, especially in TLS 1.3 because the Finished message follows immediately.  But redundancy can be a feature; it is certainly legitimate to also authenticate the server with an explicit Kerberos Ticket, a PKIX certificate or other form.</t>

<t>When the server desires proof of client identity, it sends a CertificateRequest.  KDH introduces a certificate type for a Kerberos Ticket, relying on a Kerberos Authenticator as CertificateVerify message.  The server is also able to use this <!-- TODO this refers to what? authenticator? --> to prove being able to use a supplied Ticket with its identity.</t>
</section> <!-- Client-to-Server Flow -->

<section title="Peer-to-Peer Flow" anchor="kdh-p2p">

<t>TLS-KDH also supports a peer-to-peer flow. Here, instead of sending a regular Ticket, a client sends a Ticket Granting Ticket (TGT) to the server. The server then acts
as a proxy that relays TLS traffic to the destined peer and back. The initiating peer (i.e., the client) MAY use an anonymous name for itself in the TGT.</t>

<t>Through the server, the designated peer returns a ServerHello with a Ticket based on this TGT, obtained through the user-to-user flow of Kerberos <!--TODO insert ref to u2u flow-->.  This returned Ticket will reverse the client and server roles for Kerberos compared to TLS, but for peer-to-peer connectivity that is not an issue.  The designated peer will authenticate itself to the initiating peer through its use of this returned Ticket and it can decide whether authentication of the initiating client is desired.</t>

<t>If the TLS client authenticates through a Kerberos Ticket, it uses the designated peer name as the service name and its own name as the client name, in line with the TLS roles for client and server.</t>

</section> <!-- Peer-to-Peer Flow -->

<section title="Injecting Kerberos-derived Entropy">
<t>Whether a Ticket is supplied in the ClientHello or returned by a designated peer
in the ServerHello, it yields a key only known to the two connecting parties.  This key is applied <!-- TODO applied how? Insert ref to computation section? --> to the concatenated random data from ClientHello and ServerHello to derive a new secret.  This means that both parties influence the entropy gathered and can derive a sequence of bytes that is unknown to anyone else.  The output from the encryption operation is plugged into the key schedule instead of the PSK input parameter.  This input is suited for entropy of arbitrary size.</t>
</section> <!-- Injecting Kerberos-derived Entropy -->

<section title="New Data Types and Procedures">

<t>This section describes the data structures and procedures that are
introduced by the TLS-KDH mechanism.</t>

<section title="The quantum_relief KDH method">

<t>TLS-KDH defines a concrete Quantum Relief method for the "quantum_relief" extension that is
defined in <xref target="qr-ext" />. The necessary data type extensions are defined here.</t>

<figure><artwork><![CDATA[
enum {
    none(0),
    kdh(1),
    (65535)
} QuantumReliefMethod;
]]></artwork></figure>

<t>The QuantumReliefMethod type is extended with the value "kdh" that is used to identify the TLS-KDH method of Quantum Relief defined
herein.</t>

<figure><artwork><![CDATA[
enum {
    none(0),
    krb5princrealm(1),
    (65535)
} PeerNameType;
]]></artwork></figure>

<t>In these two types, the value "none" is used for regular client-to-server TLS connections.<!--TODO eerste zin verwijderen? de none waardes zijn al eerder beschreven-->  The value "krb5princrealm" is used in a ClientHello to indicate a Kerberos PrincipalName and Realm [Section 5.2.2 of <xref target="RFC4120"/>] for the designated peer sought behind the TLS server in peer-to-peer TLS connections.</t>

<t>The "quantum_relief" extension with support for the KDH method is now defined as follows:</t>

<figure><artwork><![CDATA[
struct {
    QuantumReliefMethod qr_method;
    select (qr_method) {
        case none:
            /* Don't send this extension */
        case kdh:
            /* Empty, Ticket, or TGT */
            opaque opt_ticket<0..65535>;
    }
    PeerNameType peernametype;
    select (peernametype) {
        case none:
            /* No peer name type */
            Empty;
        case krb5princrealm:
            /* PrincipalName and Realm, resp. */
            struct {
                opaque krb5princ<3..1023>;
                opaque krb5realm<3..1023>;
            } krb5PrincipalRealm;
    }
} QuantumRelief;
]]></artwork></figure>

</section> <!-- The quantum_relief KDH method -->

<section title="Ticket-based Encryption Procedure">

<t>This section describes the procedure for encryption based on Kerberos primitives.  The procedure is referenced in other sections, for proofs and as a source of entropy.</t>

<t>The TLS-KDH messages and cryptographic computations require Kerberos through their use of the key concealed in a Ticket.  The defined function below produces a binary object that cryptographically binds its input to the key.</t>

<figure><artwork><![CDATA[
Signature:
 o = Ticket-Encrypt (t, u, h)

Input:
 - Ticket t
 - KeyUsage u
 - Hash h

Output:
 - OctetString o

Steps:
 1. base-key     = t.enc-part.key
 2. specific-key = rfc3961.key-derivation (base-key, u)
 3. init-state   = rfc3961.initial-cipher-state (
                   specific-key, DIRECTION_ENCRYPT)
 4. (state,o)    = rfc3961.encrypt (specific-key, init-state)
]]></artwork></figure>

<t>Not shown in the procedure, there is a need to decrypt the enc-part of the Ticket before the key concealed in it can be extracted.  This is where proof of identity comes into play; only the two parties connected by the Ticket should be able to perform this decryption.</t>

<t>The name prefix "rfc3961" points to the generic descriptions for Kerberos
key-based procedures <xref target="RFC3961"/> that are implemented with various
algorithms.  Available algorithms are listed in the IANA Registry of Kerberos
Parameters.</t>

<t>The Key Usage values are numbers, for which the following are defined by this specification.  Their number ranges are deliberately chosen to not clash with those of Kerberos, but otherwise compliant to the application range [Section 7.5.1 of <xref target="RFC4120"/>].  The Key Usage values are referenced by name elsewhere in this specification.</t>

<figure><artwork><![CDATA[
2008 = KEYUSAGE_TLS12KDH_PREMASTER_QR
2018 = KEYUSAGE_TLSKDH_CLIENT_QR
2019 = KEYUSAGE_TLSKDH_SERVER_QR
2020 = KEYUSAGE_TLSKDH_SERVER_VFY
2021 = KEYUSAGE_TLSKDH_CLIENT_VFY
]]></artwork></figure>

</section> <!-- Ticket-based Encryption Procedure -->

<section title="Kerberos Ticket and TGT">

<t>Where this text speaks of a TGT, short for Ticket Granting Ticket, it imposes the following requirements to the PrincipalName [Section 5.2.2 of <xref target="RFC4120"/>] in the sname field of a Ticket:
<list style="symbols" hangIndent="6">
<t>The name-type is set to NT-SRV-INST or 2</t>
<t>The name-string consists of two component strings</t>
<t>The first name-string component string is the fixed string krbtgt</t>
</list>
<!-- TOmDO: geen voorbeeld, want DER hier dumpen helpt denk ik niet echt -->
</t>

<t>To be a TGT, all these requirements MUST be met by a Ticket; a Ticket that should be a TGT but does not meet all these conditions is badly formed and the recipient MUST respond to it by reporting error bad_certificate and closing the connection.</t>

</section> <!-- Kerberos Ticket and TGT -->

<section title="Certificate Types">

<t>In order to be able to negotiate Kerberos Tickets as certificate types for
the Certificate messages, a new certifcate type is introduced that can be used
in the "client_certificate_type" and "server_certificate_type" extensions:
<list style="symbols" hangIndent="6">
	<t>Kerberos Ticket (TBD:KRBTKT-CERTTP)</t>
</list>
</t>

</section> <!-- Certificate Types -->

</section> <!-- New Data Types and Procedures -->

<section title="Changes to TLS Messages and Behaviour">

<t>Although TLS-KDH does not introduce any new messages for TLS, there are
however a few modifications to the contents or the manner of processing of existing messages.  Unless specified otherwise, the modifications apply to TLS 1.3 and 1.2 alike.</t>

<section title="ClientHello">

<t>When this message contains the "quantum_relief" extension, its
"qr_method" MUST be set to "kdh" under this specification.  Further
requirements to this extension depend on the pattern of use being
client-to-server [<xref target="kdh-c2s"/>] or peer-to-peer [<xref
target="kdh-p2p"/>].</t>

<t>To initiate client-to-server traffic, the "peernametype" MUST be set to "none", and the "opt_ticket" MUST be a Ticket with the service name, host or domain name, and Kerberos realm of the addressed service.  The client name in the "opt_ticket" MAY be an anonymous identity and the server MUST ignore the client identity in the "opt_ticket".  When the "server_name" extension is also sent, there SHOULD be restrictions enforced by the server on its relation with the service name in the "opt_ticket", but this may involve domain-to-hostname mappings, for instance through DNS SRV records under DNSSEC protection.</t>

<t>To initiate peer-to-peer traffic that could be proxied through the TLS
server to end at a designated peer, the "peernametype" MUST NOT be set to "none",
and the "opt_ticket" MUST be a TGT for the TLS client, suited for the ticket
granting service of the TLS server’s realm; it is permitted for the client to
use an anonymous identity in this TGT and both the server and the designated peer MUST ignore the client
identity in the "opt_ticket".  When the "peernametype" is set to "krb5princrealm", the "krb5princ" and "krb5realm" fields MUST be set to the Kerberos PrincipalName and Realm for the designated peer.  Future extensions may introduce alternative forms of designated peer identities and a TLS server SHOULD be open to the general idea of identity.</t>

</section> <!-- ClientHello -->

<section title="ServerHello">

<t>This specification defines a response to ClientHello extensions with "qr_method" set to "kdh",
for which the accepting ServerHello extension MUST also be set to "kdh".</t>

<t>When the ClientHello extension had its "peernametype" set to "none", the
ServerHello extension responds to a client-to-server connection request.  The
TLS data will be processed on the server and the response extension MUST set the "opt_ticket" field to a zero-length byte string representing an empty ticket field (i.e., no ticket).</t>

<t>When the ClientHello extension had its "peernametype" set to another value than "none", then the TLS server SHOULD use this to locate a designated peer, which may have registered through a mechanism not specified herein, and proxy the TLS traffic to this designated peer.  The TLS server continues to proxy TLS traffic until the connection closes.  When such peer-to-peer connectivity is not supported by a TLS server or when the peer name could not be resolved to a designated peer or when the designated peer is unresponsible, the TLS server MUST send a handshake_failure alert and close the connection.</t>

<t>When a designated peer, possibly after out-of-band registration with a TLS server as a
recipient for peer-to-peer TLS connections, receives a ClientHello with a
"quantum_relief" extension with "qr_method" set to "kdh", a
"peernametype" and "peername" that it recognises as its own, and with a TGT in
the "opt_ticket" field, it SHOULD engage in a user-to-user ticket request with
the ticket granting service for its realm.  It MUST reject the connection if
this procedure fails.  When a Ticket is obtained, it constructs a ServerHello
with a "quantum_relief" extension, sets "qr_method" to "kdh",
"peernametype" to "none", and "opt_ticket" to the just-obtained Ticket.  Furthermore, it continues to act as though the client had contacted it directly, while being forgiving to the proxied nature of the connection that carries the TLS traffic.  There are no grounds for assuming anything about the client identity.</t>

</section> <!-- ServerHello -->

<section title="Server-sent CertificateRequest">

<t>Since client identity is ignored by the server or designated peer during ClientHello and
ServerHello, and may indeed be toned down to an anonymous identity, a
server-side requiring to know its client MAY send a CertificateRequest in order
to verify the client's identity.</t>

<t>When using KDH without server certificate, the server MUST send a CertificateRequest with
which it requests a Kerberos Ticket from the client in order to mutually authenticate each other.
If the client does not provide such a ticket, authentication can not take place and the handshake
MUST be aborted. Note that the client is still allowed to provide an anonymous ticket. This may,
however, result in authentication being rejected by the server.</t>

<t>When using KDH with server certificate, the server SHOULD send a CertificateRequest to
request for a ticket with which the (regular) server authentication (e.g., X.509) can be enhanced.
The client MAY decline this offer and it is up to the server whether to accept this or not.</t>

<t>In order to be able to request a Kerberos Ticket during the handshake, the Kerberos Ticket (TBD:KRBTKT-CERTTP) certificate
type must be negotiated via the client_certificate_type extension <xref target="RFC7250"/>. If a client_certificate_type was
negotiated then CertificateRequest MUST be sent. When permitted by the TLS 1.3 client with the post_handshake_auth extension,
this MAY also be sent at any later time.  Under TLS 1.2, TLS renegotiation permits a similar facility.</t>

</section> <!-- Server-sent CertificateRequest -->

<section title="Server-sent Certificate and CertificateVerify">

<t>The Certificate and CertificateVerify messages are not always required,
because (1) the "quantum_relief" extension captures the server identity, and (2) proof thereof is deferred to Finished, which under TLS 1.3 is available to the client before it sends the client Certificate.  Even in cases when it is not strictly required, a server MAY opt for sending server Certificate and CertificateVerify.</t>

<t>The "server_certificate_type" extension may be used to negotiate any
supported type for these messages, including the Kerberos Ticket certificate
type defined herein.  When not negotiated, the default type is a PKIX certificate <xref target="RFC5280"/>.  Note
that a server cannot initiate a Kerberos exchange, so a Kerberos type cannot be
used when the client did not send (or the server rejected) a "quantum_relief" extension or when the
extension did not provide a Ticket or TGT such as it does when the "qr_method" is "kdh".</t>

</section> <!-- Server-sent Certificate and CertificateVerify -->

<section title="Client-sent Certificate and CertificateVerify">

<t>Under TLS 1.3, the server can request client authentication by sending a
CertificateRequest message. It is possible for servers to do this at any time (provided that the client has sent the "post_handshake_auth" extension), and possibly multiple times; TLS 1.3 even defines how to handle overlapping requests for client authentication.</t>

<t>Clients MAY choose to respond to a CertificateRequest by sending a
Certificate and CertificateVerify, and the server MAY choose to close the
connection if the client chooses otherwise. When the server does not supply a
server certificate, a client Certificate message is mandatory in order for both parties
to authenticate. If the client does not provide a ticket via a Certificate message
then the server MUST abort the handshake.</t>

<t>Note that under TLS-KDH a CertificateVerify message consists of a Kerberos Authenticator
[Section 5.5.1 of <xref target="RFC4120"/>].
The Authenticator serves as the Kerberos equivalent of a digital signature.</t>

<t>The "client_certificate_type" extension may be used to negotiate any
supported type for
these messages, including the Kerberos Ticket certificate type defined before.
When not negotiated, the default type is X.509.  Note that a client can produce
a Kerberos Ticket even when no "quantum_relief" extension was negotiated
during ClientHello and/or ServerHello, or even when another "qr_method" than
"kdh" was agreed. However, a client MUST NOT send Certifcate and
CertificateVerify messages if it did not receive a CertificateRequest from the
server.</t>

</section> <!-- Client-sent Certificate and CertificateVerify -->

<section title="Length of Finished">

<t>Under TLS 1.3, the Finished message is as long as the transcript hash.
Under TLS 1.2, this is negotiable.  For TLS-KDH under TLS 1.2 the client MUST
request the "verify_data" length within the Finished message to be as long as
the output length of the
hash being used to compute it, and the server MUST accept this.</t>

</section> <!-- Length of Finished -->

<section title="Selection of Cipher Suites">

<t>Under TLS 1.3, all current cipher suites incorporate (Elliptic-Curve)
Diffie-Hellman.  Under TLS 1.2 this is optional.  For TLS-KDH the
client MUST offer cipher suites that include these forms (i.e. ECDHE) of key agreement and the server MUST NOT select a cipher suite without any of these forms of key agreement.</t>

</section> <!-- Selection of Cipher Suites -->

<section title="Tickets and Connection Expiration">

<t>Tickets in Kerberos represent a key-based connection between two peers.  The
key material in a Ticket is time-limited in the understanding that a client can always request a new Ticket if so desired.  Expiration of a Ticket SHOULD be matched with a teardown of the service.  In terms of TLS-KDH, that means that the connection SHOULD NOT exist beyond the life time of a Ticket.  Each side can independently close down the TLS connection with an certificate_expired alert.</t>

<t>To avoid this, it is possible to request a new client Certificate and
CertificateVerify through a new CertificateRequest, best sent sometime before expiry.  The client then acquires a fresh or prolonged Ticket and once exchanged, the connection may continue up to the timeout of the new Ticket.</t>

<t>The timeout is updated by every new Ticket supplied in the "opt_ticket"
field of a "quantum_relief" extension with "qr_method" set to "kdh", or by a Certificate of type Kerberos Ticket, provided that it is followed by a valid CertificateVerify.</t>

<t>A server MUST NOT send data over a connection with a timed-out Ticket, but SHOULD request a fresh one or disconnect.  A client MUST NOT send data over a connection with a timed-out Ticket according to its local clock, but it MAY await the arrival of a fresh Ticket (from its KDC).  Data arriving over a connection with a timed-out Ticket is considered a failure to refresh a ticket.  It is a good precaution to request a fresh Ticket a few minutes before the active one expires, to compensate for clock skew between TLS endpoints.</t>

<t>Kerberos supports Tickets with future validity times, intended for such things as nightly batch jobs that require authentication.  By default, a TLS stack should reject such Tickets until they start being valid.  Specific applications may however be aware of this enhancement and deliberately override this default behaviour; an example would be an application that schedules such nightly jobs.</t>

</section> <!-- Tickets and Connection Expiration -->

</section> <!-- Changes to TLS Messages and Behaviour -->

</section> <!-- TLS-KDH for Quantum Relief through Kerberos -->

<section title="Cryptographic Modes">

<t>The introduction of the Quantum Relief extension (in combination with
TLS-KDH) leads to a few cryptographic changes to the TLS protocol.  Below, the
three modes introduced are discussed independently.  Separate treatment for
TLS 1.3 and 1.2 is only necessary for Quantum Relief encryption.  The
aspects of client and server authentication with Kerberos Tickets use the same
data structures and are discussed together.</t>

<section title="Quantum Relief for Encryption in TLS 1.3">

<t>Under client-to-server TLS-KDH, the "opt_ticket" in the "quantum_relief"
extension in the ClientHello is used to supply external (quantum proof) key material.  Under peer-to-peer TLS-KDH, the TGT in the "opt_ticket" supplies no shared key material to the client and server (or designated peer), but the ServerHello returns a "quantum_relief" extension with an "opt_ticket" field holding a Ticket that does supply a shared key to use.</t>

<t>This key is used to compute
</t><t><figure><artwork><![CDATA[
Ticket-Encrypt (opt_ticket, usage,
                ClientHello.random || ServerHello.random)
]]></artwork></figure></t><t>
where || signifies concatenation, and
usage is either KEYUSAGE_TLSKDH_CLIENT_QR for a Ticket supplied by the client,
or KEYUSAGE_TLSKDH_SERVER_QR for a Ticket supplied by the server side (or
designated peer).  The output of this computation is provided instead of the PSK on
the left of the Key Schedule for TLS 1.3 [page 93 of <xref target="RFC8446"/>].  Note how the ServerHello is involved in this computation, and not just the ClientHello; had PSK facilities been used, then this seeding would have arrived too late to provide the binder_key, client_early_traffic_secret and early_exporter_master_key.  But replacing the locally oriented PSK mechanism with TLS-KDH, means that there is no facility for early data or other PSK facilities, so these keys need not be computed.</t>

<t>Other "qr_method" values than "kdh" are likely to come up with other computations.  There may be some that prefer to influence only the master key by replacing the 0 value for key input as it is shown in the TLS 1.3 key schedule.</t>

</section> <!-- Quantum Relief for Encryption in TLS 1.3 -->

<section title="Quantum Relief for Encryption in TLS 1.2">

<t>TLS 1.2 does not offer any form of encryption during the handshake, so Quantum Relief for TLS 1.2 can only be used to strengthen the Master Secret.  When
the "quantum_relief" extension with the "kdh" method is accepted by the server, a Ticket is
available while forming the ServerHello; it is in the ClientHello for
client-to-server mode and in the ServerHello for peer-to-peer mode.  Call this
Ticket qrt and use it to compute
</t><t><figure><artwork><![CDATA[
Ticket-Encrypt (qrt, KEYUSAGE_TLS12KDH_PREMASTER_QH,
                ClientHello.random || ServerHello.random)
]]></artwork></figure></t><t>
where || denotes concatenation.  The output of this procedure is an octet string which is prepended to what the cipher-suite defines as its pre-master secret.  This prepended form is then used instead of the normal pre-master secret during the computation of the master key.</t><!-- TODO wellicht kunnen we de formules hier nog wat duidelijk beschrijven? de premaster comp uitschrijven net als vroegah? -->

</section> <!-- Quantum Relief for Encryption in TLS 1.2 -->

<section title="Kerberos Ticket as Certificate and CertificateVerify">

<t>Kerberos Tickets(TBD:KRBTKT-CERTTP) can be negotiated independently as client_certificate_type and server_certificate_type <xref target="RFC7250"/>; in TLS-KDH, a client certificate is available when the server accepts the client's "quantum_relief" extension with method "kdh".</t>

<t>The contents of the Certificate message when the certificate type is negotiated as this "Kerberos" certificate type is a Kerberos Ticket [Section 5.3 of <xref target="RFC4120"/>] in the customary DER encoding.</t>

<t>The contents of the corresponding CertificateVerify message uses this Ticket
k5crt to compute
</t><t><figure><artwork><![CDATA[
Ticket-Encrypt (k5crt, KEYUSAGE_CLIENT_VFY, th)
]]></artwork></figure></t><t>
for a client CertificateVerify message or
</t><t><figure><artwork><![CDATA[
Ticket-Encrypt (k5crt, KEYUSAGE_SERVER_VFY, th)
]]></artwork></figure></t><t>
for a server CertificateVerify message, where th is the customary transcript hash up to
and including the preceding Certificate message.  For TLS 1.3, this hash algorithm equals the transcript hash algorithm; for TLS 1.2, the hash algorithm must match the Certificate signing algorithm, which in case of a Kerberos Ticket means its MAC hashing algorithm without reductions in the size of the hash output.</t>
<!-- TOmDO In een eerdere versie had ik voorgeschreven hoe de Authenticator er uit moet zien; dit is afgeraden door Ken Rayburn tijdens een overlegronde; laat dat aan applicaties over, dwing libraries niet om iets te doen wat ze onnatuurlijk vinden, er is al eens over nagedacht hoe dit in code moet en compatible blijft -->
</section> <!-- Kerberos Ticket as Certificate and CertificateVerify -->

</section> <!-- Cryptographic Modes -->

<section title="KDH-Only Application Profile">
<t>The default use of TLS involves authentication based on X.509 certificates.
In some scenarios such a PKI is not available or not desirable.  For this
reason, the remainder of this section defines an alternative, KDH-Only Application Profile as minimally being TLS-KDH compliant.</t>

<t>TLS-KDH-compliant applications MUST implement the TLS_AES_128_GCM_SHA256 [GCM] cipher suite and SHOULD implement the TLS_AES_256_GCM_SHA384 [GCM] and TLS_CHACHA20_POLY1305_SHA256 [RFC8439] cipher suites.</t>

<t>TLS-KDH-compliant applications MUST support the Kerberos Ticket certificate
type.  They also MUST treat X.509 as the default certificate type, but they MAY refuse any attempt to use it, either by negotiating an explicit alternative or failing to negotiate an alternative.</t>

<t>TLS-KDH-compliant applications MUST support key exchanges with secp256r1
(NIST P-256) and SHOULD support key exchanges with X25519 [RFC7748].</t>

<t>TLS-KDH-compliant applications MUST support the "quantum_relief" TLS
extension, for which the qr_method value "kdh" MUST be supported, and the peernametype value "none" MUST and "krb5princrealm" SHOULD be supported.</t>

</section> <!-- KDH-Only Application Profile -->

<section title="Security Considerations">

<t>Quantum Relief is an alternative to the PSK mechanism, which may have
similar benefits for local setups, but is not subject of discussion here.
The loss of PSK facilities means that no Early Data can be sent, which can
be resolved by sending the same data later.  It is a loss of efficiency,
but not of security.</t>

<section title="Encryption">

<t>To verify that encryption has successfully been established, a
party must validate encrypted data received from the other.  This is at
least the case when a proper Finished message arrives, which provides
ample entropy to be certain, incorporating the identities exchanged
throughout the handshake.</t>

<t>In TLS 1.3, the parties may send encrypted data which may provide
ample entropy as well.  The transcript hash does not include the entropy
derived with the Quantum Relief extension, and so authentication cannot
be used as proof of having established encryption unless it is as a
provider of verifiable entropy that is wrapped in handshake encryption.</t>

<t>The late establishment of encryption has an impact on the privacy of
client identity.  This identity is unprotected in TLS 1.2, but under TLS 1.3
its privacy is protected with encryption.  To ensure that the right
party is communicating remotely, the Finished message SHOULD be processed
before sending the client's Certificate.</t>

</section> <!-- Encryption -->

<section title="Server Authentication">

<t>The identity of the server under generic Quantum Relief needs to
wait for the arrival of the server's Certificate and CertificateVerify
messages.  Specifically for TLS-KDH, the ability to decrypt a Ticket
(for the client-to-server flow) or to produce a Ticket from a TGT
(for the peer-to-peer flow) provides the same proof.  Clients MAY trust
this to validate server identity, but MUST also validate a
Certificate and CertificateVerify if the server sends them.</t>

<t>Under the peer-to-peer flow, the designated peer produces a Ticket
with Kerberos roles reversed relative to TLS roles.  The Ticket
produced mentions the designated peer as a Kerberos client to the 
service of the TGT-sending party, which is the TLS client.  This is
neither a problem to the peer-to-peer flow of TLS-KDH, nor to the
user-to-user mechanism [Section 3.7 of <xref target="RFC4120"/>]
of Kerberos.  The TLS client MUST be able to extract the
secret from the Ticket, as an assurance that it is the designated
receiver for this identity claim.  The verification of the
CertificateVerify assures this, as well as the binding to the
TLS flow through the transcript hash.</t>

</section> <!-- Server Authentication -->

<section title="Client Authentication">

<t>The server MUST NOT process any client identity in the Quantum Relief
extension, because that may be either an anonymous identity or a
pseudonym, to avoid public visibility.  When client identity is needed
by the server, it MUST ask for it with a CertificateRequest.</t>

<t>The client Certificate and CertificateVerify provide the proper
identity for the client, which MAY differ from any identity passed
before.</t>

<t>Under TLS-KDH, the client produces a Ticket with identities for
both client and server.  The server MUST be able to extract the
secret from the Ticket, as an assurance that it is the designated
receiver for this identity claim.  The verification of the
CertificateVerify assures this, as well as the binding to the
TLS flow through the transcript hash.</t>

</section> <!-- Client Authentication -->

</section> <!-- Security Considerations -->

<section title="IANA Considerations">

<t>IANA adds the following TLS ExtensionType Value as part of their Transport Layer Security Extensions registry:</t>

<figure><artwork><![CDATA[
Value         Extension Name  TLS 1.3  Recommended  Reference
TBD:QREXTTYP  quantum_relief  CH, SH   Y            TBD:ThisSpec
]]></artwork></figure>

<t>IANA adds the following TLS Certificate Type as part of their Transport Layer Security Extensions registry:</t>

<figure><artwork><![CDATA[
Value              Name             Recommended  Reference
TBD:KRBTKT-CERTTP  Kerberos Ticket  Y            TBD:ThisSpec
]]></artwork></figure>

<t>IANA creates a registry for the QuantumReliefMethod in the
TBD: TLS Extensions registry, with the following initial entries
and new entries to be assigned under a Specification Required
policy.</t>

<figure><artwork><![CDATA[
Value        Method                    Reference
-----------  ------------------------  ------------
0            none                      TBD:ThisSpec
1            kdh                       TBD:ThisSpec
2-65281      Unassigned
65282-65535  Reserved for Private Use  TBD:ThisSpec
]]></artwork></figure>

<t>IANA creates a registry for the PeerNameType in the
TBD: TLS Extensions registry, with the following initial entries
and new entries to be assigned under a Specification Required
policy.</t>

<figure><artwork><![CDATA[
Value        Name Type                 Reference
-----------  ------------------------  ------------
0            none                      TBD:ThisSpec
1            krb5princrealm            TBD:ThisSpec
2-65281      Unassigned
65282-65535  Reserved for Private Use  TBD:ThisSpec
]]></artwork></figure>

</section> <!-- IANA Considerations -->

</middle>


<back>

<references title="Normative References">

<!--
<reference anchor='KRB5-KDH'>
<front>
<title abbrev="krb5-kdh">KRB5-KDH: Cryptographically binding Kerberos with Diffie-Hellman</title>
<author initials="R" surname="Van Rein" fullname="Rick van Rein">
<organization>InternetWide.org</organization>
<address>
<postal><street>Haarlebrink 5</street><city>Enschede</city><region>Overijssel</region><code>7544 WP</code><country>The Netherlands</country></postal>
<email>rick@openfortress.nl</email>
</address>
</author>
<date day="11" month="October" year="2014"/>
<abstract>
<t>This specification extends Kerberos with primitives that create a
cryptographic binding between Kerberos authentication and
Diffie-Hellman encryption. This yields their combined advantages.
The variant described as KDH-Only removes server certificates and
end up being secure under our current understanding of Quamtum
Computing.</t>
</abstract>
</front>
</reference>
-->

<!-- DROPPED AS OUT-OF-SCOPE REFERENCE
<reference anchor='KREALM'>
<front>
<title abbrev="krealm">Declaring Kerberos Realm Names in DNS (_kerberos TXT)</title>
<author initials="R" surname="Van Rein" fullname="Rick van Rein">
<organization>InternetWide.org</organization>
<address>
<postal><street>Haarlebrink 5</street><city>Enschede</city><region>Overijssel</region><code>7544 WP</code><country>The Netherlands</country></postal>
<email>rick@openfortress.nl</email>
</address>
</author>
<date day="11" month="September" year="2015"/>
<abstract>
<t>This specification defines methods to determine Kerberos realm
   descriptive information for services that are known by their DNS
   name.  Currently, finding such information is done through static
   mappings or educated guessing.  DNS can make this process more
   dynamic, provided that DNSSEC is used to ensure authenticity of
   resource records.</t>
</abstract>
</front>
</reference>
-->

<!-- EXTERNAL <?rfc include="reference.RFC.1035.xml"?> -->
<!-- <?rfc include="reference.RFC.1510.xml"?> -->
<!-- EXTERNAL <?rfc include="reference.RFC.4033.xml"?> -->
<!-- <?rfc include="reference.RFC.2782.xml"?> -->
<?rfc include="reference.RFC.3961.xml"?>
<?rfc include="reference.RFC.4120.xml"?>
<!-- <?rfc include="reference.RFC.4343.xml"?> -->
<!-- <?rfc include="reference.RFC.4492.xml"?> -->
<!-- <?rfc include="reference.RFC.5226.xml"?> -->
<!-- <?rfc include="reference.RFC.5246.xml"?> -->
<?rfc include="reference.RFC.5280.xml"?>
<!-- <?rfc include="reference.RFC.5746.xml"?> -->
<?rfc include="reference.RFC.5869.xml"?>
<!-- <?rfc include="reference.RFC.6066.xml"?> -->
<!-- <?rfc include="reference.RFC.6806.xml"?> -->
<!-- <?rfc include="reference.RFC.6112.xml"?> -->
<?rfc include="reference.RFC.7250.xml"?>
<!-- <?rfc include="reference.RFC.7627.xml"?> -->
<?rfc include="reference.RFC.8446.xml"?>

</references>

<!-- <references title="Informative References"> -->

<!--
<reference anchor='DNSTXT-KRB1'>
<front>
<title abbrev="DNS TXT &quot;v=krb1&quot;">Finding the Kerberos Realm of a Service in DNS</title>
<author initials="R" surname="Van Rein" fullname="Rick van Rein">
<organization>ARPA2.net</organization>
<address>
<postal>
<street>Haarlebrink 5</street>
<city>Enschede</city>
<region>Overijssel</region>
<code>7544 WP</code>
<country>The Netherlands</country>
</postal>
<email>rick@openfortress.nl</email>
</address>
</author>
<date day="19" month="October" year="2014"/>
<abstract>
<t>This specification defines methods to determine realm names
for services being contacted by their DNS name.  Currently,
finding realm names is done through guessing or local configuration.
DNS can make this process more dynamic, provided that DNSSEC is used
to ensure authenticity of resource records.</t>
</abstract>
</front>
</reference>
-->

<!-- <?rfc include="reference.RFC.2712.xml"?> -->
<!-- <?rfc include="reference.RFC.3280.xml"?> -->
<!-- <?rfc include="reference.RFC.4422.xml"?> -->
<!-- <?rfc include="reference.RFC.4559.xml"?> -->
<!-- <?rfc include="reference.RFC.5280.xml"?> -->
<!-- <?rfc include="reference.RFC.5801.xml"?> -->
<!-- DTLS: <?rfc include="reference.RFC.6347.xml"?> -->
<!-- <?rfc include="reference.RFC.6698.xml"?> -->
<!-- <?rfc include="reference.RFC.6960.xml"?> -->
<!-- <?rfc include="reference.RFC.7542.xml"?> -->

<!-- </references> -->

<section title="Acknowledgements" anchor="ack">

<t>This specification could not have matured without the insights of various
commenters.  In order of appearance, we owe thanks to Simo Sorce,
Ilari Liusvaara, Watson Ladd, Benjamin Kaduk, Nikos Mavragiannopoulos,
Kenneth Raeburn.
<!-- now a co-author:
Special thanks go to Tom Vrancken for tracking the development of the
specification, commenting on it and implementing it in GnuTLS.--></t>

<t>Part of this work was conducted under a grant from the programme "[veilig] door
innovatie" from the government of the Netherlands.  It has also
been liberally supported by the NLnet Foundation.</t>

</section>

</back>

</rfc>
