<?xml version="1.0" encoding="utf-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.0.30 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC5246 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5246.xml">
<!ENTITY RFC6347 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6347.xml">
<!ENTITY RFC7400 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7400.xml">
<!ENTITY RFC7252 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7252.xml">
<!ENTITY RFC7925 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7925.xml">
<!ENTITY I-D.ietf-tls-tls13 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-tls-tls13.xml">
<!ENTITY I-D.rescorla-tls-dtls13 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.rescorla-tls-dtls13.xml">
<!ENTITY I-D.ietf-core-coap-tcp-tls SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-core-coap-tcp-tls.xml">
<!ENTITY I-D.ietf-core-object-security SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-core-object-security.xml">
]>

<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc tocdepth="2"?>

<rfc ipr="trust200902" docName="draft-mattsson-core-security-overhead-00" category="info">

  <front>
    <title abbrev="CoAP Security Overhead">Message Size Overhead of CoAP Security Protocols</title>

    <author initials="J." surname="Mattsson" fullname="John Mattsson">
      <organization>Ericsson AB</organization>
      <address>
        <postal>
          <street>Färögatan 6</street>
          <city>Kista</city>
          <code>SE-164 80 Stockholm</code>
          <country>Sweden</country>
        </postal>
        <email>john.mattsson@ericsson.com</email>
      </address>
    </author>

    <date year="2017" month="March" day="13"/>

    
    
    

    <abstract>


<t>This document analyzes and compares per-packet message size overheads when using different security protocols to secure CoAP. The analyzed security protocols are DTLS 1.2, DTLS 1.3, TLS 1.2, TLS 1.3, and OSCOAP. DTLS and TLS are analyzed with and without compression. DTLS are analyzed with two different alternatives for header compression.</t>



    </abstract>


  </front>

  <middle>


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

<t>This document analyzes and compares per-packet message size overheads when using different security protocols to secure CoAP over UPD <xref target="RFC7252"/> and TCP <xref target="I-D.ietf-core-coap-tcp-tls"/>. The analyzed security protocols are DTLS 1.2 <xref target="RFC6347"/>, DTLS 1.3 <xref target="I-D.rescorla-tls-dtls13"/>, TLS 1.2 <xref target="RFC5246"/>, TLS 1.3 <xref target="I-D.ietf-tls-tls13"/>, and OSCOAP <xref target="I-D.ietf-core-object-security"/>. The DTLS and TLS record layers are analyzed with and without compression. DTLS are analyzed with two different alternatives (<xref target="RFC7400"/> and <xref target="raza-6lo-compressed-dtls"/>) for header compression.</t>

</section>
<section anchor="overhead" title="Overhead of Security Protocols">

<t>To enable comparison, all the overhead calculations in this section use AES-CCM with a tag length of 8 bytes, a plaintext of 6 bytes, and the sequence number ‘05’. This follows the example in <xref target="RFC7400"/>, Figure 16.</t>

<section anchor="dtls12" title="DTLS 1.2">

<t>This example is taken directly from <xref target="RFC7400"/>, Figure 16. The nonce follow the strict profiling given in <xref target="RFC7925"/>.</t>

