<?xml version="1.0" encoding="US-ASCII"?>
<!-- change the "txt" on the previous line to "xml" to make this a valid XML2RFC template --> 
<!-- this is version 5 of this xml2rfc template -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC4210 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4210.xml">
<!ENTITY RFC6712 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6712.xml">
<!ENTITY RFC7252 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7252.xml">
<!ENTITY RFC7959 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7959.xml">
<!ENTITY RFC6347 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6347.xml">
<!ENTITY RFC8446 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8446.xml">
<!ENTITY RFC8323 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8323.xml">
<!ENTITY RFC5280 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5280.xml">
]>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc strict="no"?>
<?rfc rfcedstyle="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>

<rfc category="std" docName="draft-ietf-ace-cmpv2-coap-transport-00" ipr="trust200902">
  <front>

    <title abbrev="CoAP Transport for CMPV2">CoAP Transport for CMPV2</title>

    <author fullname="Mohit Sahni" initials="M" role="editor" surname="Sahni">
      <organization>Palo Alto Networks</organization>

      <address>
	<postal>
	<street>3000 Tannery Way</street>
	<city>Santa Clara</city>
	<region>CA</region>
	<code>95054</code>
	<country>US</country>
	</postal>
        <email>msahni@paloaltonetworks.com</email>
      </address>
    </author>
    <author fullname="Saurabh Tripathi" initials="S" role="editor" surname="Tripathi">
        <organization>Palo Alto Networks</organization>
  
        <address>
      <postal>
      <street>3000 Tannery Way</street>
      <city>Santa Clara</city>
      <region>CA</region>
      <code>95054</code>
      <country>US</country>
      </postal>
          <email>stripathi@paloaltonetworks.com</email>
        </address>
      </author>
    <!-- month and day will be generated automatically by XML2RFC; 
be sure the year is current.-->

    <date  year="2021" />

    <!-- IETF area is optional -->

    <area>Authentication and Authorization for Constrained Environments</area>

    <!--WG name at the upperleft corner of the doc, 
IETF is fine for non-WG IETF submissions -->

    <workgroup>ACE</workgroup>

    <!--add additional keywords here for IETF website search engine -->
<abstract>

	<t> 
   This document specifies the use of Constrained Application Protocol
   (CoAP) as a transport medium for the Certificate Management Protocol
	Version 2 (CMPv2) and <xref target="Lightweight-CMP-Profile">
	Lightweight CMP Profile</xref> CMPv2 defines the interaction between
   various PKI entities for the purpose of certificate creation and
   management.  CoAP is an HTTP like client-server protocol used by
   various constrained devices in IoT space.
   </t>

</abstract>
</front>

  <middle>
    <section title="Introduction" anchor="sect-1">
   <t>
 The CMPv2 is used by PKI entities for the generation and 
 management of the certificates. One of the requirements of CMPv2 
<xref target="RFC4210"/> is to be independent of the transport protocol in use. 
CMP has mechanisms to take care of required transactions, error reporting
   and encryption of messages. 
The CoAP defined in <xref target="RFC7252"/>, <xref target="RFC7959"/>
and <xref target="RFC8323"/> is a client-server protocol, like HTTP, 
that is designed to be used by constrained devices over constrained 
networks. The recommended transport for 
CoAP is UDP, however <xref target="RFC8323"/> specifies the support 
of CoAP over TCP, TLS and Websockets. This document specifies the use
 of CoAP as a transport medium for the CMPv2 and 
<xref target="Lightweight-CMP-Profile">Lightweight CMP Profile</xref>. 
This document, in general, follows the HTTP transport specifications 
for CMPv2 defined in <xref target="RFC6712"/> and specifies the 
additional requirements for CoAP transport. This document also 
provides guidance on how to use a "CoAP to HTTP" proxy for a better 
adaptation of CoAP transport without significant changes to the 
existing PKI entities. Although CoAP transport can be used for 
communication between Registration Authority (RA) and Certification 
Authority (CA) or between CAs, the scope of this document is for 
communication between End Entity (EE) and RA or EE and CA. 
This document is applicable only when the CoAP transport is being 
used for the CMPv2 transactions.

	    </t>
		<section title="Terminology">
		<t>
   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY",and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.
