<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
	<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
	<!ENTITY RFC6749 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6749.xml">
	<!ENTITY RFC7662 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7662.xml">
	<!ENTITY RFC7519 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7519.xml">
	<!ENTITY I-D.ietf-ace-oauth-authz SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-ace-oauth-authz.xml">

	<!ENTITY RFC6698 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6698.xml">
]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<?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-certificate-credential-00" ipr="trust200902">

	<front>
		<title abbrev="Abbreviated Title">Certificate credentials for ACE framework</title>

		<author fullname="Samuel Erdtman" initials="S.E." role="editor" surname="Erdtman">
			<organization></organization>
			<address>
				<postal>
					<street></street>
					<city></city>
					<region></region>
					<code></code>
					<country>SE</country>
				</postal>
				<phone>+46702691499</phone>
				<email>samuel@erdtman.se</email>
			</address>
		</author>

		<date year="2016" />

	    <area>Security</area>

	    <workgroup>ACE Working Group</workgroup>

		<keyword>ACE, DTLS, CoAP, Certificate, x509</keyword>

		<abstract>
			<t>This draft provides an example of how to extend the <xref target="I-D.ietf-ace-oauth-authz">ACE framework</xref>, to use client and server certificates (x509), for mutual authentication.  Certificate are used to establish the security context between the client and resource server.  This draft is limited to transport layer security based on DTLS and it does not consider the mixed case where e.g. only the server is authenticated with a certificate.</t>
		</abstract>
	</front>

	<middle>
		<section title="Introduction">
			<t>Certificates is the dominant way to secure TLS connections.  TLS is mostly used to establish the identity of the Server, by connecting the DNS name to the server certificate.  The client can optional be asked to provide its identity based on a certificate, but the common way is to establish the client/user identity on the application layer.  In IoT space the limitation of devices makes the mixed solution with application layer and transport layer security complex.  It is therefore common to do both client and server authentication on the same layer.</t>

			<t>This draft details on how the authorisation server can be leveraged to provide the trust anchors between client and resources server when setting up a connection.  The result is similar to DANE <xref target="RFC6698">RFC 6698</xref>, where the DNS server provides the trust anchor.</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="x5t" title="x5t and x5t#256">
			<t>The authorisation server is the common point in OAuth 2.0 with relation to both the client and the resource server.  It needs to have a way to communicate the certificate (x509) trust anchors to the client and the resource server.  Communication with the client is done with the Token endpoint where the client gets the token.  The resource server can either get the trust anchor information as part of a self contained token or as a new attribute from the introspection endpoint.</t>

			<t>For the transport of the two new attributes are defined, x5t and x5t#256.  These are defined and registered in the appropriate IANA registry</t>

			<t>The attributes are defined as in defined in  <xref target="RFC7519">RFC 7519</xref> a base64url encoded thumbprint of the x509 certificate. In this context the thumbprint is used to identify the client-, server-, issuer or root certificate of the server and the connecting client.  In cases where the transport is CBOR based the encoding of these parameters is CBOR byte string, without the base64url encoding.</t>

			<section anchor="CBORTypes" title="CBOR types">
				<t>Validation of the trust chain MUST be done according to PKIX [TODO insert reference] both on client and server side. With the exception that the traversing of the certificate chain stops when a certificate with the matching thumbprint is found.</t>
				
				<t>If the x5t value in a token is 88234efc198f455848fa728fbde3ce549be1e7b4, the server first validates the user certificate but does not stop there. It continues through the chain to the Issuer CA certificate where it finds a match to the thumbprint.  With the match it does not continue up to the Root CA. The x5t can be any of the certificates in the chain. How the client and resource sever obtains the chain is out of scope for this specification.</t>

				<figure align="center" anchor="certificateChainExample" title="Certificate chain example">
					<artwork align="left"><![CDATA[
- Root CA (x5t = c16aab9fe3288df0fb8fc1d24990a300b6b8f299)
 - Issuer CA (x5t = 88234efc198f455848fa728fbde3ce549be1e7b4)
  - Server/Client Cert (x5t = 10f7158b7813470820325004d4637f7287dc1f63)
]]></artwork>
				</figure>
			</section>

			<section anchor="CBORMapping " title="CBOR types">
				<t>When using CBOR encoding, values must be encoded with major type according to table.</t>
				<figure align="center" anchor="CBORMappingFigure" title="CWT CBOR key values">
					<artwork align="left"><![CDATA[
/--------------+-----------------------\
| Major Type   | Key                   |
|--------------+-----------------------|
| 2            | x5t                   |
| 2            | x5t#256               |
\--------------+-----------------------/
]]></artwork>
				</figure>
			</section>
		</section>

		<section anchor="IANAConsiderations" title="IANA Considerations">
			<t>This section contains registrations to the different registries where the parameters are be used.</t>

			<section anchor="tokenEndpoint" title="Token endpoint">
				<t>The x5t or x5t#256 parameter is included in the token request and returned in the token response. In the token response it is used to validate the server certificate provided in the DTLS handshake between client and resource server. In the token request it is to be included in the access token or the token introspection response. To aid the resource server in validating the client certificate in the DTLS handshake between client and resource server.</t>
				<t> 
					<?rfc subcompact="yes"?>
					<list style='symbols'>
						<t>Parameter name: <spanx style="verb">x5t</spanx></t>
						<t>Parameter usage location: token response and token request</t>
						<t>Change Controller: IESG</t>
						<t>Specification Document(s): this document</t>
					</list>
				</t>
				<t> 
					<?rfc subcompact="yes"?>
					<list style='symbols'>
						<t>Parameter name: <spanx style="verb">x5t#256</spanx></t>
						<t>Parameter usage location: token response and token request</t>
						<t>Change Controller: IESG</t>
						<t>Specification Document(s): this document</t>
					</list>
				</t>
				<section anchor="tokenEndpointCBORMappings" title="CBOR Mappings">
					<t>When token response is CBOR encoded according the the ACE framework the following key values MUST be used.</t>
					<t>TODO register values in ACE framework registry</t>
					<t> 
			          <?rfc subcompact="yes"?>
			          <list style='symbols'>
			            <t>Claim name: <spanx style="verb">x5t</spanx></t>
			            <t>CBOR key value: X</t>
			            <t>CBOR major type: 2</t>
			            <t>Change Controller: IESG</t>
			            <t>Specification Document(s): this document</t>
			          </list>
			        </t>
			        <t> 
			          <?rfc subcompact="yes"?>
			          <list style='symbols'>
			            <t>Claim name: <spanx style="verb">x5t#256</spanx></t>
			            <t>CBOR key value: Y</t>
			            <t>CBOR major type: 2</t>
			            <t>Change Controller: IESG</t>
			            <t>Specification Document(s): this document</t>
			          </list>
			        </t>
				</section>
			</section>
			<section anchor="JWTAndCWT" title="JWT and CWT">
				<t>When the x5t or x5t#256 parameter is included in the token it is used to validate the client certificate provided in the DTLS handshake.</t>
				<t> 
					<?rfc subcompact="yes"?>
					<list style='symbols'>
						<t>Claim Name: <spanx style="verb">x5t</spanx></t>
						<t>Claim Description: X.509 certificate SHA-1 thumbprint defined as in <xref target="RFC7519">RFC 7519</xref> but used to validate the client certificate provided in the DTLS handshake.</t>
						<t>Change Controller: IESG</t>
						<t>Specification Document(s): this document</t>
					</list>
				</t>
				<t> 
					<?rfc subcompact="yes"?>
					<list style='symbols'>
						<t>Claim Name: <spanx style="verb">x5t#S256</spanx></t>
						<t>Claim Description: X.509 certificate SHA-256 thumbprint defined as in <xref target="RFC7519">RFC 7519</xref> but used to validate the client certificate provided in the DTLS handshake.</t>
						<t>Change Controller: IESG</t>
						<t>Specification Document(s): this document</t>
					</list>
				</t>
				<section anchor="CWTCBORKeyRegistration" title="CWT CBOR key registration">
					<t>When encoded in a CWT following key values MUST be used.</t>
					<t>TODO register key values in CWT registry</t>
					<t> 
			          <?rfc subcompact="yes"?>
			          <list style='symbols'>
			            <t>Claim name: <spanx style="verb">x5t</spanx></t>
			            <t>CBOR key value: 8</t>
			            <t>CBOR major type: 2</t>
			            <t>Change Controller: IESG</t>
			            <t>Specification Document(s): this document</t>
			          </list>
			        </t>
			        <t> 
			          <?rfc subcompact="yes"?>
			          <list style='symbols'>
			            <t>Claim name: <spanx style="verb">x5t#256</spanx></t>
			            <t>CBOR key value: 9</t>
			            <t>CBOR major type: 2</t>
			            <t>Change Controller: IESG</t>
			            <t>Specification Document(s): this document</t>
			          </list>
			        </t>
				</section>
			</section>
			<section anchor="tokenIntrospection" title="Token Introspection">
				<t>When the x5t or x5t#256 parameter is returned in the introspection response it is used to validate the client certificate provided in the DTLS handshake.</t>
				<t> 
					<?rfc subcompact="yes"?>
					<list style='symbols'>
						<t>Name: <spanx style="verb">x5t</spanx></t>
						<t>Description: X.509 certificate SHA-1 thumbprint defined as in <xref target="RFC7519">RFC 7519</xref> but used to validate client certificate provided in the DTLS handshake.</t>
						<t>Change Controller: IESG</t>
						<t>Specification Document(s): this document</t>
					</list>
				</t>
				<t> 
					<?rfc subcompact="yes"?>
					<list style='symbols'>
						<t>Name: <spanx style="verb">x5t#S256</spanx></t>
						<t>Description: X.509 certificate SHA-256 thumbprint defined as in <xref target="RFC7519">RFC 7519</xref> but used to validate the client certificate provided in the DTLS handshake.</t>
						<t>Change Controller: IESG</t>
						<t>Specification Document(s): this document</t>
					</list>
				</t>
				<section anchor="tokenIntrospectionCBORMappings" title="CBOR Mappings">
					<t>When token response is CBOR encoded according the the ACE framework the following key values MUST be used.</t>
					<t>TODO register values in ACE framework registry</t>
					<t> 
			          <?rfc subcompact="yes"?>
			          <list style='symbols'>
			            <t>Claim name: <spanx style="verb">x5t</spanx></t>
			            <t>CBOR key value: X</t>
			            <t>CBOR major type: 2</t>
			            <t>Change Controller: IESG</t>
			            <t>Specification Document(s): this document</t>
			          </list>
			        </t>
			        <t> 
			          <?rfc subcompact="yes"?>
			          <list style='symbols'>
			            <t>Claim name: <spanx style="verb">x5t#256</spanx></t>
			            <t>CBOR key value: Y</t>
			            <t>CBOR major type: 2</t>
			            <t>Change Controller: IESG</t>
			            <t>Specification Document(s): this document</t>
			          </list>
			        </t>
				</section>
			</section>
		</section>

		<section anchor="Acknowledgements" title="Acknowledgements">
			<t>TBD</t>
		</section>

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

	<back>
		<references title="Normative References">
			&RFC6749;
			&RFC7662;
			&RFC7519;
			&RFC2119;
			&I-D.ietf-ace-oauth-authz;
		</references>

		<references title="Informative References">
			&RFC6698;
		</references>

		<section anchor="examples" title="Example">
			<t>This sections provides a non normative examples of the flow and the different connections</t>
			<t>TBD</t>
		</section>
	</back>
</rfc>
