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

<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="info" docName="draft-erdtman-ace-rpcc-02" ipr="trust200902">
 <front>
   <title abbrev="draft-erdtman-ace-rpcc">
     Raw-Public-Key and Pre-Shared-Key as OAuth client credentials
   </title>

   <author fullname="Ludwig Seitz" initials="L." surname="Seitz">
     <organization>RISE SICS</organization>
     <address>
       <postal>
         <street>Scheelevaegen 17</street>
         <code>223 70</code> <city>Lund</city>
         <country>SWEDEN</country>
       </postal>
       <email>ludwig.seitz@ri.se</email>
     </address>
   </author>

   <author fullname="Samuel Erdtman" initials="S." surname="Erdtman">
     <organization>Spotify AB</organization>
     <address>
       <postal>
         <street>Birger Jarlsgatan 61, 4tr</street>
         <code>113 56</code> <city>Stockholm</city>
         <country>Sweden</country>
       </postal>
       <email>erdtman@spotify.com</email>
     </address>
   </author>

   <date year="2017" />

   <area>Security</area>

   <workgroup>ACE Working Group</workgroup>

   <keyword>
     OAuth 2.0, Client Credentials, DTLS, TLS, Raw-Public-Key, Pre-Shared-Key
   </keyword>

   <abstract>
     <t>
       This document describes Transport Layer Security (TLS)
       authentication using Raw-Public-Key and Pre-Shared-Key as new mechanisms
       for OAuth client authentication. Although defined for TLS the mechanisms
       are equally applicable for DTLS.
     </t>
   </abstract>
 </front>

 <middle>
   <section title="Introduction">
     <t>
       This document describes Transport Layer Security (TLS)
       authentication using Raw-Public-Key and Pre-Shared-Key as the mechanism
       for OAuth client authentication.  Examples of endpoint requiring client
       authentication are token and introspection.
     </t>
     <t>
       The OAuth 2.0 Authorization Framework <xref target="RFC6749"/> defines a
       shared secret method of client authentication but also allows for the
       definition and use of additional client authentication mechanisms when
       interacting with the authorization server's token endpoint. This document
       describes two additional mechanisms of client authentication utilizing
       Raw-Public-Key <xref target="RFC7250"/> and Pre-Shared-Key TLS
       <xref target="RFC4279"/>, which provide better security characteristics
       than shared secrets.
     </t>
     <t>
       To get most bennefits and improved security with these new client
       credential types it is recomended to use the 'one credential per Client
       Software Instance' paradigm. This can be achived by letting the client
       dynamicly register as described in <xref target="RFC7591"/>.
     </t>
     <section title="Requirements Language">
       <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
       "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
       document are to be interpreted as described in <xref
       target="RFC2119">RFC 2119</xref>.</t>
     </section>
   </section>

   <section anchor="pskClientAuth" title="Pre-Shared-Key for Client Authentication">
     <t>
       The following section defines, as an extension of
       <xref target="RFC6749">OAuth 2.0, Section 2.3</xref>, using
       Pre-Shared-Key with TLS <xref target="RFC4279"/> to authenticate
       the client.  This method is registered as 'tls_client_psk' in "OAuth
       Token Endpoint Authentication Methods" registry. If this method is
       to be used, the client and the Authorization Server MUST share a secret
       key, and they MUST agree on an identifier for this key.
     </t>
     <t>
       The (D)TLS handshake MUST be done according to <xref target="RFC4279" />,
       with the client indicating support for one or more Pre-Shared-Key cipher
       suites and authorization server selecting a Pre-Shared-Key cipher suite.
       In order to enable the authorization server to select the correct
       pre-shared-key the client MUST send the key identifier in the
       psk-identity field of the ClientKeyExchange message. How the
       authorization server maps the identifier to a pre-shared-key, and
       to a specific client is out of scope for this specification.
     </t>
     <t>
       Note that the key identifier MUST be 2^16 bytes or shorter, in order
       to fit into the psk-identity field.
     </t>
   </section>

   <section anchor="rpkClientAuth" title="Raw-Public-Key for Client Authentication">
     <t>
       The following section defines, as an extension of
       <xref target="RFC6749">OAuth 2.0, Section 2.3</xref>, the use of
       Raw-Public-Key with (D)TLS <xref target="RFC7250"/> to authenticate
       the client. This method is registered as 'tls_client_rpk' in "OAuth Token
       Endpoint Authentication Methods" registry.
     </t>
     <t>
       The (D)TLS handshake MUST be done according to <xref target="RFC7250"/>,
       with the client indicating support for Raw-Public-Key certificates and
       the authorization server asking client send its Raw Public Key
       certificate.  Since the client cannot send an explicit client or key
       identifier in the handshake, the authorization server MUST derive a
       client identifier from RPK that the client uses.
     </t>
     <t>
       Note to implementers: Authorization servers can use the following method
       to map a Raw Public Key to a client identifier: The client identifier is
       generated from the Raw Public Key using the procedure specified in <xref
       target="RFC6920">section 3 of</xref>.  The digest is calculated on the
       Raw Public Key only (not on the SubjectPublicKeyInfo used in the
       handshake).

       An example is shown in <xref target="fig:knightsOfNi"/>.

       <figure align="center" anchor="fig:knightsOfNi"
               title="Example encoding of a raw public key in the Named
                      Information URI Format">
         <artwork align="left"><![CDATA[
         Raw Public Key (Base64 encoded):
         MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEtboxNKPgxEKV9JTNzy
         tUvAbxEfkCTVB9kOzheF5wRAoOz2NKP+ln+XLVAQSp1D6jfo09tppvN
         poQA1nnBNH6A==";

         Encoding:
         ni:///sha-256;xzLa24yOBeCkos3VFzD2gd83Urohr9TsXqY9nhdDN0
         ]]></artwork>
       </figure>
     </t>
   </section>
   <section anchor="dynReg" title="Dynamic Registration">
     <t>
       For dynamic registration of a RPK this specification registers the new
       parameter 'rpk' to the Client Registration Metadata Registry. When used
       this parameter MUST contain a JSON Web Key representing the public key
       of the client. When 'rpk' is present in the registration request
       'token_endpoint_auth_method' MUST include 'tls_client_rpk'.
     </t>
     <t>
       For dynamic registration of a PSK this specification registers the new
       parameter 'psk' to the Client Registration Metadata Registry.  When used
       this parameter MUST contain a JSON Web Key representing the key of the
       client.  When registering the client can include the key in the
       registrations request or the authorisation can generate the key and
       return it.  If the 'psk' attribute is present in a request
       'token_endpoint_auth_method' MUST include 'tls_client_psk'.  To request
       the authorisation server to generate the key the client includes
       'tls_client_psk' in 'token_endpoint_auth_method' but does not send 'psk'
       attribute.
     </t>
     <t>
      The 'jwks' and 'jwks_uri' is not used to avoid conflict and confusion
      with application layer keys.
     </t>
   </section>

   <section anchor="Acknowledgements" title="Acknowledgements">
     <t>
       This document is highly inspired by <xref target="I-D.ietf-oauth-mtls"/>
       written by B. Campbell, J. Bradley, N. Sakimura and T. Lodderstedt.
     </t>
   </section>

   <section anchor="IANA" title="IANA Considerations">
     <section anchor="tls_metadataIANA" title="OAuth Dynamic Client Registration Metadata Registration">
     <t>
       This specification requests registration of the following value
       in the IANA "OAuth Dynamic Client Registration Metadata" registry
       <xref target="IANA.OAuth.Parameters"/> established by <xref target="RFC7591"/>.
     </t>
      <section title="Registry Contents">
       <t>
         <?rfc subcompact="yes"?>
         <list style='symbols'>
           <t>Client Metadata Name: <spanx style="verb">rpk</spanx></t>
           <t>Client Metadata Description: JWK for client Raw-Public-Key, can
             be included in request.</t>
           <t>Change Controller: IESG</t>
           <t>Specification Document(s): [[ this specification ]]</t>
         </list>
         <?rfc subcompact="no"?>
       </t>
       <t>
         <?rfc subcompact="yes"?>
         <list style='symbols'>
           <t>Client Metadata Name: <spanx style="verb">psk</spanx></t>
           <t>Client Metadata Description: JWK for client Pre-Shared-Key, can
             be included both in request and response.</t>
           <t>Change Controller: IESG</t>
           <t>Specification Document(s): [[ this specification ]]</t>
         </list>
         <?rfc subcompact="no"?>
       </t>
      </section>
     </section>
     <section anchor="tls_client_authIANA" title="Token Endpoint Authentication Method Registration">
     <t>
       This specification requests registration of the following value
       in the IANA "OAuth Token Endpoint Authentication Methods" registry
       <xref target="IANA.OAuth.Parameters"/> established by <xref target="RFC7591"/>.
     </t>
       <section title="Registry Contents">
         <t>
           <?rfc subcompact="yes"?>
           <list style='symbols'>
             <t>Token Endpoint Authentication Method Name: <spanx style="verb">tls_client_rpk</spanx></t>
             <t>Change Controller: IESG</t>
             <t>Specification Document(s): [[ this specification ]]</t>
           </list>
           <?rfc subcompact="no"?>
         </t>
         <t>
           <?rfc subcompact="yes"?>
           <list style='symbols'>
             <t>Token Endpoint Authentication Method Name: <spanx style="verb">tls_client_psk</spanx></t>
             <t>Change Controller: IESG</t>
             <t>Specification Document(s): [[ this specification ]]</t>
           </list>
           <?rfc subcompact="no"?>
         </t>
       </section>
     </section>
   </section>

   <section anchor="Security" title="Security Considerations">
     <t>TBD</t>
   </section>
 </middle>

 <back>
   <references title="Normative References">
     <?rfc include='reference.RFC.2119'?>
     <?rfc include='reference.RFC.4279'?>
     <?rfc include='reference.RFC.6749'?>
     <?rfc include='reference.RFC.6920'?>
     <?rfc include='reference.RFC.7250'?>
     <?rfc include='reference.RFC.7591'?>
   </references>

   <references title="Informative References">
     <?rfc include='reference.I-D.ietf-oauth-mtls'?>

     <reference anchor="IANA.OAuth.Parameters" target="http://www.iana.org/assignments/oauth-parameters">
       <front>
         <title>OAuth Parameters</title>
         <author>
           <organization>IANA</organization>
         </author>
         <date/>
       </front>
     </reference>
   </references>
 </back>
</rfc>