</t>
		</section>
    </section>
    <section title="CoAP Transport For CMPv2" anchor="sect-2"> 
	    <t>
		    CMPv2 transaction consists of passing PKIMesssage <xref target="RFC4210"/> between the PKI End Entities (EEs), Registration Authorities (RAs), and Certification Authorities (CAs). If the EEs are constrained devices then they will prefer, as a client, the use of CoAP instead of HTTP as a transport medium, while the RAs and CAs, in general, are not constrained and can support both CoAP and HTTP Client and Server implementation. This section specifes how to use CoAP as transport mechanism for CMPv2 or <xref target="Lightweight-CMP-Profile">Lightweight CMP Profile</xref>.

		</t>
		<section title="Discovery of CMP Entities" anchor="sect-2.1">
			<t>
				The information about the URIs of CA and RA that is required by EEs can be either configured out of band on EEs or the EEs can use the service discovery mechanism described in section 7 of <xref target="RFC7252"/> to find them. The EE, RA SHOULD support service discovery as described in section 7 of <xref target="RFC7252"/>. An EE MUST verify the configured Root CA certificate against the Root CA certificate of the discovered entity to make sure it is talking to correct endpoint.
			</t>
		</section>
	    <section title="CoAP URI Format" anchor="sect-2.2">
		    <t>
			    The CoAP URI MUST follow the guidelines defined in section 3.6 of <xref target="RFC6712"/> for CMPv2 protocol. Implementations supporting the <xref target="Lightweight-CMP-Profile">Lightweight CMP Profile</xref> MUST follow the guidelines specified for HTTP transport defined in section 7.1 of <xref target="Lightweight-CMP-Profile">Lightweight CMP Profile</xref>. The URI's for CoAP resources should start with coap:// instead of http:// and coaps:// instead of https://
		    </t>
    	</section>
	    <section title="CoAP Request Format" anchor="sect-2.3">
		    <t>
		    The CMPv2 PKIMessage MUST be DER encoded and sent as the body of the CoAP POST request. If the CoAP request is successful then the server should return a "2.05 Content" response code. If the CoAP request is not successful then an appropriate CoAP Client Error 4.xx or a Server Error 5.xx response code MUST be returned. 
		    </t>
            </section>
	    <section title="CoAP Content-Format" anchor="sect-2.4">
		    <t>
		    When transferring CMPv2 PKIMesssage over CoAP the media type application/pkixcmp MUST be used. 
		    </t>
            </section>
	    <section title="Announcement PKIMessage" anchor="sect-2.5">
		    <t>
			When using the CoAP protocol, a PKI EE SHOULD poll for the possible changes via PKI Information request using General Message defined in the PKIMessage for various type of changes like CA key update or to get current CRL to check revocation or using Support messages defined in section 5.4 of <xref target="Lightweight-CMP-Profile">Lightweight CMP Profile</xref>. This will help constrained devices acting as EEs save resources as there is no need to open a listening socket for notifications and it will also make the use of a CoAP to HTTP proxy transparent to the EE. 

		    </t>
            </section>
	    <section title="CoAP Block Wise Transfer Mode" anchor="sect-2.6">
		    <t>
		    Since the CMPv2 PKIMesssage consists of a header body and optional fields a CMPv2 message can be much larger than the MTU of the outgoing interface of the device. In order to avoid IP fragmentation of messages that are exchanged between EEs and RAs or CAs, the Block Wise transfer <xref target="RFC7959"/> mode MUST be used for the CMPv2 Transactions over CoAP. If a CoAP to HTTP proxy is in the path between EEs and CA or EEs and RA then, it MUST receive the entire body from the client before sending the HTTP request to the server. This will avoid unnecessary errors in case the entire content of the PKIMesssage is not received and Proxy opens a connection with the server. 
		    </t>
            </section>
	    <section title="Multicast CoAP" anchor="sect-2.7">
		    <t>
		    CMPv2 PKIMessage request messages sent from EEs to RAs or from EEs to CAs over CoAP transport MUST not use a Multicast destination address.
		    </t>
            </section>
    </section>
    <section title="Using CoAP over DTLS" anchor="sect-3">
	    <t>
		    Although CPMv2 protocol does not depend upon the underlying transport for the encryption and authentication of the messages but in cases when end to end secrecy is desired for the CoAP transport, CoAP over DTLS <xref target="RFC6347"/> as a transport medium SHOULD be used. Section 9.1 of <xref target="RFC7252"/> defines how to use DTLS <xref target="RFC6347"/> for securing the CoAP. For CMPv2 and <xref target="Lightweight-CMP-Profile">Lightweight CMP Profile</xref> the clients should follow specifications defined in section 7.1 and section 7.2 of <xref target="Lightweight-CMP-Profile">Lightweight CMP Profile</xref> for setting up DTLS <xref target="RFC6347"/> connection either using certificates or shared secret. Once a DTLS <xref target="RFC6347"/> connection is established it SHOULD be used for as long as possible to avoid the frequent overhead of using DTLS <xref target="RFC6347"/> connection for constrained devices.
	    </t>
    </section>
    <section title="Proxy support" anchor="sect-4">
	    <t>
	The use of a CoAP to HTTP proxy is recommended to avoid significant changes in the implementation of the CAs and RAs. However, if a proxy is in place then Announcements Messages cannot be passed to EEs efficiently. In case a CoAP to HTTP proxy is used for CMP transactions, it SHOULD support service discovery mentioned in section 2.1
	    </t>
    	<section title="CoAP to HTTP Proxy" anchor="sect-4.1">
		<t>
		If a CoAP to HTTP proxy is used then it MUST be positioned between EEs and RAs or between EEs and CAs when RA is not part of CMP transactions. The use of a CoAP to HTTP proxy between CAs and RAs is not recommended. The implementation of a CoAP to HTTP proxy is specified in Section 10 of <xref target="RFC7252"/>. The CoAP to HTTP proxy will also protect the CAs and RAs from UDP based Denial of Service attacks. 
	    </t>
    	</section>
    	<section title="CoAPs to HTTPs Proxy" anchor="sect-4.2">
		<t>
			A CoAPs to HTTPS proxy (DTLS <xref target="RFC6347"/> transport to TLS <xref target="RFC8446"/> transport proxy) can be used instead of the CoAP to HTTP proxy if the server support HTTPS protocol, however client SHOULD be configured to trust the CA certificate used by proxy to sign the Man in the Middle (MITM) certificate for certificate chain validation <xref target="RFC5280"/>.

	    </t>
    	</section>
    </section>
    <section title="Security Considerations" anchor="sect-5">
	    <t>
		The CMPv2 protocol itself does not require secure transport and depends upon various mechanisms in the protocol itself to make sure that the transactions are secure. However, the CoAP protocol which uses UDP as layer 4 transport is vulnerable to many issues due to the connectionless characteristics of UDP itself. The Security considerations for CoAP protocol are mentioned in the <xref target="RFC7252"/>. 
		Using a CoAP to HTTP proxy mitigates some of the risks as the requests from the EE's can terminate inside the trusted network and will not require the server to listen on a UDP port making it safe from UDP based address spoofing, Denial of Service, and amplification attacks due to the characteristics of UDP.  
	    </t>
    </section>
    <section title="IANA Considerations" anchor="sect-6">
	<t>
		This document requires a new entry to the CoAP Content-Formats Registry code for the content-type application/pkixcmp 
	</t>
    </section>

    <section title="Acknowledgments" anchor="sect-7">
	    <t>
		The author would like to thank Hendrik Brockhaus, David von Oheimb, and Andreas Kretschmer for their guidance in writing the content of this document and providing valuable feedback.
	</t>
    </section>
  </middle>

  <back>

    <!-- References Section -->

    <references title="Normative References">
	&RFC2119;
	&RFC8174;
	&RFC4210;
	&RFC6712;
	&RFC7252;
	&RFC7959;
	&RFC8323;
	&RFC5280;
