ACE                                                      P. van der Stok
Internet-Draft                                                Consultant
Intended status: Standards Track                           P. Kampanakis
Expires: April 11, 2019                                    Cisco Systems
                                                                S. Kumar
                                               Philips Lighting Research
                                                           M. Richardson
                                                              M. Furuhed
                                                             Nexus Group
                                                                 S. Raza
                                                               RISE SICS
                                                         October 8, 2018

                    EST over secure CoAP (EST-coaps)


   Enrollment over Secure Transport (EST) is used as a certificate
   provisioning protocol over HTTPS.  Low-resource devices often use the
   lightweight Constrained Application Protocol (CoAP) for message
   exchanges.  This document defines how to transport EST payloads over
   secure CoAP (EST-coaps), which allows low-resource constrained
   devices to use existing EST functionality for provisioning

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on April 11, 2019.

van der Stok, et al.     Expires April 11, 2019                 [Page 1]

Internet-Draft                  EST-coaps                   October 2018

Copyright Notice

   Copyright (c) 2018 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   ( in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Change Log  . . . . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   4
   3.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .   5
   4.  Conformance to RFC7925 profiles . . . . . . . . . . . . . . .   5
   5.  Protocol Design . . . . . . . . . . . . . . . . . . . . . . .   6
     5.1.  Mandatory/optional EST Functions  . . . . . . . . . . . .   7
     5.2.  Payload format  . . . . . . . . . . . . . . . . . . . . .   7
       5.2.1.  Content Format application/multipart-core . . . . . .   8
     5.3.  Message Bindings  . . . . . . . . . . . . . . . . . . . .   8
     5.4.  CoAP response codes . . . . . . . . . . . . . . . . . . .   9
     5.5.  Delayed Responses . . . . . . . . . . . . . . . . . . . .   9
     5.6.  Server-side Key Generation  . . . . . . . . . . . . . . .  11
     5.7.  Message fragmentation . . . . . . . . . . . . . . . . . .  12
     5.8.  Deployment limits . . . . . . . . . . . . . . . . . . . .  13
   6.  Discovery and URI . . . . . . . . . . . . . . . . . . . . . .  13
   7.  DTLS Transport Protocol . . . . . . . . . . . . . . . . . . .  15
   8.  HTTPS-CoAPS Registrar . . . . . . . . . . . . . . . . . . . .  17
   9.  Parameters  . . . . . . . . . . . . . . . . . . . . . . . . .  19
   10. IANA Considerations . . . . . . . . . . . . . . . . . . . . .  20
     10.1.  Content-Format Registry  . . . . . . . . . . . . . . . .  20
     10.2.  Resource Type registry . . . . . . . . . . . . . . . . .  20
   11. Security Considerations . . . . . . . . . . . . . . . . . . .  21
     11.1.  EST server considerations  . . . . . . . . . . . . . . .  21
     11.2.  HTTPS-CoAPS Registrar considerations . . . . . . . . . .  22
   12. Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .  22
   13. References  . . . . . . . . . . . . . . . . . . . . . . . . .  23
     13.1.  Normative References . . . . . . . . . . . . . . . . . .  23
     13.2.  Informative References . . . . . . . . . . . . . . . . .  24
   Appendix A.  EST messages to EST-coaps  . . . . . . . . . . . . .  26
     A.1.  cacerts . . . . . . . . . . . . . . . . . . . . . . . . .  26
     A.2.  csrattrs  . . . . . . . . . . . . . . . . . . . . . . . .  31

van der Stok, et al.     Expires April 11, 2019                 [Page 2]

Internet-Draft                  EST-coaps                   October 2018

     A.3.  enroll / reenroll . . . . . . . . . . . . . . . . . . . .  31
     A.4.  serverkeygen  . . . . . . . . . . . . . . . . . . . . . .  33
   Appendix B.  EST-coaps Block message examples . . . . . . . . . .  35
     B.1.  cacerts block example . . . . . . . . . . . . . . . . . .  35
     B.2.  enroll block example  . . . . . . . . . . . . . . . . . .  38
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  39

1.  Change Log

   EDNOTE: Remove this section before publication


      clarified discovery section, by specifying that no discovery may
      be needed for /.well-known/est URI.

      added resource type values for IANA

      added list of compulsory to implement and optional functions.

      Fixed issues pointed out by the idnits tool.

      Updated COAP response codes section with more mappings between EST
      HTTP codes and EST-coaps COAP codes.

      Minor updates to the MTI EST Functions section.

      Moved Change Log section higher.


      repaired again

      TBD8 removed from C-F registration, to be done in CT draft.


      Updated Delayed response section to reflect short and long delay


      Removed observe and simplified long waits

      Repaired content-format specification


van der Stok, et al.     Expires April 11, 2019                 [Page 3]

Internet-Draft                  EST-coaps                   October 2018

      Added parameter discussion in section 8

      Concluded content-format specification using multipart-ct draft

      examples updated


      Editorials done.

      Redefinition of proxy to Registrar in Section 8.  Explained better
      the role of https-coaps Registrar, instead of "proxy"

      Provide "observe" option examples

      extended block message example.

      inserted new server key generation text in Section 5.6 and
      motivated server key generation.

      Broke down details for DTLS 1.3

      New media type uses CBOR array for multiple content-format

      provided new content format tables

      new media format for IANA


      copied from vanderstok-ace-coap-04

2.  Introduction

   "Classical" Enrollment over Secure Transport (EST) [RFC7030] is used
   for authenticated/authorized endpoint certificate enrollment (and
   optionally key provisioning) through a Certificate Authority (CA) or
   Registration Authority (RA).  EST messages run over HTTPS.

   This document defines a new transport for EST based on the
   Constrained Application Protocol (CoAP) since some Internet of Things
   (IoT) devices use CoAP instead of HTTP.  Therefore, this
   specification utilizes DTLS [RFC6347], CoAP [RFC7252], and UDP
   instead of TLS [RFC8446], HTTP [RFC7230] and TCP.

van der Stok, et al.     Expires April 11, 2019                 [Page 4]

Internet-Draft                  EST-coaps                   October 2018

   EST messages may be relatively large and for this reason this
   document also uses CoAP Block-Wise Transfer [RFC7959] to offer a
   fragmentation mechanism of EST messages at the CoAP layer.

   This specification also profiles the use of EST to only support
   certificate-based client Authentication.  HTTP Basic or Digest
   authentication (as described in Section 3.2.3 of [RFC7030] are not

3.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   document are to be interpreted as described in [RFC2119].

   Many of the concepts in this document are taken over from [RFC7030].
   Consequently, much text is directly traceable to [RFC7030].  The same
   document structure is followed to point out the differences and
   commonalities between EST and EST-coaps.

4.  Conformance to RFC7925 profiles

   This section shows how EST-coaps fits into the profiles of low-
   resource devices described in [RFC7925].

   EST-coaps can transport certificates and private keys.  Certificates
   are responses to (re-)enrollment requests or request for a trusted
   certificate list.  Private keys can be transported as responses to a
   request to a server-side keygeneration as described in section 4.4 of
   [RFC7030] and discussed in Section 5.6 of this document.

   As per [RFC7925] section 3.3 and section 4.4, the mandatory cipher
   suite for DTLS in EST-coaps is TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
   defined in [RFC7251], and the curve secp256r1 MUST be supported
   [RFC8422]; this curve is equivalent to the NIST P-256 curve.  Crypto
   agility is important, and the recommendations in [RFC7925] section
   4.4 and any updates to RFC7925 concerning Curve25519 and other CFRG
   curves also apply.

   DTLS1.2 implementations MUST use the Supported Elliptic Curves and
   Supported Point Formats Extensions [RFC8422].  Uncompressed point
   format MUST also be supported.  [RFC6090] can be used as summary of
   the ECC algorithms.  DTLS 1.3 implementations differ from DTLS 1.2
   because they do not support point format negotiation in favor of a
   single point format for each curve and thus support for DTLS 1.3 does
   not mandate point formation extensions and negotiation.

van der Stok, et al.     Expires April 11, 2019                 [Page 5]

Internet-Draft                  EST-coaps                   October 2018

   The EST-coaps client MUST be configured with at least an implicit TA
   database from its manufacturer.  The authentication of the EST-coaps
   server by the EST-coaps client is based on certificate authentication
   in the DTLS handshake.

   The authentication of the EST-coaps client is based on a client
   certificate in the DTLS handshake.  This can either be

   o  a previously issued client certificate (e.g., an existing
      certificate issued by the EST CA); this could be a common case for
      simple reenrollment of clients;

   o  a previously installed certificate (e.g., manufacturer-installed
      certificate or a certificate issued by some other party); the
      server is expected to trust the manufacturer's root CA certificate
      in this case.

5.  Protocol Design

   EST-coaps uses CoAP to transfer EST messages, aided by Block-Wise
   Transfer [RFC7959] to transport CoAP messages in blocks thus avoiding
   (excessive) fragmentation of UDP datagrams.  The use of "Block" for
   the transfer of larger EST messages is specified in Section 5.7.  The
   Figure 1 below shows the layered EST-coaps architecture.

   |    EST request/response messages               |
   |    CoAP for message transfer and signalling    |
   |    DTLS for transport security                 |
   |    UDP for transport                           |

                    Figure 1: EST-coaps protocol layers

   The EST-coaps protocol design follows closely the EST design.  The
   actions supported by EST-coaps are identified by their message types:

   o  CA certificate retrieval, needed to receive the complete set of CA

   o  Simple enroll and reenroll, for CA to sign public client-identity

   o  Certificate Signing Request (CSR) Attributes request messages,
      informs the client of the fields to include in generated CSR.

van der Stok, et al.     Expires April 11, 2019                 [Page 6]

Internet-Draft                  EST-coaps                   October 2018

   o  Server-side key generation messages, to provide a private client-
      identity key when the client choses for an external entity to
      generate its private key.

5.1.  Mandatory/optional EST Functions

   This specification contains a set of required-to-implement functions,
   optional functions, and not specified functions.  The latter ones are
   deemed too expensive for low-resource devices in payload and
   calculation times.

   Table 1 specifies the mandatory-to-implement or optional
   implementation of the est-coaps functions.

              | EST Functions    | EST-coaps implementation |
              | /cacerts         | Mandatory                |
              | /simpleenroll    | Mandatory                |
              | /simplereenroll  | Mandatory                |
              | /fullcmc         | Not specified            |
              | /serverkeygen    | Optional                 |
              | /csrattrs        | Optional                 |

                   Table 1: list of EST -coaps fuctions

5.2.  Payload format

   The content-format (media type equivalent) of the CoAP message
   determines which EST message is transported in the CoAP payload.  The
   media types specified in the HTTP Content-Type header (section 3.2.2
   of [RFC7030]) are in EST-coaps specified by the Content-Format Option
   (12) of CoAP.  The combination of URI path and content-format used
   for CoAP MUST map to an allowed combination of URI and media type as
   defined for EST.  The required content-formats for these requests and
   response messages are defined in Section 10.  The CoAP response codes
   are defined in Section 5.4.

   EST-coaps is designed for use between low-resource devices and hence
   does not need to send base64-encoded data.  Simple binary is more
   efficient (30% smaller payload) and well supported by CoAP.

   The payload for a given media type follows the ASN.1 structure of the
   media-type and is transported as straight binary coding instead of
   the base64-encoded.  The binary is wrapped in a CBOR major type 2
   using h'xxx' notation (to assure compatibility with multipart).

van der Stok, et al.     Expires April 11, 2019                 [Page 7]

Internet-Draft                  EST-coaps                   October 2018

   EDNote: suggestion to remove CBOR wrapping for not multipart.

   In the examples of Appendix A, the base16 diagnostic notation is used
   for CBOR major type 2, where h'450aafbb' represents an example binary
   payload.  The content formats specification in Section 5.2.1
   specifies the payload structure when multiple media types are present
   in the payload.

5.2.1.  Content Format application/multipart-core

   A representation with content format ID TBD8 contains a collection of
   representations along with their respective content format.  The
   content-format identifies the media-type application/multipart-core
   specified in [I-D.ietf-core-multipart-ct].

   The collection is encoded as a CBOR array [RFC7049] with an even
   number of elements.  The second, fourth, sixth, etc. element is a
   binary string containing a representation.  The first, third, fifth,
   etc. element is an unsigned integer specifying the content format ID
   of the following representation.

   For example, a collection containing two representations in response
   to a server-side key generation, could include a private key in
   PKCS#8 with content format ID 284 and a certificate with content
   format ID 281, looks like this in diagnostic CBOR notation:
   [284,h'0123456789abcdef',281,h'fedcba9876543210'].  The PKCS#8 key
   and the X.509 certificate representations will be ASN.1 encoded in
   binary format.  An example is shown in Appendix A.4.

5.3.  Message Bindings

   The general EST CoAP message characteristics are:

   o  All EST-coaps messages expect a response from the server, thus the
      client MUST send the requests over confirmable CON COAP messages.

   o  The Ver, TKL, Token, and Message ID values of the CoAP header are
      not affected by EST.

   o  The CoAP options used are Uri-Host, Uri-Path, Uri-Port, Content-
      Format, and Location-Path in CoAP.  These CoAP Options are used to
      communicate the HTTP fields specified in the EST REST messages.

   o  EST URLs are HTTPS based (https://), in CoAP these will be assumed
      to be transformed to coaps (coaps://)

   Appendix A includes some practical examples of EST messages
   translated to CoAP.

van der Stok, et al.     Expires April 11, 2019                 [Page 8]

Internet-Draft                  EST-coaps                   October 2018

5.4.  CoAP response codes

   Section 5.9 of [RFC7252] specifies the mapping of HTTP response codes
   to CoAP response codes.  Every time the HTTP response code 200 is
   specified in [RFC7030] in response to a GET request, in EST-coaps the
   equivalent CoAP response code 2.05 or 2.03 MUST be used.  Similarly,
   2.01, 2.02 or 2.04 MUST be used in response to POST EST requests.
   Response code HTTP 202 has no equivalent in CoAP.  Section 5.5
   specifies how EST requests over CoAP handle delayed messages.

   Other HTTP response codes EST makes use of, are 204 and 404 when a
   resource is not available for the client.  The equivalent COAP error
   code to use in an EST-coaps response is 4.04.  Additionally, EST's
   401 error translates to 4.01 in EST-coaps.  Other HTTP error messages
   commonly used in EST are 400, 423 and 503.  Their equivalent COAP
   errors are 4.00, 4.03 and 5.03 respectively.

5.5.  Delayed Responses

   Appendix B.2 shows an example of a server response that comes
   immediately after a client request.  The example shows the flows of
   blocks as the large messages require fragmentation.  But server
   responses can sometimes be delayed.

   According to section 5.2.2 of [RFC7252], a slow server can
   acknowledge the request and respond later with the requested resource
   representation.  In particular, a slow server can respond to a enroll
   request with an empty ACK with code 0.00, before sending the
   certificate to the server after a short delay.  Consecutively, the
   server will need more than one "Block2" blocks to respond if the
   certificate is large.  This situation is shown in Figure 2 where a
   client sends an enrollment request that uses more than one "Block1"
   blocks.  The server uses an empty 0.00 ACK to announce the response
   which will be provided later with 2.04 messages containing "Block2"
   options.  Having received the first 128 bytes in the first "block2"
   block, the client asks for a block reduction to 128 bytes in all
   following "block2" blocks, starting with the second block (NUM=1).

van der Stok, et al.     Expires April 11, 2019                 [Page 9]

Internet-Draft                  EST-coaps                   October 2018

   POST [2001:db8::2:1]:61616/est/sen (CON)(1:0/1/256) {CSR req} -->
          <-- (ACK) (1:0/1/256) (2.31 Continue)
   POST [2001:db8::2:1]:61616/est/sen (CON)(1:1/1/256) {CSR req} -->
          <-- (ACK) (1:1/1/256) (2.31 Continue)
   POST [2001:db8::2:1]:61616/est/sen (CON)(1:N1/0/256){CSR req} -->
          <-- (0.00 empty ACK)
          ...... short delay before certificate is ready.......
         <-- (CON) (1:N1/0/256)(2:0/1/256)(2.04 Changed) {Cert resp}
             (ACK)                                              -->
   POST [2001:db8::2:1]:61616/est/sen (CON)(2:1/0/128)          -->
          <-- (ACK) (2:1/1/128) (2.04 Changed) {Cert resp}
   POST [2001:db8::2:1]:61616/est/sen (CON)(2:N2/0/128)          -->
          <-- (ACK) (2:N2/0/128) (2.04 Changed) {Cert resp}

               Figure 2: EST-COAP enrolment with short wait

   If the server is very slow providing the response (say minutes,
   possible when a manual intervention is wanted), the server SHOULD
   respond with an ACK containing response code 5.03 (Service
   unavailable) and a Max-Age option to indicate the time the client
   SHOULD wait to request the content later.  After a delay of Max-Age,
   the client SHOULD resend the identical CSR to the server.  As long as
   the server responds with response code 5.03 (Service Unavailable),
   the client can resend the enrolment request until the server responds
   with the certificate or the client abandons for other reasons.

   To demonstrate this situation, Figure 3 shows a client sending an
   enrolment request that will use more than one "Block1" block to send
   the CSR to the server.  The server needs more than one "Block2"
   blocks to respond, but also needs to take a long delay (minutes) to
   provide the response.  Consequently, the server will use a 5.03 ACK
   for the response.  The client can be requested to wait multiple times
   for a period of Max-Age. Note that in the example below the server
   asks for a decrease in the block size when acknowledging the first

   Figure 5 can be compared with Figure 3 to see the extra requests
   after a Max-Age wait.

van der Stok, et al.     Expires April 11, 2019                [Page 10]

Internet-Draft                  EST-coaps                   October 2018

   POST [2001:db8::2:1]:61616/est/sen (CON)(1:0/1/256) {CSR req} -->
          <-- (ACK) (1:0/1/256) (2.31 Continue)
   POST [2001:db8::2:1]:61616/est/sen (CON)(1:1/1/256) {CSR req} -->
          <-- (ACK) (1:1/1/256) (2.31 Continue)
   POST [2001:db8::2:1]:61616/est/sen (CON)(1:N1/0/256){CSR req} -->
        <-- (ACK) (1:N1/0/256) (2:0/0/128) (5.03 Service Unavailable)
   Client tries one or more times after Max-Age with identical payload
   POST [2001:db8::2:1]:61616/est/sen (CON)(1:N1/0/256){CSR req} -->
        <-- (ACK) (1:N1/0/256) (2:0/1/128) (2.04 Changed){Cert resp}
   POST [2001:db8::2:1]:61616/est/sen (CON)(2:1/0/128)           -->
        <-- (ACK) (2:1/1/128) (2.04 Changed) {Cert resp}
   POST [2001:db8::2:1]:61616/est/sen (CON)(2:N2/0/128)          -->
          <-- (ACK) (2:N2/0/128) (2.04 Changed) {Cert resp}

                Figure 3: EST-COAP enrolment with long wait

5.6.  Server-side Key Generation

   Constrained devices sometimes do not have the necessary hardware to
   generate statistically random numbers for private keys and DTLS
   ephemeral keys.  Past experience has shown that low-resource
   endpoints sometimes generate numbers which could allow someone to
   decrypt the communication or guess the private key and impersonate as
   the device.  Studies have shown that the same keys are generated by
   the same model devices deployed on-line.

   EDNote: Is there a reference for these studies?

   Additionally, random number key generation is costly, thus energy
   draining.  Even though the random numbers that constitute the
   identity/cert do not get generated often, an endpoint may not want to
   spend time and energy generating keypairs, and just ask for one from
   the server.

   In these scenarios, server-side key generation can be used.  The
   client asks for the server or proxy to generate the private key and

van der Stok, et al.     Expires April 11, 2019                [Page 11]

Internet-Draft                  EST-coaps                   October 2018

   the certificate which is transferred back to the client in the
   server-side key generation response.

   [RFC7030] recommends for the private key returned by the server to be
   encrypted.  The specification provides two methods to encrypt the
   generated key, symmetric and asymmetric.  The methods are signalled
   by the client by using the relevant attributes (SMIMECapabilities and
   DecryptKeyIdentifier or AsymmetricDecryptKeyIdentifier) in the CSR
   request.  In the symmetric key case, the key can be established out-
   of-band or alternatively derived by the established TLS connection as
   described in [RFC5705].

   The sever-side key generation response is returned using a CBOR array
   Section 5.2.1.  The certificate part exactly matches the response
   from an enrollment response.  The private key is placed inside of a
   CMS SignedData.  The SignedData is signed by the party that generated
   the private key, which may or may not be the EST server or the EST
   CA.  The SignedData is further protected by placing it inside of a
   CMS EnvelopedData as explained in Section 4.4.2 of [RFC7030].

5.7.  Message fragmentation

   DTLS defines fragmentation only for the handshake part and not for
   secure data exchange (DTLS records).  [RFC6347] states that to avoid
   using IP fragmentation, which involves error-prone datagram
   reconstitution, invokers of the DTLS record layer SHOULD size DTLS
   records so that they fit within any Path MTU estimates obtained from
   the record layer.  In addition, invokers residing on a 6LoWPAN over
   IEEE 802.15.4 network SHOULD attempt to size CoAP messages such that
   each DTLS record will fit within one or two IEEE 802.15.4 frames.

   That is not always possible.  Even though ECC certificates are small
   in size, they can vary greatly based on signature algorithms, key
   sizes, and OID fields used.  For 256-bit curves, common ECDSA cert
   sizes are 500-1000 bytes which could fluctuate further based on the
   algorithms, OIDs, SANs and cert fields.  For 384-bit curves, ECDSA
   certs increase in size and can sometimes reach 1.5KB.  Additionally,
   there are times when the EST cacerts response from the server can
   include multiple certs that amount to large payloads.  Section 4.6 of
   CoAP [RFC7252] describes the possible payload sizes: "if nothing is
   known about the size of the headers, good upper bounds are 1152 bytes
   for the message size and 1024 bytes for the payload size".
   Section 4.6 of [RFC7252] also suggests that IPv4 implementations may
   want to limit themselves to more conservative IPv4 datagram sizes
   such as 576 bytes.  From [RFC0791] follows that the absolute minimum
   value of the IP MTU for IPv4 is as low as 68 bytes, which would leave
   only 40 bytes minus security overhead for a UDP payload.  Thus, even
   with ECC certs, EST-coaps messages can still exceed sizes in MTU of

van der Stok, et al.     Expires April 11, 2019                [Page 12]

Internet-Draft                  EST-coaps                   October 2018

   1280 for IPv6 or 60-80 bytes for 6LoWPAN [RFC4919] as explained in
   section 2 of [RFC7959].  EST-coaps needs to be able to fragment EST
   messages into multiple DTLS datagrams.  Fine-grained fragmentation of
   EST messages is essential.

   To perform fragmentation in CoAP, [RFC7959] specifies the "Block1"
   option for fragmentation of the request payload and the "Block2"
   option for fragmentation of the return payload of a CoAP flow.

   The BLOCK draft defines SZX in the Block1 and Block2 option fields.
   These are used to convey the size of the blocks in the requests or

   The CoAP client MAY specify the Block1 size and MAY also specify the
   Block2 size.  The CoAP server MAY specify the Block2 size, but not
   the Block1 size.  As explained in Section 1 of [RFC7959]), blockwise
   transfers SHOULD be used in Confirmable CoAP messages to avoid the
   exacerbation of lost blocks.

   The Size1 response MAY be parsed by the client as a size indication
   of the Block2 resource in the server response or by the server as a
   request for a size estimate by the client.  Similarly, Size2 option
   defined in BLOCK should be parsed by the server as an indication of
   the size of the resource carried in Block1 options and by the client
   as a maximum size expected in the 4.13 (Request Entity Too Large)
   response to a request.

   Examples of fragmented messages are shown in Appendix B.

5.8.  Deployment limits

   Although EST-coaps paves the way for the utilization of EST for
   constrained devices on constrained networks, some devices will not
   have enough resources to handle the large payloads that come with
   EST-coaps.  The specification of EST-coaps is intended to ensure that
   EST works for networks of constrained devices that choose to limit
   their communications stack to UDP/CoAP.  It is up to the network
   designer to decide which devices execute the EST protocol and which
   do not.

6.  Discovery and URI

   EST-coaps is targeted to low-resource networks with small packets.
   Saving header space is important and a short EST-coaps URI (see
   Table 2) is specified that is shorter than the EST URI specified in
   [RFC7030].  The individual EST-coaps well-known server URIs differ
   from the EST URI by replacing the scheme https by coaps and by
   specifying shorter resource path names:

van der Stok, et al.     Expires April 11, 2019                [Page 13]

Internet-Draft                  EST-coaps                   October 2018


   The ArbitraryLabel Path-Segment, if used, SHOULD be of the shortest
   length possible (See sections 3.1 and 3.2.2 of [RFC7030].  Following
   [RFC7030] discovery is not needed when the client is preconfigured
   with the /.well-known/est server URI and the coaps port 5684.

   The additional EST-coaps server URIs, obtained through discovery of
   the EST root resource(s) as shown below, are of the form:


   In the context of CoAP, the presence and location of (path to) the
   management data are discovered by sending a GET request to "/.well-
   known/core" including a resource type (RT) parameter with the value
   "ace.est" [RFC6690].  Upon success, the return payload will contain
   the root resource of the EST resources.  It is up to the
   implementation to choose its root resource; throughout this document
   the example root resource /est is used.

   The optional additional EST-coaps server URIs, obtained through
   discovery of the EST root resource(s) as shown below, are of the


   Figure 5 in section 3.2.2 of [RFC7030] enumerates the operations and
   corresponding paths which are supported by EST.  Table 2 provides the
   mapping from the EST URI path to the shorter EST-coaps URI path.

                     | EST              | EST-coaps |
                     | /cacerts         | /crts     |
                     | /simpleenroll    | /sen      |
                     | /simplereenroll  | /sren     |
                     | /csrattrs        | /att      |
                     | /serverkeygen    | /skg      |

                     Table 2: Short EST-coaps URI path

   The short resource URIs MUST be supported.  The corresponding longer
   URIs specified in [RFC7030] MAY be supported.

van der Stok, et al.     Expires April 11, 2019                [Page 14]

Internet-Draft                  EST-coaps                   October 2018

   When discovering the root path for the EST resources, the server MAY
   return all available resource paths and the used content types.  This
   is useful when multiple content types are specified for EST-coaps
   server and optional functions are available.  The example below shows
   the discovery of the presence and location of EST-coaps resources.
   Linefeeds are included only for readability.

     REQ: GET /.well-known/core?rt=ace.est*

     RES: 2.05 Content
   </est>; rt="ace.est",
   </est/sen>;rt="ace.est.sen"ct=281 286,
   </est/sren>;rt="ace.est.sren"ct=281 286,
   </est/skg>;rt="ace.est.skg"ct=280 286 TBD8

   The first line of the discovery response MUST be returned.  The five
   consecutive lines MAY be returned.  The return of the content-types
   in the last four lines allows the client to choose the most
   appropriate one from multiple content types.

   Port numbers, not returned in the example, are assumed to be the
   default numbers 5683 and 5684 for coap and coaps respectively
   (sections 12.6 and 12.7 of [RFC7252].  Discoverable port numbers MAY
   be returned in the <href> of the payload.

7.  DTLS Transport Protocol

   EST-coaps depends on a secure transport mechanism over UDP that can
   secure (confidentiality, authenticity) the exchanged CoAP messages.

   DTLS is one such secure protocol.  When "TLS" is referred to in the
   context of EST, it is understood that in EST-coaps, security is
   provided using DTLS instead.  No other changes are necessary (all
   provisional modes etc. are the same as for TLS).

   CoAP was designed to avoid fragmentation.  DTLS is used to secure
   CoAP messages.  However, fragmentation is still possible at the DTLS
   layer during the DTLS handshake when using ECC ciphersuites.  If
   fragmentation is necessary, "DTLS provides a mechanism for
   fragmenting a handshake message over several records, each of which
   can be transmitted separately, thus avoiding IP fragmentation"

   CoAP and DTLS can provide proof of identity for EST-coaps clients and
   server with simple PKI messages conformant to section 3.1 of

van der Stok, et al.     Expires April 11, 2019                [Page 15]

Internet-Draft                  EST-coaps                   October 2018

   [RFC5272].  EST-coaps supports the certificate types and Trust
   Anchors (TA) that are specified for EST in section 3 of [RFC7030].

   Channel-binding information for linking proof-of-identity with
   connection-based proof-of-possession is optional for EST-coaps.  When
   proof-of-possession is desired, a set of actions are required
   regarding the use of tls-unique, described in section 3.5 in
   [RFC7030].  The tls-unique information translates to the contents of
   the first "Finished" message in the (D)TLS handshake between server
   and client [RFC5929].  The client is then supposed to add this
   "Finished" message as a ChallengePassword in the attributes section
   of the PKCS#10 Request Info to prove that the client is indeed in
   control of the private key at the time of the TLS session when
   performing a /simpleenroll, for example.  In the case of EST-coaps,
   the same operations can be performed during the DTLS handshake.  For
   DTLS 1.2, in the event of handshake message fragmentation, the Hash
   of the handshake messages used in the MAC calculation of the Finished

   PRF(master_secret, finished_label, Hash(handshake_messages))

   MUST be computed as if each handshake message had been sent as a
   single fragment [RFC6347].  Similarly, for DTLS 1.3, the Finished

       Transcript-Hash(Handshake Context,
       Certificate*, CertificateVerify*))

       * Only included if present.

   MUST be computed as if each handshake message had been sent as a
   single fragment following the algorithm described in 4.4.4 of

   In a constrained CoAP environment, endpoints can't afford to
   establish a DTLS connection for every EST transaction.
   Authenticating and negotiating DTLS keys requires resources on low-
   end endpoints and consumes valuable bandwidth.  The DTLS connection
   SHOULD remain open for persistent EST connections.  For example, an
   EST cacerts request that is followed by a simpleenroll request can
   use the same authenticated DTLS connection.  Given that after a
   successful enrollment, it is more likely that a new EST transaction
   will take place after a significant amount of time, the DTLS
   connections SHOULD only be kept alive for EST messages that are
   relatively close to each other.  In some cases, such as NAT
   rebinding, keeping the state of a connection is not possible when

van der Stok, et al.     Expires April 11, 2019                [Page 16]

Internet-Draft                  EST-coaps                   October 2018

   devices sleep for extended periods of time.  In such occasions,
   [I-D.rescorla-tls-dtls-connection-id] negotiates a connection ID that
   can eliminate the need for new handshake and its additional cost.

8.  HTTPS-CoAPS Registrar

   In real-world deployments, the EST server will not always reside
   within the CoAP boundary.  The EST-server can exist outside the
   constrained network in a non-constrained network that supports TLS/
   HTTP.  In such environments EST-coaps is used by the client within
   the CoAP boundary and TLS is used to transport the EST messages
   outside the CoAP boundary.  A Registrar at the edge is required to
   operate between the CoAP environment and the external HTTP network.
   The EST coaps-to-HTTPS Registrar MUST terminate EST-coaps and
   authenticate the client downstream and initiate EST connections over
   TLS upstream.

   The Registrar SHOULD authenticate the client downstream and it should
   be authenticated by the EST server or CA upstream.  The Registration
   Authority (re-)creates the secure connection from DTLS to TLS and
   vice versa.  A trust relationship SHOULD be pre-established between
   the Registrar and the EST servers to be able to proxy these
   connections on behalf of various clients.

   When enforcing Proof-of-Possession (POP) linking, the (D)TLS tls-
   unique value of the (D)TLS session needs to be used to prove that the
   private key corresponding to the public key is in the possession of
   and was used to establish the connection by an end-entity or client.
   To do that the CSR the client is using needs to include information
   from the DTLS connection the client establishes with the server.  In
   EST, that information is the (D)TLS tls-unique value of the (D)TLS
   session.  In the presence of ESTcoaps-to-HTTPS Registrar, the EST-
   coaps client MUST be authenticated and authorized by the Registrar
   and the Registrar MUST be authenticated as an EST Registrar client to
   the EST server.  Thus the POP linking information is lost between the
   EST-coaps client and the EST server.  The EST server becomes aware of
   the presence of an EST Registrar from its TLS client certificate that
   includes id-kp-cmcRA [RFC6402] extended key usage extension.  As
   explained in Section 3.7 of [RFC7030], the EST server SHOULD apply an
   authorization policy consistent with a Registrar client.  For
   example, it could be configured to accept POP linking information
   that does not match the current TLS session because the authenticated
   EST client Registrar has verified this information when acting as an
   EST server.

   For some use cases, clients that leverage server-side key generation
   might prefer for the enrolled keys to be generated by the Registrar
   if the CA does not support server-side key generation.  In these

van der Stok, et al.     Expires April 11, 2019                [Page 17]

Internet-Draft                  EST-coaps                   October 2018

   cases the Registrar MUST support the random number generation using
   proper entropy and is responsible for generating a new CSR signed by
   a new key which will be returned to the client along with the
   certificate from the CA.

   One possible use-case, shown in one figure below, is expected to be
   deployed in practice:

                                        Constrained Network
   .------.                         .----------------------------.
   |  CA  |                         |.--------------------------.|
   '------'                         ||                          ||
      |                             ||                          ||
   .------.  HTTP   .-----------------.  CoAPS   .-----------.  ||
   | EST  |<------->|ESTcoaps-to-HTTPS|<-------->| EST Client|  ||
   |Server|over TLS |   Registrar     |          '-----------'  ||
   '------'         '-----------------'                         ||
                                    ||                          ||

             ESTcoaps-to-HTTPS Registrar at the CoAP boundary.

   Table 2 contains the URI mapping between the EST-coaps and EST the
   Registrar SHOULD adhere to.  Section 7 of [RFC8075] and Section 5.4
   define the mapping between EST-coaps and HTTP response codes, that
   determines how the Registrar translates CoAP response codes from/to
   HTTP status codes.  The mapping from Content-Type to media type is
   defined in Section 10.  The conversion from CBOR major type 2 to
   base64 encoding needs to be done in the Registrar.  Conversion is
   possible because a TLS link exists between EST-coaps-to-HTTP
   Registrar and EST server and a corresponding DTLS link exists between
   EST-coaps-to-HTTP Registrar and EST client.

   Due to fragmentation of large messages into blocks, an EST-coaps-to-
   HTTP Registrar MUST reassemble the BLOCKs before translating the
   binary content to Base-64, and consecutively relay the message

   For the discovery of the EST server by the EST client in the coap
   environment, the EST-coaps-to-HTTP Registrar MUST announce itself
   according to the rules of Section 6.  The available actions of the
   Registrars MUST be announced with as many resource paths.  The
   discovery of EST server in the http environment follow the rules
   specified in [RFC7030].

van der Stok, et al.     Expires April 11, 2019                [Page 18]

Internet-Draft                  EST-coaps                   October 2018

9.  Parameters

   This section addresses transmission parameters described in sections
   4.7 and 4.8 of the CoAP document [RFC7252].

            ACK_TIMEOUT       | 2 seconds     |
            ACK_RANDOM_FACTOR | 1.5           |
            MAX_RETRANSMIT    | 4             |
            NSTART            | 1             |
            DEFAULT_LEISURE   | 5 seconds     |
            PROBING_RATE      | 1 byte/second |

                  Figure 4: EST-COAP protocol parameters

   EST does not impose any unique parameters that affect the CoAP
   parameters in Table 2 and 3 in the CoAP draft but the ones in CoAP
   could be affecting EST.  For example, the processing delay of CAs
   could be less then 2s, but in this case they should send a CoAP ACK
   every 2s while processing.

   The main recommendation, based on experiments using Nexus Certificate
   Manager with Californium for CoAP support, communicating with a
   ContikiOS and tinyDTLS based client, from RISE SICS, is to start with
   the default CoAP configuration parameters.

   However, depending on the implementation scenario, resending and
   timeouts can also occur on other networking layers, governed by other
   configuration parameters.

   Some further comments about some specific parameters, mainly from
   Table 2 in [RFC7252]:

   o  DEFAULT_LEISURE: This setting is only relevant in multicast
      scenarios, outside the scope of the EST-coaps draft.

   o  NSTART: Limit the number of simultaneous outstanding interactions
      that a client maintains to a given server.  The default is one,
      hence is the risk of congestion or out-of-order messages already

   o  PROBING_RATE: A parameter which specifies the rate of re-sending
      non-confirmable messages.  The EST messages are defined to be sent
      as CoAP confirmable messages, hence the PROBING_RATE setting is
      not applicable.

   Finally, the Table 3 parameters are mainly derived from the more
   basic Table 2 parameters.  If the CoAP implementation allows setting

van der Stok, et al.     Expires April 11, 2019                [Page 19]

Internet-Draft                  EST-coaps                   October 2018

   them directly, they might need to be updated if the table 2
   parameters are changed.

10.  IANA Considerations

10.1.  Content-Format Registry

   Additions to the sub-registry "CoAP Content-Formats", within the
   "CoRE Parameters" registry are specified in Table 3.  These have been
   registered temporarily in the Expert Review range (0-255).

   | HTTP Media-Type          | Encodi |  ID | Reference               |
   |                          | ng     |     |                         |
   | application/pkcs7-mime;  | -      | 280 | [I-D.ietf-lamps-rfc5751 |
   | smime-type=server-       |        |     | -bis] [RFC7030]         |
   | generated-key            |        |     |                         |
   | application/pkcs7-mime;  | -      | 281 | [I-D.ietf-lamps-rfc5751 |
   | smime-type=certs-only    |        |     | -bis]                   |
   | application/pkcs7-mime;  | -      | 282 | [I-D.ietf-lamps-rfc5751 |
   | smime-type=CMC-request   |        |     | -bis] [RFC5273]         |
   | application/pkcs7-mime;  | -      | 283 | [I-D.ietf-lamps-rfc5751 |
   | smime-type=CMC-response  |        |     | -bis] [RFC5273]         |
   | application/pkcs8        | -      | 284 | [I-D.ietf-lamps-rfc5751 |
   |                          |        |     | -bis] [RFC5958]         |
   | application/csrattrs     | -      | 285 | [RFC7030] [RFC7231]     |
   | application/pkcs10       | -      | 286 | [I-D.ietf-lamps-rfc5751 |
   |                          |        |     | -bis] [RFC5967]         |

                     Table 3: New CoAP Content-Formats

10.2.  Resource Type registry

   This memo registers a new Resource Type (rt=) Link Target Attributes
   in the "Resource Type (rt=) Link Target Attribute Values" subregistry
   under the "Constrained RESTful Environments (CoRE) Parameters"

   o  rt="ace.est".  This EST resource is used to query and return the
      supported EST resources of a CoAP server.

   o  rt="ace.est.crts".  This resource depicts the support of EST get

   o  rt="ace.est.sen".  This resource depicts the support of EST simple

van der Stok, et al.     Expires April 11, 2019                [Page 20]

Internet-Draft                  EST-coaps                   October 2018

   o  rt="ace.est.sren".  This resource depicts the support of EST
      simple reenroll.

   o  rt="ace.est.att".  This resource depicts the support of EST CSR

   o  rt="ace.est.skg".  This resource depicts the support of EST
      server-side key generation.

11.  Security Considerations

11.1.  EST server considerations

   The security considerations of Section 6 of [RFC7030] are only
   partially valid for the purposes of this document.  As HTTP Basic
   Authentication is not supported, the considerations expressed for
   using passwords do not apply.

   Given that the client has only limited resources and may not be able
   to generate sufficiently random keys to encrypt its identity, it is
   possible that the client uses server generated private/public keys to
   encrypt its certificate.  The transport of these keys is inherently
   risky.  A full probability analysis MUST be done to establish whether
   server side key generation enhances or decreases the probability of
   identity stealing.

   When a client uses the Implicit TA database for certificate
   validation, the client cannot verify that the implicit database can
   act as an RA.  It is RECOMMENDED that such clients include "Linking
   Identity and POP Information" Section 7 in requests (to prevent such
   requests from being forwarded to a real EST server by a man in the
   middle).  It is RECOMMENDED that the Implicit Trust Anchor database
   used for EST server authentication be carefully managed to reduce the
   chance of a third-party CA with poor certification practices from
   being trusted.  Disabling the Implicit Trust Anchor database after
   successfully receiving the Distribution of CA certificates response
   (Section 4.1.3 of [RFC7030]) limits any risk to the first DTLS

   In accordance with [RFC7030], TLS cipher suites that include
   "_EXPORT_" and "_DES_" in their names MUST NOT be used.  More
   information about recommendations of TLS and DTLS are included in

   As described in CMC, Section 6.7 of [RFC5272], "For keys that can be
   used as signature keys, signing the certification request with the
   private key serves as a POP on that key pair".  The inclusion of tls-
   unique in the certification request links the proof-of-possession to

van der Stok, et al.     Expires April 11, 2019                [Page 21]

Internet-Draft                  EST-coaps                   October 2018

   the TLS proof-of-identity.  This implies but does not prove that the
   authenticated client currently has access to the private key.

   Regarding the Certificate Signing Request (CSR), an adversary could
   exclude attributes that a server may want, include attributes that a
   server may not want, and render meaningless other attributes that a
   server may want.  The CA is expected to be able to enforce policies
   to recover from improper CSR requests.

   Interpreters of ASN.1 structures should be aware of the use of
   invalid ASN.1 length fields and should take appropriate measures to
   guard against buffer overflows, stack overruns in particular, and
   malicious content in general.

11.2.  HTTPS-CoAPS Registrar considerations

   The Registrar proposed in Section 8 must be deployed with care, and
   only when the recommended connections are impossible.  When POP
   linking is used the Registrar terminating the TLS connection
   establishes a new one with the upstream CA.  Thus, it is impossible
   for POP linking to be enforced end-to-end for the EST transaction.
   The EST server could be configured to accept POP linking information
   that does not match the current TLS session because the authenticated
   EST Registrar client has verified this information when acting as an
   EST server.  The introduction of an EST-coaps-to-HTTP Registrar
   assumes the client can trust the registrar using its implicit or
   explicit TA database.  It also assumes the Registrar has a trust
   relationship with the upstream EST server in order to act on behalf
   of the clients.

   In a server-side key generation case, if no end-to-end encryption is
   used, the Registrar may be able see the private key as it acts as a
   man-in-the-middle.  Thus, the clients puts its trust on the Registrar
   not exposing the private key.

   Clients that leverage server-side key generation have no knowledge if
   the Registrar will be generating the keys and enrolling the
   certificates with the CA or if the CA will be responsible for
   generating the keys, the existence of a Registrar requires the client
   to put its trust on the registrar doing the right thing if it is
   generating they private keys.

12.  Acknowledgements

   The authors are very grateful to Klaus Hartke for his detailed
   explanations on the use of Block with DTLS and his support for the
   content-format specification.  The authors would like to thank Esko
   Dijk and Michael Verschoor for the valuable discussions that helped

van der Stok, et al.     Expires April 11, 2019                [Page 22]

Internet-Draft                  EST-coaps                   October 2018

   in shaping the solution.  They would also like to thank Peter
   Panburana for his feedback on technical details of the solution.
   Constructive comments were received from Benjamin Kaduk, Eliot Lear,
   Jim Schaad, Hannes Tschofenig, Julien Vermillard, and John Manuel.

13.  References

13.1.  Normative References

              Fossati, T., Hartke, K., and C. Bormann, "Multipart
              Content-Format for CoAP", draft-ietf-core-multipart-ct-02
              (work in progress), August 2018.

              Schaad, J., Ramsdell, B., and S. Turner, "Secure/
              Multipurpose Internet Mail Extensions (S/MIME) Version 4.0
              Message Specification", draft-ietf-lamps-rfc5751-bis-12
              (work in progress), September 2018.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,

   [RFC5272]  Schaad, J. and M. Myers, "Certificate Management over CMS
              (CMC)", RFC 5272, DOI 10.17487/RFC5272, June 2008,

   [RFC5967]  Turner, S., "The application/pkcs10 Media Type", RFC 5967,
              DOI 10.17487/RFC5967, August 2010,

   [RFC6347]  Rescorla, E. and N. Modadugu, "Datagram Transport Layer
              Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347,
              January 2012, <>.

   [RFC6690]  Shelby, Z., "Constrained RESTful Environments (CoRE) Link
              Format", RFC 6690, DOI 10.17487/RFC6690, August 2012,

   [RFC7030]  Pritikin, M., Ed., Yee, P., Ed., and D. Harkins, Ed.,
              "Enrollment over Secure Transport", RFC 7030,
              DOI 10.17487/RFC7030, October 2013,

van der Stok, et al.     Expires April 11, 2019                [Page 23]

Internet-Draft                  EST-coaps                   October 2018

   [RFC7049]  Bormann, C. and P. Hoffman, "Concise Binary Object
              Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049,
              October 2013, <>.

   [RFC7252]  Shelby, Z., Hartke, K., and C. Bormann, "The Constrained
              Application Protocol (CoAP)", RFC 7252,
              DOI 10.17487/RFC7252, June 2014,

   [RFC7959]  Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in
              the Constrained Application Protocol (CoAP)", RFC 7959,
              DOI 10.17487/RFC7959, August 2016,

   [RFC8075]  Castellani, A., Loreto, S., Rahman, A., Fossati, T., and
              E. Dijk, "Guidelines for Mapping Implementations: HTTP to
              the Constrained Application Protocol (CoAP)", RFC 8075,
              DOI 10.17487/RFC8075, February 2017,

   [RFC8446]  Rescorla, E., "The Transport Layer Security (TLS) Protocol
              Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018,

13.2.  Informative References

              Rescorla, E., Tschofenig, H., Fossati, T., and T. Gondrom,
              "The Datagram Transport Layer Security (DTLS) Connection
              Identifier", draft-rescorla-tls-dtls-connection-id-02
              (work in progress), November 2017.

   [RFC0791]  Postel, J., "Internet Protocol", STD 5, RFC 791,
              DOI 10.17487/RFC0791, September 1981,

   [RFC4919]  Kushalnagar, N., Montenegro, G., and C. Schumacher, "IPv6
              over Low-Power Wireless Personal Area Networks (6LoWPANs):
              Overview, Assumptions, Problem Statement, and Goals",
              RFC 4919, DOI 10.17487/RFC4919, August 2007,

   [RFC5273]  Schaad, J. and M. Myers, "Certificate Management over CMS
              (CMC): Transport Protocols", RFC 5273,
              DOI 10.17487/RFC5273, June 2008,

van der Stok, et al.     Expires April 11, 2019                [Page 24]

Internet-Draft                  EST-coaps                   October 2018

   [RFC5705]  Rescorla, E., "Keying Material Exporters for Transport
              Layer Security (TLS)", RFC 5705, DOI 10.17487/RFC5705,
              March 2010, <>.

   [RFC5929]  Altman, J., Williams, N., and L. Zhu, "Channel Bindings
              for TLS", RFC 5929, DOI 10.17487/RFC5929, July 2010,

   [RFC5958]  Turner, S., "Asymmetric Key Packages", RFC 5958,
              DOI 10.17487/RFC5958, August 2010,

   [RFC6090]  McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic
              Curve Cryptography Algorithms", RFC 6090,
              DOI 10.17487/RFC6090, February 2011,

   [RFC6402]  Schaad, J., "Certificate Management over CMS (CMC)
              Updates", RFC 6402, DOI 10.17487/RFC6402, November 2011,

   [RFC7230]  Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
              Protocol (HTTP/1.1): Message Syntax and Routing",
              RFC 7230, DOI 10.17487/RFC7230, June 2014,

   [RFC7231]  Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
              Protocol (HTTP/1.1): Semantics and Content", RFC 7231,
              DOI 10.17487/RFC7231, June 2014,

   [RFC7251]  McGrew, D., Bailey, D., Campagna, M., and R. Dugal, "AES-
              CCM Elliptic Curve Cryptography (ECC) Cipher Suites for
              TLS", RFC 7251, DOI 10.17487/RFC7251, June 2014,

   [RFC7525]  Sheffer, Y., Holz, R., and P. Saint-Andre,
              "Recommendations for Secure Use of Transport Layer
              Security (TLS) and Datagram Transport Layer Security
              (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May
              2015, <>.

   [RFC7925]  Tschofenig, H., Ed. and T. Fossati, "Transport Layer
              Security (TLS) / Datagram Transport Layer Security (DTLS)
              Profiles for the Internet of Things", RFC 7925,
              DOI 10.17487/RFC7925, July 2016,

van der Stok, et al.     Expires April 11, 2019                [Page 25]

Internet-Draft                  EST-coaps                   October 2018

   [RFC8422]  Nir, Y., Josefsson, S., and M. Pegourie-Gonnard, "Elliptic
              Curve Cryptography (ECC) Cipher Suites for Transport Layer
              Security (TLS) Versions 1.2 and Earlier", RFC 8422,
              DOI 10.17487/RFC8422, August 2018,

Appendix A.  EST messages to EST-coaps

   This section takes all examples from Appendix A of [RFC7030], changes
   the payload from Base64 to binary and replaces the http headers by
   their CoAP equivalents.

   The corresponding CoAP headers are only shown in Appendix A.1.
   Creating CoAP headers are assumed to be generally known.

   Binary payload is a CBOR major type 2 (byte array), that is shown
   with a base16 (hexadecimal) CBOR diagnostic notation.

   [EDNOTE: The payloads of the examples need to be re-generated with
   appropriate tools and example certificates.]

A.1.  cacerts

   These examples assume that the resource discovery, returned a short
   URL of "/est".

   In EST-coaps, a coaps cacerts IPv4 message can be:

   GET coaps://

   The corresponding CoAP header fields are shown below.  The use of
   block and DTLS are worked out in Appendix B.

van der Stok, et al.     Expires April 11, 2019                [Page 26]

Internet-Draft                  EST-coaps                   October 2018

     Ver = 1
     T = 0 (CON)
     Code = 0x01 (0.01 is GET)
     Token = 0x9a (client generated)
      Option1 (Uri-Host)               [optional]
        Option Delta = 0x3  (option nr = 3)
        Option Length = 0x9
        Option Value =
      Option2 (Uri-Port)               [optional]
        Option Delta = 0x4  (option nr = 3+4=7)
        Option Length = 0x4
        Option Value = 8085
      Option3 (Uri-Path)
        Option Delta = 0x4   (option nr = 7+4= 11)
        Option Length = 0x5
        Option Value = "est"
      Option4 (Uri-Path)
        Option Delta = 0x0   (option nr = 11+0= 11)
        Option Length = 0x6
        Option Value = "crts"
      Option5 (Max-Age)
        Option Delta = 0x3   (option nr = 11+3= 14)
        Option Length = 0x1
        Option Value = 0x1    (1 minute)
     Payload = [Empty]

   A 2.05 Content response with a cert in EST-coaps will then be:

   2.05 Content (Content-Format: 281)

   with CoAP fields

     Ver = 1
     T = 2 (ACK)
     Code = 0x45 (2.05 Content)
     Token = 0x9a   (copied by server)
       Option1 (Content-Format)
         Option Delta = 0xC  (option nr =12)
         Option Length = 0x2
         Option Value = 281 (defined in this document)

     Payload =

van der Stok, et al.     Expires April 11, 2019                [Page 27]

Internet-Draft                  EST-coaps                   October 2018


van der Stok, et al.     Expires April 11, 2019                [Page 28]

Internet-Draft                  EST-coaps                   October 2018


   The hexadecimal dump of the CBOR payload looks like:

   59 09CD                                 # bytes(2509)

van der Stok, et al.     Expires April 11, 2019                [Page 29]

Internet-Draft                  EST-coaps                   October 2018


van der Stok, et al.     Expires April 11, 2019                [Page 30]

Internet-Draft                  EST-coaps                   October 2018


A.2.  csrattrs

   In the following valid /csrattrs exchange, the EST-coaps client
   authenticates itself with a certificate issued by the connected CA.

   The initial DTLS handshake is identical to the enrollment example.
   The IPv6 CoAP GET request looks like:

   GET coaps://[2001:db8::2:1]:61616/est/att
   (Content-Format: 285)

   A 2.05 Content response contains attributes which are relevant for
   the authenticated client.  In this example, the EST-coaps server
   returns two attributes that the client can ignore when they are
   unknown to him.

A.3.  enroll / reenroll

   During the Enroll/Reenroll exchange, the EST-coaps client uses a CSR
   (Content-Format 286) request in the POST request payload.

   After verification of the CSR by the server, a 2.05 Content response
   with the issued certificate will be returned to the client.  As
   described in Section 5.5, if the server is not able to provide a
   response immediately, it sends an empty ACK with response code 5.03
   (Service Unavailabel) and the Max-Age option.  See Figure 3 for an
   example exchange.

   [EDNOTE: When redoing this example, given that POP linking is also
   used, make sure it is obvious that the ChallengePassword attribute in
   the CSR is valid HMAC output.  HMAC-REAL.]

van der Stok, et al.     Expires April 11, 2019                [Page 31]

Internet-Draft                  EST-coaps                   October 2018

   POST [2001:db8::2:1]:61616/est/sen
   (token 0x45)
   (Content-Format: 286)

   (Content-Format: 281)(token =0x45)
   2.01 Created

van der Stok, et al.     Expires April 11, 2019                [Page 32]

Internet-Draft                  EST-coaps                   October 2018

A.4.  serverkeygen

   During this valid /serverkeygen exchange, the EST-coaps client
   authenticates itself using the certificate provided by the connected

   The initial DTLS handshake is identical to the enrollment example.
   The CoAP GET request looks like:

   [EDNOTE: same comment as HMAC-REAL above applies.]

   [EDNOTE: Suggestion to have only one example with complete encrypted
   payload (the short one) and point out the different fields.  Update
   this example according to the agreed upon solution from Section 5.6.

   POST coaps://
   (token 0xa5)
   (Content-Format: 286)(Max-Age=120)


   2.01 Content (Content-Format: TBD8)


van der Stok, et al.     Expires April 11, 2019                [Page 33]

Internet-Draft                  EST-coaps                   October 2018


van der Stok, et al.     Expires April 11, 2019                [Page 34]

Internet-Draft                  EST-coaps                   October 2018

   Without the DecryptKeyIdentifier attribute, the response has no
   additional encryption beyond DTLS.

   The response contains first a preamble that can be ignored.  The EST-
   coaps server can use the preamble to include additional explanations,
   like ownership or support information

Appendix B.  EST-coaps Block message examples

   Two examples are presented: (1) a cacerts exchange shows the use of
   Block2 and the block headers, and (2) a enroll exchange shows the
   Block1 and Block2 size negotiation for request and response payloads.

B.1.  cacerts block example

   This section provides a detailed example of the messages using DTLS
   and BLOCK option Block2.  The minimum PMTU is 1280 bytes, which is
   the example value assumed for the DTLS datagram size.  The example
   block length is taken as 64 which gives an SZX value of 2.

   The following is an example of a valid /cacerts exchange over DTLS.
   The content length of the cacerts response in appendix A.1 of
   [RFC7030] is 4246 bytes using base64.  This leads to a length of 2509
   bytes in binary.  The CoAP message adds around 10 bytes, the DTLS
   record 29 bytes.  To avoid IP fragmentation, the CoAP block option is
   used and an MTU of 127 is assumed to stay within one IEEE 802.15.4
   packet.  To stay below the MTU of 127, the payload is split in 39
   packets with a payload of 64 bytes each, followed by a packet of 13
   bytes.  The client sends an IPv6 packet containing the UDP datagram
   with the DTLS record that encapsulates the CoAP Request 40 times.
   The server returns an IPv6 packet containing the UDP datagram with
   the DTLS record that encapsulates the CoAP response.  The CoAP
   request-response exchange with block option is shown below.  Block
   option is shown in a decomposed way (block-option:NUM/M/size)
   indicating the kind of Block option (2 in this case because used in
   the response) followed by a colon, and then the block number (NUM),
   the more bit (M = 0 in lock2 response means last block), and block
   size with exponent (2**(SZX+4)) separated by slashes.  The Length 64
   is used with SZX= 2 to avoid IP fragmentation.  The CoAP Request is
   sent with confirmable (CON) option and the content format of the
   Response is /application/cacerts.

van der Stok, et al.     Expires April 11, 2019                [Page 35]

Internet-Draft                  EST-coaps                   October 2018

      GET /   (2:0/0/64)    -->
                    <--   (2:0/1/64) 2.05 Content
      GET /   (2:1/0/64)    -->
                    <--   (2:1/1/64) 2.05 Content
      GET /    (2:39/0/64)  -->
                    <--   (2:39/0/64) 2.05 Content

   40 blocks have been sent with partially filled block NUM=39 as last

   For further detailing the CoAP headers, the first two blocks are
   written out.

   The header of the first GET looks like:

     Ver = 1
     T = 0 (CON)
     Code = 0x01 (0.1 GET)
     Token = 0x9a    (client generated)
      Option1 (Uri-Host)            [optional]
        Option Delta = 0x3  (option nr = 3)
        Option Length = 0x9
        Option Value =
      Option2 (Uri-Port)            [optional]
        Option Delta = 0x4   (option nr = 3+4=7)
        Option Length = 0x4
        Option Value = 8085
      Option3 (Uri-Path)
        Option Delta = 0x4    (option nr = 7+4=11)
        Option Length = 0x5
        Option Value = "est"
      Option4 (Uri-Path)
        Option Delta = 0x0    (option nr = 11+0=11)
        Option Length = 0x6
        Option Value = "crts"
     Payload = [Empty]

   The header of the first response looks like:

van der Stok, et al.     Expires April 11, 2019                [Page 36]

Internet-Draft                  EST-coaps                   October 2018

     Ver = 1
     T = 2 (ACK)
     Code = 0x45 (2.05 Content)
     Token = 0x9a     (copied by server)
       Option1 (Content-Format)
         Option Delta = 0xC  (option nr =12)
         Option Length = 0x2
         Option Value = 281
       Option2 (Block2)
         Option Delta = 0xB  (option 23 = 12 + 11)
         Option Length = 0x1
         Option Value = 0x0A (block number = 0, M=1, SZX=2)
     Payload =

   The second Block2:

     Ver = 1
     T = 2 (means ACK)
     Code = 0x45 (2.05 Content)
     Token = 0x9a     (copied by server)
       Option1 (Content-Format)
         Option Delta = 0xC  (option nr =12)
         Option Length = 0x2
         Option Value = 281
       Option2 (Block2)
         Option Delta = 0xB  (option 23 = 12 + 11)
         Option Length = 0x1
         Option Value = 0x1A (block number = 1, M=1, SZX=2)
     Payload =

   The 40th and final Block2:

van der Stok, et al.     Expires April 11, 2019                [Page 37]

Internet-Draft                  EST-coaps                   October 2018

     Ver = 1
     T = 2 (means ACK)
     Code = 0x45      (2.05 Content)
     Token = 0x9a     (copied by server)
       Option1 (Content-Format)
         Option Delta = 0xC  (option nr =12)
         Option Length = 0x2
         Option Value = 281
       Option2 (Block2)
         Option Delta = 0xB  (option 23 = 12 + 11)
         Option Length = 0x2
         Option Value = 0x272 (block number = 39, M=0, SZX=2)
     Payload = h'73a30d0c006343116f58403100'

B.2.  enroll block example

   In this example the requested block2 size of 256 bytes, required by
   the client, is transferred to the server in the very first request
   message.  The request/response consists of two parts: part1
   containing the CSR transferred to the server, and part2 contains the
   certificate transferred back to the client.  The block size
   256=(2**(SZX+4)) which gives SZX=4.  The notation for block numbering
   is the same as in Appendix B.1.  It is assumed that CSR takes N1+1
   blocks and Cert response takes N2+1 blocks.  The header fields and
   the payload are omitted to show the block exchange.  The type of
   payload is shown within curly brackets.

van der Stok, et al.     Expires April 11, 2019                [Page 38]

Internet-Draft                  EST-coaps                   October 2018

   POST [2001:db8::2:1]:61616/est/sen (CON)(1:0/1/256) {CSR req} -->
          <-- (ACK) (1:0/1/256) (2.31 Continue)
   POST [2001:db8::2:1]:61616/est/sen (CON)(1:1/1/256) {CSR req} -->
          <-- (ACK) (1:1/1/256) (2.31 Continue)
   POST [2001:db8::2:1]:61616/est/sen (CON)(1:N1/0/256){CSR req} -->
          <-- (ACK) (1:N1/0/256) (2:0/1/256) (2.04 Changed){Cert resp}
   POST [2001:db8::2:1]:61616/est/sen (CON)(2:1/0/256)           -->
          <-- (ACK) (2:1/1/256) (2.04 Changed) {Cert resp}
   POST [2001:db8::2:1]:61616/est/sen (CON)(2:N2/0/256)          -->
          <-- (ACK) (2:N2/0/256) (2.04 Changed) {Cert resp}

             Figure 5: EST-COAP enrolment with multiple blocks

   N1+1 blocks have been transferred from client to server and N2+1
   blocks have been transferred from server to client.

Authors' Addresses

   Peter van der Stok


   Panos Kampanakis
   Cisco Systems


   Sandeep S. Kumar
   Philips Lighting Research
   High Tech Campus 7
   Eindhoven  5656 AE


van der Stok, et al.     Expires April 11, 2019                [Page 39]

Internet-Draft                  EST-coaps                   October 2018

   Michael C. Richardson
   Sandelman Software Works


   Martin Furuhed
   Nexus Group


   Shahid Raza
   Isafjordsgatan 22
   Kista, Stockholm  16440


van der Stok, et al.     Expires April 11, 2019                [Page 40]