NoSec
No DTLS. Plain coap:// on 5683. Any required protection must be supplied separately.
Progress saves as you read. Mark sections complete as you go; your progress appears in the sidebar.
Related reference: CoAP message types.
Follow One Protected Reading Across Every Stop
A clinic sensor sends a reading to a care service through a relay. The relay forwards requests as a proxy: an intermediary acting for another endpoint. The clinic permits the service to read the value but permits the relay only to forward it. Can an encrypted connection to the relay meet that rule?
The Constrained Application Protocol (CoAP) carries the request. Datagram Transport Layer Security (DTLS) encrypts the CoAP message between the endpoints of a protected connection. Suppose the sensor establishes DTLS with the relay, which decrypts the request and opens a second protected connection to the service. An observer on either protected connection cannot read the request, but the relay can. Two encrypted connections therefore fail this clinic rule.
Object Security for Constrained RESTful Environments (OSCORE) can instead protect the request between the sensor and service. Give those endpoints the keys needed to protect and recover the content; do not give those keys to the relay. The relay then forwards an outer message while the reading and protected resource path remain encrypted inside it.
Your task is to mark who can read the reading, choose the protection endpoints, and specify a restart test. A replay is a copied protected message sent again. Encryption alone does not show that a received message is new, so the test must also establish how the recipient rejects a replay.
After this page, you should be able to:
CoAP Security and Applications introduces deployment choices. Here, use the clinic route to separate three questions: who holds the keys, where plaintext becomes available, and how a recipient distinguishes a new request from a replay. A successful connection answers only part of that review.
On the clinic's sensor-to-relay connection, DTLS conceals the CoAP method, resource path, options and payload. Options are named CoAP fields, such as Uri-Path, that describe the request. The relay is the DTLS endpoint, so it recovers those fields. A passive observer still sees network addresses and ports; hiding the request does not hide the communication route.
Now choose how the DTLS endpoints authenticate each other: how they establish the peer's identity. RFC 7252 names four CoAP security modes. NoSec has no DTLS protection and uses coap://, with default UDP port 5683. The DTLS modes use coaps://, with default UDP port 5684. PreSharedKey uses a secret shared in advance. RawPublicKey uses a public/private key pair without a certificate. Certificate uses certificates validated against a trust anchor, a key or authority the deployment already trusts.
Changing the credential mode does not move the protection endpoint. A certificate-authenticated relay still reads the request when it terminates DTLS. First decide whether the relay may read it; then choose credentials that the deployment can provision, replace and retire.
Inspect the figure in the parent chapter at the proxy: the change from DTLS to TLS marks where the first protected connection ends.
Read the figure in the parent chapter as two connections. The sensor sends CoAP over DTLS to a terminating proxy, and the proxy opens TLS to the cloud service. The proxy is an endpoint of both protected connections, so it can access plaintext without separate object protection. An observer on either protected connection cannot read the request, but the relay can. Two encrypted connections therefore fail the clinic rule. If the relay may only forward, the clinic needs content protection whose keys belong to the sensor and service. TLS is Transport Layer Security, used for the onward connection.
No DTLS. Plain coap:// on 5683. Any required protection must be supplied separately.
DTLS with symmetric keys shared in advance. Record how each peer receives and replaces its shared key.
DTLS with an asymmetric key pair and no certificate authority — record how each peer verifies the other public key.
DTLS with an X.509 chain validated to a trust anchor — record the trust anchor and certificate validation policy.
Apply the same reasoning to a building meter whose operator explicitly permits the gateway to read and aggregate readings. DTLS ending at that gateway can meet the stated access rule, provided the onward connection and service are also protected as required. If the operator later changes the rule to exclude gateway access, changing from a shared key to certificates will not satisfy it: the endpoint boundary must change or the content needs endpoint protection such as OSCORE.
A DTLS handshake establishes security state before protected requests can flow. Reusing that state avoids repeating a full handshake for every reading, but the deployment must decide how long it remains valid. If a sleeping sensor loses memory, verify what credentials and session state survive before choosing reuse or resumption. OSCORE also needs safe security-state recovery; switching layers does not remove that obligation.
In the clinic's DTLS-only route, the terminating proxy holds the keys for its connections and sees plaintext. Ask who owns the content-protection keys before trusting the route. Merely forwarding encrypted traffic does not make an intermediary a DTLS endpoint.
Return to the clinic rule. The sensor and service share an OSCORE security context: keys and associated state used to protect and verify messages. The sensor protects the reading, request method and inner Uri-Path. The relay forwards the outer CoAP message without those content keys. The service verifies and decrypts the protected content. The relay can still observe traffic and visible outer fields, so this design does not make the route anonymous.
Choose endpoints from the access rule. DTLS conceals CoAP on its protected connection. OSCORE can preserve protected content through an intermediary that is not a content-security endpoint. The two can be used together.
OSCORE uses COSE, the CBOR Object Signing and Encryption framework. CBOR is a compact binary data representation. Authenticated encryption with associated data (AEAD) encrypts content and checks integrity, including associated data covered by the protection. OSCORE carries protected content within an outer CoAP message marked by its OSCORE option. Required outer forwarding fields remain visible; do not assume every option is encrypted or every visible field is unprotected. Proxy routing and caching behavior must be checked for the actual option handling in use.
For protected requests, sender sequence state contributes to the nonce, a value used by authenticated encryption that must not be reused with the same key. The recipient tracks accepted requests with replay state, including a replay window that identifies duplicates while allowing the configured range of reordered requests. After a restart, test both sides: the sender must avoid unsafe sequence reuse, and the recipient must not accept an old request merely because its remembered state was lost. A message can also be old without being a duplicate; application age checks remain separate.
The message carries the protected method, payload and inner options using COSE-based authenticated encryption.
Marks OSCORE processing; its fields depend on the message and security context.
Protected inner fields conceal content; visible outer fields support forwarding. Verify the actual option handling.
Sender sequence state contributes to nonce uniqueness; recipient replay state detects repeated protected requests.
For the clinic route, keep a record that another reviewer can use to test the access rule:
Name the DTLS credential mode and, separately, whether OSCORE protects the content. OSCORE is not a fifth RFC 7252 DTLS credential mode.
Name each authenticated identity, key owner, trusted authority where applicable, and credential replacement or retirement procedure.
Mark DTLS endpoints, any onward protected connection, and OSCORE endpoints. State whether the proxy can recover the reading and protected path.
Record which session and sequence state survives sleep or restart, and how lost state is recovered safely.
Run this numbered replay experiment in an isolated test deployment:
Repeat with an unauthorized credential and record rejection. Keep endpoint acceptance/rejection evidence without logging secret keys or sensitive plaintext.
Return to the applications chapter for deployment choices, then review the message fields those protections cover.

Chapter
CoAP Security and Applications
for deployment scenarios and application patterns.

Chapter
CoAP Observe Extension
for long-lived notifications that interact with sessions and replay windows.

Chapter
Cryptography for IoT
for AES and symmetric-key foundations behind DTLS-PSK and OSCORE AEAD.
Return to CoAP Security and Applications, then continue to CoAP Implementation Labs for operational practice.

Knowledge check · self-test
__IOT_RELATED_TITLE__
__IOT_RELATED_DESCRIPTION__