</references>

    <references title="Informative References">
	
	&RFC6347;
	&RFC8446;
    </references>
    
    <references title="URL References">
<reference anchor="Lightweight-CMP-Profile" target="https://tools.ietf.org/html/draft-brockhaus-lamps-lightweight-cmp-profile-03">
	<front>
		<title>Lightweight CMP Profile</title>
   <author fullname="Hendrik Brockhaus" initials="H."
           surname="Brockhaus">
      <organization abbrev="Siemens">Siemens AG</organization>
      <address>
       <email>hendrik.brockhaus@siemens.com</email>
	   <uri>http://www.siemens.com/</uri>
      </address>
   </author>
   <author fullname="Steffen Fries" initials="S." surname="Fries">
	  <organization abbrev="Siemens">Siemens AG</organization>
      <address>
        <email>steffen.fries@siemens.com</email>
		<uri>http://www.siemens.com/</uri>
      </address>
    </author>
    <author fullname="David von Oheimb" initials="D." surname="von Oheimb">
	  <organization abbrev="Siemens">Siemens AG</organization>
      <address>
        <email>david.von.oheimb@siemens.com</email>
		<uri>http://www.siemens.com/</uri>
      </address>
	  </author>
    	<date year="2020"></date>
	</front>
</reference>			
</references>	
  </back>
</rfc>