<figure><artwork align="left"><![CDATA[
DTLS 1.2 Record Layer (35 bytes, 29 bytes overhead):
17 fe fd 00 01 00 00 00 00 00 05 00 16 00 01 00
00 00 00 00 05 ae a0 15 56 67 92 4d ff 8a 24 e4
cb 35 b9

Content type:
17
Version:
fe fd
Epoch:
00 01
Sequence number:
00 00 00 00 00 05
Length:
00 16
Nonce:
00 01 00 00 00 00 00 05
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>DTLS 1.2 gives 29 bytes overhead.</t>

</section>
<section anchor="dtls12GHC" title="DTLS 1.2 with 6LoWPAN-GHC">

<t>Note that the compressed overhead is dependent on the parameters epoch, sequence number, and length. The following is only an example.</t>

<t>Note that the sequence number ‘01’ used in <xref target="RFC7400"/>, Figure 15 gives an exceptionally small overhead that is not representative at all.</t>

<t>Note that this header compression is not available when DTLS is exchanged over transports that do not use 6LoWPAN together with 6LoWPAN-GHC.</t>

<figure><artwork align="left"><![CDATA[
Compressed DTLS 1.2 Record Layer (22 bytes, 16 bytes overhead):
b0 c3 03 05 00 16 f2 0e ae a0 15 56 67 92 4d ff
8a 24 e4 cb 35 b9

Compressed DTLS 1.2 Record Layer Header and Nonce:
b0 c3 03 05 00 16 f2 0e
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>When compressed with 6LoWPAN-GHC, DTLS 1.2 with the above parameters (epoch, sequence number, length) gives 16 bytes overhead.</t>

</section>
<section anchor="dtls12raza" title="DTLS 1.2 with raza-6lo-compressed-dtls">

<t>Note that the compressed overhead is dependent on the parameters epoch and sequence number. The following is only an example.</t>

<t>Note that this header compression is not available when DTLS is exchanged over transports that do not use 6LoWPAN together with raza-6lo-compressed-dtls.</t>

<figure><artwork align="left"><![CDATA[
Compressed DTLS 1.2 Record Layer (19 bytes, 13 bytes overhead):
90 17 01 00 05 ae a0 15 56 67 92 4d ff 8a 24 e4
cb 35 b9

NHC
90
Compressed DTLS 1.2 Record Layer Header and Nonce:
17 01 00 05 
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>When compressed with raza-6lo-compressed-dtls, DTLS 1.2 with the above parameters (epoch, sequence number) gives 13 bytes overhead.</t>

</section>
<section anchor="dtls13" title="DTLS 1.3">

<t>The only change compared to DTLS 1.2 is that the DTLS 1.3 record layer does not have an explicit nonce.</t>

<figure><artwork align="left"><![CDATA[
DTLS 1.3 Record Layer (27 bytes, 21 bytes overhead):
17 fe fd 00 01 00 00 00 00 00 05 00 0e ae a0 15
56 67 92 4d ff 8a 24 e4 cb 35 b9

Content type:
17
Version:
fe fd
Epoch:
00 01
Sequence number:
00 00 00 00 00 05
Length:
00 0e
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>DTLS 1.3 gives 21 bytes overhead.</t>

</section>
<section anchor="dtls13GHC" title="DTLS 1.3 with 6LoWPAN-GHC">

<t>Note that the overhead is dependent on the parameters epoch, sequence number, and length. The following is only an example.</t>

<t>Note that this header compression is not available when DTLS is exchanged over transports that do not use 6LoWPAN together with 6LoWPAN-GHC.</t>

<figure><artwork align="left"><![CDATA[
Compressed DTLS 1.3 Record Layer (20 bytes, 14 bytes overhead):
b0 c3 11 05 00 0e ae a0 15 56 67 92 4d ff 8a 24
e4 cb 35 b9
    
Compressed DTLS 1.3 Record Layer Header and Nonce:
b0 c3 11 05 00 0e
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>When compressed with 6LoWPAN-GHC, DTLS 1.3 with the above parameters (epoch, sequence number, length) gives 14 bytes overhead.</t>

</section>
<section anchor="dtls13raza" title="DTLS 1.3 with raza-6lo-compressed-dtls">

<t>Note that the compressed overhead is dependent on the parameters epoch and sequence number. The following is only an example.</t>

<t>Note that this header compression is not available when DTLS is exchanged over transports that do not use 6LoWPAN together with raza-6lo-compressed-dtls.</t>

<t>Note that this header compression is not available when DTLS is exchanged over transports that do not use 6LoWPAN together with raza-6lo-compressed-dtls.</t>

<figure><artwork align="left"><![CDATA[
Compressed DTLS 1.3 Record Layer (19 bytes, 13 bytes overhead):
90 17 01 00 05 ae a0 15 56 67 92 4d ff 8a 24 e4
cb 35 b9

NHC
90
Compressed DTLS 1.3 Record Layer Header and Nonce:
17 01 00 05 
c3 03 05 00 16 f2 0e
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>When compressed with raza-6lo-compressed-dtls, DTLS 1.3 with the above parameters (epoch, sequence number) gives 13 bytes overhead.</t>

</section>
<section anchor="tls12" title="TLS 1.2">

<t>The changes compared to DTLS 1.2 is that the TLS 1.2 record layer does not have epoch and sequence number, and that the version is different.</t>

<figure><artwork align="left"><![CDATA[
TLS 1.2 Record Layer (27 bytes, 21 byte overhead):
17 03 03 00 16 00 00 00 00 00 00 00 05 ae a0 15
56 67 92 4d ff 8a 24 e4 cb 35 b9

Content type:
17
Version:
03 03
Length:
00 16
Nonce:
00 00 00 00 00 00 00 05
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>TLS 1.2 gives 21 bytes overhead.</t>

</section>
<section anchor="tls12GHC" title="TLS 1.2 with 6LoWPAN-GHC">

<t>Note that the overhead is dependent on the parameters epoch, sequence number, and length. The following is only an example.</t>

<t>Note that this header compression is not available when TLS is exchanged over transports that do not use 6LoWPAN together with 6LoWPAN-GHC.</t>

<figure><artwork align="left"><![CDATA[
Compressed TLS 1.2 Record Layer (23 bytes, 17 bytes overhead):
05 17 03 03 00 16 85 0f 05 ae a0 15 56 67 92 4d
ff 8a 24 e4 cb 35 b9
    
Compressed TLS 1.2 Record Layer Header and Nonce:
05 17 03 03 00 16 85 0f 05
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>When compressed with 6LoWPAN-GHC, TLS 1.2 with the above parameters (epoch, sequence number, length) gives 17 bytes overhead.</t>

</section>
<section anchor="tls13" title="TLS 1.3">

<t>The change compared to TLS 1.2 is that the TLS 1.3 record layer uses a different version.</t>

<figure><artwork align="left"><![CDATA[
TLS 1.3 Record Layer (27 bytes, 21 byte overhead):
17 03 01 00 16 00 00 00 00 00 00 00 05 ae a0 15
56 67 92 4d ff 8a 24 e4 cb 35 b9

Content type:
17
Version:
03 01
Length:
00 16
Nonce:
00 00 00 00 00 00 00 05
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>TLS 1.3 gives 21 bytes overhead.</t>

</section>
<section anchor="tls13GHC" title="TLS 1.3 with 6LoWPAN-GHC">

<t>Note that the overhead is dependent on the parameters epoch, sequence number, and length. The following is only an example.</t>

<t>Note that this header compression is not available when TLS is exchanged over transports that do not use 6LoWPAN together with 6LoWPAN-GHC.</t>

<figure><artwork align="left"><![CDATA[
Compressed TLS 1.3 Record Layer (23 bytes, 17 bytes overhead):
02 17 03 c3 01 16 85 0f 05 ae a0 15 56 67 92 4d
ff 8a 24 e4 cb 35 b9
    
Compressed TLS 1.3 Record Layer Header and Nonce:
02 17 03 c3 01 16 85 0f 05
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>When compressed with 6LoWPAN-GHC, TLS 1.3 with the above parameters (epoch, sequence number, length) gives 17 bytes overhead.</t>

</section>
<section anchor="oscoap" title="OSCOAP">

<t>Note that the overhead is dependent on the included CoAP Option numbers, if the CoAP method allows payload, as well as the length of the OSCOAP parameters Sender ID and sequence number. The below calculation uses Method = POST, Option Delta = ‘9’, and Sender ID = ‘25’, and is only an example.</t>

<figure><artwork align="left"><![CDATA[
OSCOAP Request (19 bytes, 13 bytes overhead):
90 19 05 41 25 ae a0 15 56 67 92 4d ff 8a 24 e4
cb 35 b9

CoAP Delta and Option Length:
90
Compressed COSE Header:
19 05 41 25
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<figure><artwork align="left"><![CDATA[
OSCOAP Response (15 bytes, 9 bytes overhead):
90 ae a0 15 56 67 92 4d ff 8a 24 e4 cb 35 b9

CoAP Delta and Option Length:
90
Ciphertext:
ae a0 15 56 67 92
ICV:
4d ff 8a 24 e4 cb 35 b9
]]></artwork></figure>

<t>OSCOAP with the above parameters gives 13 bytes overhead for requests and 9 bytes overhead for responses.</t>

<t>Unlike DTLS and TLS, OSCOAP has much smaller overhead for responses than requests.</t>

</section>
</section>
<section anchor="diffseqnum" title="Overhead with Different Sequence Numbers">

<t>The compression overhead (GHC) is dependent on the parameters epoch, sequence number, and length. The following overheads should be representative for sequence numbers with the same length.</t>

<t>The compression overhead (raza-6lo-compressed-dtls) is dependent on the length of the parameters epoch and sequence number. The following overheads apply for all sequence numbers with the same length.</t>

<t>The OSCOAP overhead is dependent on the included CoAP Option numbers, if the CoAP method allows payload, as well as the length of the OSCOAP parameters Sender ID and sequence number.</t>

<figure title="Overhead as a function of sequence number" anchor="fig-overhead"><artwork align="center"><![CDATA[
Sequence Number             '05'       '1005'     '100005'
----------------------------------------------------------
DTLS 1.2                     29          29          29
DTLS 1.3                     21          21          21
TLS  1.2                     21          21          21
TLS  1.3                     21          21          21
----------------------------------------------------------
DTLS 1.2 (GHC)               16          16          17
DTLS 1.2 (Raza)              13          13          14
DTLS 1.3 (GHC)               14          14          15
DTLS 1.3 (Raza)              13          13          14
TLS  1.2 (GHC)               17          18          19
TLS  1.3 (GHC)               17          18          19
----------------------------------------------------------
OSCOAP Request               13          14          15
OSCOAP Response               9           9           9
]]></artwork></figure>

</section>
<section anchor="summary" title="Summary">

<t>DTLS 1.2 has quite a large overhead as it uses an explicit sequence number and an explicit nonce. DTLS 1.3, TLS 1.2, and TLS 1.3 have significantly less overhead.</t>

<t>Both DTLS compression methods provides very good compression. raza-6lo-compressed-dtls achieves slightly better compression but requires state. GHC is stateless but provides slightly worse compression. As DTLS 1.3 uses the same version number as DTLS 1.2, both GHC and raza-6lo-compressed-dtls works well also for DTLS 1.3.</t>

<t>The Generic Header Compression (6LoWPAN-GHC) is not very generic (the static dictionary is more or less a DTLS record layer) and the compression of TLS is significantly worse than the compression of DTLS. Similar compression levels as for DTLS could be achieved also for TLS, but this would require different static dictionaries for each version of TLS (as TLS 1.2 and TLS 1.3 uses different version numbers).</t>

<t>The header compression is not available when (D)TLS is exchanged over transports that do not use 6LoWPAN together with 6LoWPAN-GHC or raza-6lo-compressed-dtls.</t>

<t>OSCOAP has much lower overhead than DTLS and TLS. The overhead of OSCOAP is smaller than DTLS over 6LoWPAN with compression, and this small overhead is achieved even on deployments without 6LoWPAN or 6LoWPAN without DTLS compression. OSCOAP is lightweight because it makes use of some excellent features in CoAP, CBOR, and COSE.</t>

</section>
<section anchor="sec-cons" title="Security Considerations">

<t>This document is purely informational.</t>

</section>
<section anchor="acknowledgments" title="Acknowledgments">

<t>The authors want to thank Ari Keränen for reviewing previous versions of the draft.</t>

</section>


  </middle>

  <back>


    <references title='Informative References'>

&RFC5246;
&RFC6347;
&RFC7400;
&RFC7252;
&RFC7925;
&I-D.ietf-tls-tls13;
&I-D.rescorla-tls-dtls13;
&I-D.ietf-core-coap-tcp-tls;
&I-D.ietf-core-object-security;
<reference anchor="raza-6lo-compressed-dtls" target="http://shahidraza.info/draft-raza-6lo-compressed.txt">
  <front>
    <title>Compression of Record and Handshake Headers for Constrained Environments</title>
    <author initials="S." surname="Raza">
      <organization></organization>
    </author>
    <author initials="H." surname="Shafagh">
      <organization></organization>
    </author>
    <author initials="O." surname="Dupont">
      <organization></organization>
    </author>
    <date year="2017" month="March"/>
  </front>
</reference>


    </references>



  </back>
</rfc>

