Constrained Application Protocol: Difference between revisions

Content deleted Content added
Implementations: Added RFC 7641, RFC 7959 to the list of implemented standards for node-coap (see the README file on Github)
ce
 
(41 intermediate revisions by 27 users not shown)
Line 1:
{{Short description|Specialized Internet application protocol}}
{{IP stack}}
 
'''Constrained Application Protocol''' ('''CoAP''') is a specialized [[User Datagram Protocol|UDP-based]] Internet application protocol for constrained devices, as defined in [https://datatracker.ietf.org/doc/html/rfc7252 RFC 7252] (published in 2014). It enables those constrained devices called "nodes" to communicate with the wider Internet using similar protocols.
CoAP is designed for use between devices on the same constrained network (e.g., low-power, lossy networks), between devices and general nodes on the Internet, and between devices on different constrained networks both joined by an internet. CoAP is also being used via other mechanisms, such as SMS on mobile communication networks.
 
CoAP is a [[servicean application-layer]] protocol that is intended for use in resource-constrained internetInternet devices, such as [[wireless sensor network]] nodes. CoAP is designed to easily translate to [[HTTP]] for simplified integration with the web, while also meeting specialized requirements such as [[multicast]] support, very low overhead, and simplicity.<ref>[https://tools.ietf.org/html/rfc7252 RFC 7252, Constrained Application Protocol (CoAP)]</ref><ref>"[http://hinrg.cs.jhu.edu/joomla/images/stories/IPSN_2011_koliti.pdf Integrating Wireless Sensor Networks with the Web] {{Webarchive|url=https://web.archive.org/web/20170830060917/http://hinrg.cs.jhu.edu/joomla/images/stories/IPSN_2011_koliti.pdf |date=2017-08-30 }}" , Walter, Colitti 2011</ref> Multicast, low overhead, and simplicity are important for [[Internet of things]] (IoT) and [[machine-to-machine]] (M2M) communication, which tend to be deeply [[Embedded system|embedded]] and have much less memory and power supply than traditional internetInternet devices have. Therefore, efficiency is very important. CoAP can run on most devices that support [[User Datagram Protocol|UDP]] or a UDP analogue.
 
The Internet Engineering Task Force ([[IETF]]) Constrained [[RESTful]] Environments Working Group ([https://datatracker.ietf.org/doc/charter-ietf-core/ CoRE]) has done the major standardization work for this protocol. In order to make the protocol suitable to IoT and M2M applications, various new functions have been added.
 
== Specification ==
The core of the protocol is specified in RFC{{IETF RFC|7252}}. Various extensions have been proposed, particularly:
* {{IETF RFC|7641}} (2015) Observing Resources in the Constrained Application Protocol
* {{IETF RFC|7959}} (2016) Block-Wise Transfers in the Constrained Application Protocol (CoAP)
Line 16 ⟶ 17:
 
==Message formats==
The smallest CoAP message is 4 bytes in length, if omitting Token, Options and Payload. CoAP makes use of two message types, requests and responses, using a simple, binary, base header format. The base header may be followed by options in an optimized Type-Length-Value format. CoAP is by default bound to [[User Datagram Protocol|UDP]] and optionally to [[DTLS]], providing a high level of communications security. When bound to UDP, the entire message ''must'' fit within a single datagram. When used with [[6LoWPAN]] as defined in RFC 4944, messages ''should'' fit into a single [[IEEE 802.15.4]] frame to minimize fragmentation.
 
The smallest CoAP message is 4 bytes in length, if the token, options and payload fields are omitted, i.e. if it only consists of the CoAP header. The header is followed by the token value (0 to 8 bytes) which may be followed by a list of options in an optimized type–length–value format. Any bytes after the header, token and options (if any) are considered the message payload, which is prefixed by the one-byte "payload marker" (0xFF). The length of the payload is implied by the datagram length.
Any bytes after the headers in the packet are considered the message body. The length of the message body is implied by the datagram length. When bound to UDP, the entire message MUST fit within a single datagram. When used with [[6LoWPAN]] as defined in RFC 4944, messages SHOULD fit into a single [[IEEE 802.15.4]] frame to minimize fragmentation.
{| class="wikitable" style="margin: 0 auto; text-align:center"
|+ CoAP HeaderMessage
! Offsets !! [[Octet (computing)|Octet]] offset !! !! colspan="8" | 0 !! colspan="8" | 1 !! colspan="8" | 2 !! colspan="8" | 3
|-
! Octet !! [[Bit (computing)|Bit]] offset !! 0 !! 1 !! 2 !! 3 !! 4 !! 5 !! 6 !! 7 !! 8 !! 9 !! 10 !! 11 !! 12 !! 13 !! 14 !! 15 !! 16 !! 17 !! 18 !! 19 !! 20 !! 21 !! 22 !! 23 !! 24 !! 25 !! 26 !! 27 !! 28 !! 29 !! 30 !! 31
|-
! 4 !! 32
| colspan="2" | VERver || colspan="2" | Typetype || colspan="4" | Tokentoken Lengthlength || colspan="8" | Requestrequest/Responseresponse Codecode || colspan="16" |Message message ID
|-
! 8 !! 64
| colspan="32" rowspan="2" | Tokentoken (0 - 80–8 bytes)
|-
! 12 !! 96
|-
! 16 !! 128
| colspan="32" | Optionsoptions (Ifif Availableavailable)
|-
! 20 !! 160
| 1 || 1 || 1 || 1 || 1 || 1 || 1 || 1 || colspan="24" | Payloadpayload (Ifif Availableavailable)
|}
 
=== CoAP fixed-size header ===
=== CoAP Fixed Header: Version, Type, Token Length, Request/Response Code and Message ID. ===
The first 4 bytes are mandatory in all CoAP datagrams, they constitute the fixed-size header.
 
These fields can be easily extracted from these 4 bytes in C via these macros:
<syntaxhighlight lang="c">
#define COAP_HEADER_VERSION(data) ( (0xC0 & (data)[0]) >> 6 )
#define COAP_HEADER_TYPE(data) ( (0x30 & (data)[0]) >> 4 )
#define COAP_HEADER_TKL(data) ( (0x0F & (data)[0]) >> 0 )
#define COAP_HEADER_CLASS(data) ( ((data)[1] >> 5) & 0x07) )
#define COAP_HEADER_CODE(data) ( ((data)[1] >> 0) & 0x1F) )
#define COAP_HEADER_MID(data) ( ((data)[2] << 8) | (data)[3]) )
</syntaxhighlight>
 
==== Version (VERver) (2 bits) ====
 
:Indicates the CoAP version number.
Line 60 ⟶ 62:
:This describes the datagram's message type for the two message type context of Request and Response.
:* Request
:** 0 : Confirmable : This message expects a corresponding Acknowledgementacknowledgement message.
:** 1 : Non-confirmable : This message does not expect a confirmation message.
:* Response
Line 66 ⟶ 68:
:** 3 : Reset : This message indicates that it had received a message but could not process it.
 
==== Token Lengthlength (4 bits) ====
 
:Indicates the length of the variable-length Token field, which may be 0-80–8 bytes in length.
 
==== Request/Responseresponse Codecode (8 bits) ====
{| class="wikitable"
!0
Line 125 ⟶ 127:
| Unsupported Content-Format
}}
* Server Errorerror: 5.XX {{ordered list|start=0
| Internal Serverserver Errorerror
| Not Implementedimplemented
| Bad Gatewaygateway
| Service Unavailableunavailable
| Gateway Timeouttimeout
| Proxying Notnot Supportedsupported
}}
* Signaling Codes: 7.XX {{ordered list|start=0
Line 145 ⟶ 147:
==== Message ID (16 bits) ====
 
:Used to detect message duplication and to match messages of type Acknowledgementacknowledgement/Resetreset to messages of type Confirmableconfirmable/Nonnon-confirmable.:Response messages will have the same Message ID as request.
 
=== Token ===
OptionalEvery fieldrequest whosecarries sizea istoken indicated(but byit themay Tokenbe Lengthzero field,length) whose valuesvalue iswas generated by the client. The server must echo every token value without any modification back to the client in the corresponding response. It is intended for use as a client-local identifier to providematch extrarequests contextand forresponses, certainespecially for concurrent transactionsrequests.
 
Matching requests and responses is not done with the message ID because a response may be sent in a different message than the acknowledgement (which uses the message ID for matching). For example, this could be done to prevent retransmissions if obtaining the result takes some time. Such a detached response is called "separate response". In contrast, transmitting the response directly in the acknowledgement is called "piggybacked response" which is expected to be preferred for efficiency reasons.
 
=== Option ===
{| class="wikitable"
|+Option Format
! colspan="8" |Bit Positionsposition
|-
!0
Line 164 ⟶ 168:
!7
|-
| colspan="4" |Option Deltadelta
| colspan="4" |Option Lengthlength
|-
| colspan="8" |Option Deltadelta Extendedextended (Nonenone, 8 bits, 16 bits)
|-
| colspan="8" |Option Lengthlength Extendedextended (Nonenone, 8 bits, 16 bits)
|-
| colspan="8" |Option Valuevalue
|}
Option Deltadelta:
 
* 0 to 12: For delta between 0 toand 12: Represents the exact delta value between the last option ID and the desired option ID, with no Optionoption Deltadelta Extendedextended value
* 13: For delta from 13 to 268: Option Deltadelta Extendedextended is an 8-bit value that represents the Optionoption Deltadelta value minus 13
* 14: For delta from 269 to 65,804: Option Deltadelta Extendedextended is a 16-bit value that represents the Optionoption Deltadelta value minus 269
* 15: Reserved for Payloadpayload Markermarker, where the Optionoption Deltadelta and Optionoption Lengthlength are set together as 0xFF.
 
Option Lengthlength:
 
* 0 to 12: For Optionoption Lengthlength between 0 toand 12: Represents the exact length value, with no Optionoption Lengthlength Extendedextended value
* 13: For Optionoption Lengthlength from 13 to 268: Option Lengthlength Extendedextended is an 8-bit value that represents the Optionoption Lengthlength value minus 13
* 14: For Optionoption Lengthlength from 269 to 65,804: Option Lengthlength Extendedextended is a 16-bit value that represents the Optionoption Lengthlength value minus 269
* 15: Reserved for future use. It is an error iffor Optionthe Lengthoption length field isto be set to 0xFF.
 
Option Valuevalue:
 
* Size of Optionoption Valuevalue field is defined by Optionoption Lengthlength value in bytes.
* Semantic and format this field depends on the respective option.
 
==ProxyActive protocol implementations==
==Implementations==
{| class="wikitable sortable"
|-
! Name !! Programming Language !! Implemented CoAP version !! Client/Server !! Implemented CoAP features !! License !! Link
|-
| aiocoapcoap || Python 3Dart || RFC 7252 || Client + Server || Blockwise Transfers, Observe, Multicast, Proxying (partial) || MIT || https://pypi.pythongithub.orgcom/pypishamblett/aiocoapcoap
|-
| Californiumaiocoap || JavaPython 3 || RFC 7252, RFC 7641, RFC 7959, RFC 8323, RFC 7967, RFC 8132, RFC 9176, RFC 8613, RFC 9528|| Client + Server || Observe, Blockwise Transfers, MulticastObserve (since 2.x), DTLS (+ DTLS 1.2 Connection IDpartial) || EPL+EDLMIT || {{URL|https://wwwpypi.eclipsepython.org/californium https://github.com/eclipsepypi/californiumaiocoap}}
|-
| cantcoapCalifornium || C++/CJava || RFC 7252, RFC 7641, RFC 7959|| Client + Server || Observe, Blockwise Transfers, Multicast (since 2.x), DTLS (+ DTLS 1.2 Connection ID) || BSDEPL+EDL || {{URL|https://www.eclipse.org/californium}} {{URL|https://github.com/staroprameclipse/cantcoapcalifornium}}
|-
| CanopusCoAPSharp || [[GoC#, (programming language)|Go]].NET || RFC 7252 || Client + Server || Core, ||Observe, ApacheBlock, LicenseRD 2.0|| MIT || {{URL|http://www.coapsharp.com https://github.com/zubairhamedFemtomaxInc/canopuscoapsharp}}
|-
| Go-CoAPFreeCoAP || [[Go (programming language)|Go]]C || RFC 7252, RFC 8232, RFC 7641, RFC 7959 || Client + Server + HTTP/CoAP Proxy || Core, ObserveDTLS, Blockwise, Multicast, TCP/TLSTransfers || Apache License 2.0BSD || {{URL|https://github.com/gokeith-ocfcullen/go-coapFreeCoAP}}
|-
| Go-CoAP implementation for Go || [[Go (programming language)|Go]] || RFC 7252, RFC 8232, RFC 7641, RFC 7959|| Client + Server || Core, +Observe, DraftBlockwise, SubscribeMulticast, TCP/TLS || MITApache License 2.0 || {{URL|https://github.com/dustinplgd-dev/go-coap}}
|-
| CoAP.NETjava-coap || C#Java || RFC 7252, coap-13RFC 7641, coap-08RFC 7959, coap-03RFC 8323|| Client + Server || Core, Observe, Blockwise Transfers || 3-clauseApache BSDLicense 2.0 || {{URL|https://github.com/smeshlinkPelionIoT/CoAP.NETjava-coap}}
|-
| CoAPSharplibcoap || C#, .NET || RFC 7252, RFC 7390, RFC 7641, RFC 7959, RFC 7967, RFC 8132, RFC 8323, RFC 8516, RFC 8613, RFC 8768, RFC 8974, RFC 9175, RFC 9177|| Client + Server || Core, Observe, BlockMulticast, RDBlockwise Transfers, Patch/Fetch, OSCORE, (D)TLS || LGPLBSD/GPL || httphttps://www.coapsharpgithub.com/obgm/libcoap
|-
|libcoapy
| CoAPthon || Python || RFC 7252 || Client + Server + Forward Proxy + Reverse Proxy || Observe, Multicast server discovery, CoRE Link Format parsing, Block-wise || MIT || https://github.com/Tanganelli/CoAPthon
|Python
| colspan="3" |same support as libcoap
|MIT
|{{URL|https://github.com/anyc/libcoapy}}
|-
| CoAP Shelllobaro-coap || JavaC || RFC 7252 || Client + Server || Observe, Blockwise Transfers, DTLS || Apache License 2.0MIT || https{{URL|http://githubwww.lobaro.com/tzolov/lobaro-coap-shell }}
|-
| CoppermicroCoAPy || JavaScript (Browser Plugin)MicroPython || RFC 7252 || Client + Server || Observe, Blockwise TransfersCore || 3-clauseApache BSDLicense 2.0 || {{URL|https://github.com/mkovatscinsighio/Copper https://addons.mozilla.org/firefox/addon/copper-270430/{{Dead link|date=July 2019 |bot=InternetArchiveBot |fix-attempted=yes microCoAPy}}
|-
| eCoAPnanoCoAP || C || RFC 7252 || Client + Server || Core, Blockwise Transfers, DTLS || MITLGPL || {{URL|https://gitlabapi.comriot-os.org/jobol/ecoapgroup__net__nanocoap.html}}
|-
| node-coap || JavascriptJavaScript || RFC 7252,
| Erbium for Contiki || C || RFC 7252 || Client + Server || Observe, Blockwise Transfers || 3-clause BSD || http://www.contiki-os.org/ (er-rest-example)
RFC 7641, RFC 7959
| Client + Server || Core, Observe, Block || MIT || {{URL|https://github.com/mcollina/node-coap}}
|-
| FreeCoAPQt CoAP || C++ || RFC 7252 || Client + Server + HTTP/CoAP Proxy || Core, DTLSObserve, Blockwise Transfers || BSDGPL, Commercial || https://githubdoc.comqt.io/keithqt-cullen6/FreeCoAPqtcoap-index.html
|-
| iCoAPcoap-rs || Objective-CRust || RFC 7252 || Client + Server || Core, Multicast, Observe option, Blockwise''Too TransfersMany Requests'' Response Code || MIT || {{URL|https://github.com/stuffrabbitCovertness/iCoAPcoap-rs}}
{{URL|https://docs.rs/coap/}}
|-
|}
| java-coap || Java || RFC 7252, RFC 7641, RFC 7959, RFC 8323 || Client + Server || || Apache License 2.0 || https://github.com/PelionIoT/java-coap
 
==Proxy implementations==
There exist [[Proxy server|proxy]] implementations which provide [[Forward proxy|forward]] or [[Reverse proxy|reverse]] proxy functionality for the CoAP protocol and also implementations which translate between protocols like HTTP and CoAP.
 
The following projects provide proxy functionality:
* [http://telecom.dei.unipd.it/pages/read/90/ Squid 3.1.9 with transparent HTTP-CoAP mapping module]
* [https://code.google.com/p/jcoap/ jcoap Proxy]
* [https://github.com/eclipse/californium/tree/master/californium-proxy2 Californium cf-proxy2]
* [https://github.com/Tanganelli/CoAPthon CoAPthon]
* [https://github.com/keith-cullen/FreeCoAP FreeCoAP]
* [https://github.com/obgm/libcoap libcoap]
 
==Projects using CoAP==
{| class="wikitable sortable"
|-
! Name !! Programming Language !! Implemented CoAP version !! Client/Server !! Implemented CoAP features !! License !! Link
| jCoAP || Java || RFC 7252 || Client + Server || Observe, Blockwise Transfers || Apache License 2.0 || https://code.google.com/p/jcoap/
|-
| libcoapCoAP Shell || CJava || RFC 7252 || Client + Server || Observe, Blockwise Transfers, DTLS || BSD/GPLApache License 2.0 || https://github.com/obgmtzolov/libcoapcoap-shell
|-
| LibNyociCopper || JavaScript C(browser plugin) || RFC 7252 || Client + Server || Core, Observe, Block,Blockwise DTLSTransfers || MIT3-clause BSD || https://github.com/darconeousmkovatsc/libnyociCopper https://addons.mozilla.org/firefox/addon/copper-270430/{{Dead link|date=July 2019 |bot=InternetArchiveBot |fix-attempted=yes }}
|-
|}
| lobaro-coap || C || RFC 7252 || Client + Server ||Observe, Blockwise Transfers || MIT || http://www.lobaro.com/lobaro-coap
 
==Inactive protocol implementations==
{| class="wikitable sortable"
|-
! Name !! Programming Language !! Implemented CoAP version !! Client/Server !! Implemented CoAP features !! License !! Link
| microcoap || C || RFC 7252 || Client + Server || || MIT || https://github.com/1248/microcoap
|-
| microCoAPycantcoap || MicroPythonC++/C || RFC 7252 || Client + Server || Core || Apache License 2.0BSD || https://github.com/insighiostaropram/microCoAPycantcoap
|-
| nanocoapCanopus || C[[Go (programming language)|Go]] || RFC 7252 || Client + Server || Core, Blockwise Transfers || LGPLApache License 2.0 || https://apigithub.riot-os.orgcom/group__net__nanocoap.htmlzubairhamed/canopus
|-
| nCoapCoAP implementation for Go || Java [[Go (programming language)|Go]] || RFC 7252 || Client + Server || Observe,Core Blockwise+ Transfers,Draft CoRE Link Format, [https://tools.ietf.org/html/draft-kleine-core-coap-endpoint-id-01 Endpoint-ID-Draft]Subscribe || BSDMIT || https://github.com/okleinedustin/nCoAPgo-coap
|-
| Erbium for ContikiCoAP.NET || C# || RFC 7252, coap-13, coap-08, coap-03 || Client + Server || Core, Observe, Blockwise Transfers || 3-clause BSD || httphttps://wwwgithub.contiki-oscom/smeshlink/CoAP.org/ (er-rest-example)NET
| node-coap || Javascript || RFC 7252,
RFC 7641, RFC 7959
| Client + Server || Core, Observe, Block || MIT || https://github.com/mcollina/node-coap
|-
| Ruby coapCoAPthon || RubyPython || RFC 7252 || Client + Server (david)+ Forward Proxy + Reverse Proxy || CoreObserve, ObserveMulticast server discovery, BlockCoRE Link Format parsing, RDBlock-wise || MIT, GPL || https://github.com/nning/coap<br/>https://github.com/nningTanganelli/davidCoAPthon
|-
| Sensinode C Device LibraryeCoAP || C || RFC 7252 || Client + Server || Core, Observe, Block, RD || CommercialMIT || https://silver.armgitlab.com/browsejobol/SEN00ecoap
|-
| SensinodeErbium Javafor Device LibraryContiki || Java SEC || RFC 7252 || Client + Server || Core, Observe, Block,Blockwise RDTransfers || Commercial3-clause BSD || httpshttp://silverwww.armcontiki-os.comorg/browse/SEN00 (er-rest-example)
|-
| Sensinode NanoService Platformguile-coap || Java SEGuile || RFC 7252, RFC 8323 || CloudClient + Server || Core, Observe, Block, RD || CommercialGPL-3.0-or-later || https://silver.armcodeberg.comorg/browseeris/SEN00guile-coap
|-
| SwiftCoAPiCoAP || SwiftObjective-C || RFC 7252 || Client + Server || Core, Observe, Blockwise Transfers || MIT || https://github.com/stuffrabbit/SwiftCoAPiCoAP
|-
| TinyOS CoapBlipjCoAP || nesC/CJava || coap-13RFC 7252|| Client + Server || Observe, Blockwise Transfers || BSDApache License 2.0 || https://webcode.archivegoogle.orgcom/webp/20130312140509/http://docs.tinyos.net/tinywiki/index.phpjcoap/CoAP
|-
| txThingsLibNyoci || Python (Twisted)C || RFC 7252 || Client + Server || Blockwise Transfers Core, Observe, Block, (partial)DTLS || MIT || https://github.com/mwasilak/txThingsdarconeous/libnyoci
|-
| java-coapmicrocoap || JavaC || RFC 7252, RFC 7641, RFC 7959, RFC 8323 || Client + Server || || Apache License 2.0MIT || https://github.com/PelionIoT1248/java-coapmicrocoap
|-
| nCoap || Java || RFC 7252|| Client + Server || Observe, Blockwise Transfers, CoRE Link Format, [https://tools.ietf.org/html/draft-kleine-core-coap-endpoint-id-01 Endpoint-ID-Draft] || BSD || https://github.com/okleine/nCoAP
|-
| microcoapRuby coap || CRuby || RFC 7252 || Client + Server (david) || Core, Observe, Block, RD || MIT, GPL || https://github.com/1248nning/coap<br/>https://github.com/nning/microcoapdavid
|-
| lobaro-coapSensinode C Device Library || C || RFC 7252 || Client + Server || Core, Observe, BlockwiseBlock, TransfersRD || MITCommercial || httphttps://wwwsilver.lobaroarm.com/lobaro-coapbrowse/SEN00
|-
| Sensinode Java Device Library || Java SE || RFC 7252|| Client + Server || Core, Observe, Block, RD || Commercial || https://silver.arm.com/browse/SEN00
|-
| Sensinode NanoService Platform || Java SE || RFC 7252|| Cloud Server || Core, Observe, Block, RD || Commercial || https://silver.arm.com/browse/SEN00
|-
| jCoAPSwiftCoAP || JavaSwift || RFC 7252 || Client + Server || Core, Observe, Blockwise Transfers || Apache License 2.0MIT || https://code.googlegithub.com/p/jcoapstuffrabbit/SwiftCoAP
|-
| TinyOS CoapBlip || nesC/C || coap-13 || Client + Server || Observe, Blockwise Transfers || BSD || https://web.archive.org/web/20130312140509/http://docs.tinyos.net/tinywiki/index.php/CoAP
|-
| coap-rstxThings || RustPython (Twisted) || RFC 7252 || Client + Server || Core,Blockwise MulticastTransfers, Observe option, ''Too Many Requests'' Response Code(partial) || MIT || https://github.com/Covertnessmwasilak/txThings/coap-rs
https://docs.rs/coap/
|-
| YaCoAP || C || || || || MIT || https://github.com/RIOT-Makers/YaCoAP
|-
|}
 
==Proxy implementations==
* [http://telecom.dei.unipd.it/pages/read/90/ Squid 3.1.9 with transparent HTTP-CoAP mapping module]
* [https://code.google.com/p/jcoap/ jcoap Proxy]
* [https://github.com/eclipse/californium/tree/master/californium-proxy2 Californium cf-proxy2]
* [https://github.com/Tanganelli/CoAPthon CoAPthon]
* [https://github.com/keith-cullen/FreeCoAP FreeCoAP]
 
==CoAP group communication==
Line 288 ⟶ 322:
 
== Security ==
CoAP defines four security modes:<ref> [https://tools.ietf.org/html/rfc7252 RFC 7252, Constrained Application Protocol (CoAP)]</ref>
* NoSec, where [[DTLS]] is disabled
* PreSharedKey, where DTLS is enabled, there is a list of pre-shared keys, and each key includes a list of which nodes it can be used to communicate with. Devices must support the AES cipher suite.
Line 294 ⟶ 328:
* Certificate, where DTLS is enabled and the device uses [[X.509]] certificates for validation.
 
Research has been conducted on optimizing DTLS by implementing security associates as CoAP resources rather than using DTLS as a security wrapper for CoAP traffic. This research has indicated that improvements of up to 6.5 times none optimized implementations. <ref name="Security as a CoAP resource: An optimized DTLS implementation for the IoT">{{cite journalbook |lastlast1=Capossele |firstfirst1=Angelo |last2=Cervo |first2=Valerio |last3=De Cicco |first3=Gianluca |last4=Petrioli |first4=Chiara |datetitle=June 2015 IEEE International Conference on Communications (ICC) |titlechapter=Security as a CoAP resource: An optimized DTLS implementation for the IoT |journalauthor4-link= Chiara Petrioli |date=June 2015 |publisher=IEEE |pages=529–554 |doi= 10.1109/ICC.2015.7248379|isbn=978-1-4673-6432-4 |s2cid=12568959 }}</ref>
 
In addition to DTLS, RFC8613<ref>{{Cite webjournal|lastlast1=Palombini|firstfirst1=Francesca|last2=Seitz|first2=Ludwig|last3=Selander|first3=Goeran|last4=Mattsson|first4=John|title=Object Security for Constrained RESTful Environments (OSCORE)|url=https://tools.ietf.org/html/rfc8613.html|access-date=2021-05-07|website=tools.ietf.org|year=2019 |doi=10.17487/RFC8613 |s2cid=58380874 |language=en}}</ref> defines the Object Security for Constrained RESTful Environments ([[OSCORE]]) protocol which provides security for CoAP at the application layer.
 
== Security issues ==
Although the protocol standard includes provisions for mitigating the threat of [[DDoS]] amplification attacks,<ref>[https://blog.cloudflare.com/why-iot-is-insecure/ "TLS 1.3 is going to save us all, and other reasons why IoT is still insecure", Dani Grant, 2017-12-24]</ref> these provisions are not implemented in practice,<ref>[https://i.blackhat.com/eu-18/Thu-Dec-6/eu-18-Maggi-When-Machines-Cant-Talk-wp.pdf "When Machines Can't Talk: Security and Privacy Issues of Machine-to-Machine Data Protocols", Federico Maggi and Rainer Vosseler, 2018-12-06]</ref> resulting in the presence of over 580,000 targets primarily located in China and attacks up to 320Gbps320&nbsp;Gbit/s.<ref>[https://www.zdnet.com/article/the-coap-protocol-is-the-next-big-thing-for-ddos-attacks/ "The CoAP protocol is the next big thing for DDoS attacks", Catalin Cimpanu, 2018-12-05]</ref>
 
==See also==