Chapters

12 DTLS: Handshake and UDP Protection

iot
transport-protocols
security
dtls

12.1 Start With the Decision

UDP sends separate packets, so DTLS must handle loss and reordering during its handshake. Each flight builds fresh session keys.

12.2 Route Overview

This is part 2 of 2. Review DTLS: Authentication Boundaries for the preceding evidence.

12.3 Learning Objectives

  • Trace DTLS handshake flights and cookie checks.
  • Explain replay, integrity, and privacy protection for UDP.

12.4 Chapter Roadmap

  • Inside the DTLS Handshake
  • How DTLS Protects UDP
  • Summary
  • Key Takeaway
  • See Also

12.5 Inside the DTLS Handshake

12.5.1 Start With the First Flight

Picture a small device that must set up a safe link over a lossy radio. A final success line does not show what was checked or retried.

First, save each flight, peer name, check, wait, and result. Keep a full new link apart from a short return to old state.

More retries can help on a weak link, but they spend time, power, and radio space. A short return is cheap, yet it rests on state that may be old or gone.

That is the simple story, but it cannot prove every key or attack bound. The later flight record and checks supply that proof.

Use the Practitioner section to review flights and retries. Use Under the Hood to study full setup, return state, loss, and security limits in more depth.

A protocol is a set of rules for an exchange. Transport layer security is a set of checks that protects a link. Datagram Transport Layer Security (DTLS) protects datagrams. User Datagram Protocol (UDP) sends those datagrams without a built-in session.

Plain check

  • Save each flight. Save each wait. Save each retry. Save the final app result.
  • Use Practitioner to review. Use deeper key checks. Test old return state. State each bound.

A DTLS handshake is a sequence of evidence, not a single success flag. Begin with the first flight: who sent it, what route validation is needed, what retransmission behavior is expected, and what identity proof will be accepted. Resumption and optimization make sense only after the full handshake story is clear.

12.5.2 Overview: A DTLS Handshake Is Evidence, Not Just Success

Datagram Transport Layer Security, or DTLS, establishes a protected session for traffic that uses UDP-style datagrams. A completed handshake is useful, but it is not the whole review. The evidence needs to show which peer identity was accepted, how the message flights behaved, whether route validation applied, and where the protected session boundary begins.

That matters for IoT because the handshake often crosses lossy links, constrained gateways, NAT or firewall boundaries, and devices with long-lived credentials. A reviewable record keeps the cryptographic claim and the datagram behavior together.

For example, a field bridge might connect to gateway gw-03 using a provisioned PSK identity bridge-12. A useful handshake record does not stop at "connected." It says the first client flight was observed, the gateway required the expected reachability proof before expensive state was committed, the accepted server flight matched the configured policy, the bridge proved possession of the expected identity material, transcript confirmation completed, and only then did protected telemetry begin. If the trace also shows one lost flight and a retransmission that converged without changing the selected policy, the reviewer can separate normal datagram recovery from a security exception. The result is a bounded claim: this peer and path established a DTLS session under this policy, with these limits and retest triggers.

To see why a successful connection flag is too weak, trace the actual flight sequence in Figure 12.1 before judging the session. The diagram turns the handshake into observable checkpoints rather than treating it as one opaque event.

DTLS handshake message sequence between an IoT client and server showing ClientHello, the cookie-based HelloVerifyRequest, the resent ClientHello, ServerHello with certificate and key exchange, and the client key exchange.
Figure 12.1: The handshake evidence path should connect observed flights, validation behavior, identity checks, transcript confirmation, and the decision to allow protected application data.

Read Figure 12.1 from the client’s first ClientHello to the server’s reachability challenge, then follow the repeated hello into the server and client key-exchange flights. The cookie exchange limits expensive server work until return reachability is shown; the later flights establish the negotiated and authenticated session. This order connects the chapter’s opening claim to a reviewable boundary: protected application data is justified only after the expected validation and identity steps complete.

Candidate Scope

Name the endpoint role, credential set, DTLS policy, peer identity, and traffic path under review.

Message Flights

Record the observed handshake exchanges and any loss, duplicate, or retransmission behavior.

Peer Evidence

Show the accepted certificate, pre-shared-key identity, pinned key, or locally approved identity model.

Boundary

State when protected application data begins and which later changes require a new review.

12.5.3 Practitioner: Review Flights, Validation, and Retransmission

DTLS is designed for datagram transport, so a handshake review should expect datagram questions. UDP datagrams can be lost, duplicated, reordered, or sent with a spoofed source address. A strong record says what behavior was expected for this path and what the trace or logs actually showed.

Build the review around paired positive and negative evidence. For bridge-12, the positive path might show a normal handshake after the route-validation step and a protected telemetry record accepted by the gateway. The negative path should show at least one configured refusal or hold point: a stale PSK identity rejected, a missing reachability proof denied, a disallowed parameter set refused, or a retransmission pattern that did not bypass the policy. Capture timestamps do not need to prove every cryptographic primitive. They need to support the operational claim: the configured DTLS path accepts the intended peer, handles normal datagram loss, and refuses material or behavior outside the release policy.

Review item
Evidence question
Retest trigger
Route validation
Was a cookie, retry, or equivalent reachability check expected and observed for this peer path?
Endpoint address, server policy, gateway path, DTLS version policy, or validation secret changes.
Message flights
Which handshake flights were observed, and did retransmission or reordering change the result?
Retransmission timer, lossy-link profile, packet path, implementation, or proxy behavior changes.
Parameter selection
Did the selected version, protection parameters, and peer identity match the configured policy?
Cipher policy, credential material, identity store, trust anchor, or endpoint role changes.
Transcript confirmation
Was the handshake transcript confirmed before protected application data was accepted?
Handshake library, policy, identity material, or message-processing behavior changes.

Evidence record shape

For each candidate, record the role, credential reference, route-validation expectation, observed flights, selected parameters, authentication evidence, transcript confirmation, decision, owner, and retest trigger. The goal is repeatable review, not a packet-by-packet implementation tutorial.

12.5.4 Under the Hood: Keep Full Handshake and Resumption Claims Separate

A full handshake and a resumed session can both be valid, but they do not prove the same thing. Full-handshake evidence usually covers fresh negotiation, peer authentication, selected protection parameters, transcript confirmation, and the first protected-data boundary. Resumption evidence should show the ticket or pre-shared-key identity, freshness policy, replay-sensitive operation decision, and which full-handshake evidence it depends on.

The separation matters after outages and rotations. Suppose bridge-12 performs a full handshake on Monday, then resumes a session after a gateway restart on Tuesday. The Monday record can support the original identity and policy decision, but the Tuesday record still needs to name the resumption identity, freshness rule, server-side acceptance behavior, and whether any early application data is allowed. If credential material rotated overnight, or if the gateway moved behind a different NAT path, the reviewer should not inherit Monday's evidence silently. A resumed telemetry retry may be acceptable under a freshness rule; a resumed actuator command, provisioning operation, or billing-like event may need a stricter replay-sensitive decision or a fresh full handshake.

The full-handshake record becomes useful only when it can be compared with later resumed sessions. Figure 12.2 shows the fields that keep those two claims separate while preserving the evidence needed for either decision.

DTLS handshake review record linking route validation, parameter selection, transcript confirmation, retransmission evidence, decision, and retest trigger.
Figure 12.2: The review record keeps cryptographic negotiation, datagram behavior, and retest triggers in one place so the claim does not outgrow the evidence.

In Figure 12.2, begin with the endpoint and policy scope, then follow the observed flights and validation result into the identity and transcript evidence. Finish at the decision, limit, owner, and retest trigger. A resumed session can reuse previously established state, but it must not be reported as if every full-handshake check ran again; that distinction carries the chapter’s evidence discipline into optimization and release review.

Scope the candidate Endpoint role, credential reference, DTLS policy, peer identity, and traffic path.
Observe the flights Initial messages, validation step, retransmission behavior, and selected parameters.
Confirm the boundary Transcript confirmation before protected application data is accepted.
Separate resumption Ticket or PSK identity, freshness policy, early-data decision, and replay-sensitive limits.
Retest on change Reopen the record after credential, policy, route, retransmission, endpoint, or resumption changes.

Do not overstate early data

When a resumption mode allows application data before the full handshake boundary is re-established, the review must decide whether that data is safe for the specific operation. Telemetry retry, command execution, provisioning, and billing-like events can have different replay consequences.

12.5.5 Summary

A DTLS handshake review should prove more than eventual connection success. It should record the endpoint scope, peer identity evidence, observed message flights, route-validation behavior, selected parameters, transcript confirmation, and the boundary where protected application data begins.

For IoT systems, the datagram behavior is part of the security evidence. Loss, retransmission, route validation, resumption, and early-data decisions can all change what the handshake result actually proves.

12.5.6 Key Takeaway

Keep DTLS handshake evidence bounded: full handshake, resumption, route validation, retransmission, identity, and protected-data decisions are related, but each claim needs the evidence and retest trigger that fits that exact path.

12.5.7 See Also

12.6 How DTLS Protects UDP

  1. Packet Pete watches a battery sensor send one separate alarm packet across an untrusted path where a shadow may read, alter, or replay it.

    How can one loose packet stay private, unchanged, and fresh?

CP-0154 pre-concept hook: How can one loose packet stay private, unchanged, and fresh?

12.6.1 Start With the Untrusted Datagram

Picture a battery sensor that sends one short alarm without keeping a connection open. Each message is a datagram: one packet sent as a separate item. An attacker on the path should not be able to read it, change it, or replay an old alarm as if it were new.

Start by naming both ends and the key or certificate they trust. Decide how the receiver will spot an old or repeated packet. Then test a normal exchange, a lost packet, a delayed reply, a restart, and a changed key. Keep the message record and the reason each failure was accepted or rejected.

The security layer protects datagram traffic. It does not secure a weak sensor, a stolen key, a bad command rule, or data after the receiver has opened it. Its setup can also cost time, memory, radio use, and battery energy. Those costs matter on a small device.

Go deeper in two steps. The Practitioner section builds a secure-datagram review record. Under the Hood follows setup messages, protected records, replay checks, and the limits of separate packets.

Keep the first claim narrow. State that the tested message was hidden, unchanged, tied to the expected peer, and checked for old copies. Do not claim that every later app choice is safe. The receiver still has to check the sender’s right and the message value.

Measure the setup on the real device. Keep bytes, time, memory, and energy. Repeat it after a lost packet and a restart. A small board may pass the security check yet miss its response or battery goal. Both results belong in the same release choice.

Use a short test card. Name both ends. Name the trust item they share. Name the message and the action it may cause. State how the receiver spots an old packet. State when the session must end.

Capture one good setup and one good data exchange. Then lose a setup packet. Repeat a data packet. Change it. Delay it. Restart one end. Use the wrong trust item. Record which layer rejects each case.

Finish at the app. Check who may send the command, whether the value is in range, and whether the action is still safe. Transport proof and app proof belong in the same review, but they are not the same claim.

Start with a UDP datagram that crosses a network you do not fully trust. DTLS can protect the record, bind it to a peer identity, and limit replay, but it does not decide whether the application should trust the command itself. The security review follows that boundary from handshake evidence to application acceptance.

12.6.2 Overview: DTLS Protects Datagrams, Not the Whole System

Datagram Transport Layer Security, or DTLS, adapts TLS-style protection for UDP traffic. It is useful when an IoT design wants datagram behavior while still needing peer authentication, encrypted records, integrity checks, and replay handling.

The main review mistake is treating "uses DTLS" as a complete security conclusion. DTLS can protect a transport exchange under a specific session context. It does not replace application authorization, device trust, payload validation, key operations, or service monitoring.

For example, a battery meter might send a CoAP reading over UDP to a site gateway. A DTLS fundamentals review should separate four facts: the meter and gateway completed the intended handshake, the later CoAP request appeared as protected DTLS records, a duplicate or stale protected record did not create a second accepted reading, and the application still made its own decision about whether that reading was plausible and authorized. If the record only says "DTLS on port 5684," it misses the useful boundary. If it says "meter-09 to gateway-east accepted PSK identity meter-09, protected the reading exchange, rejected a duplicate record before delivery to the CoAP handler, and left calibration validity to the application review," the claim becomes testable.

To keep DTLS’s protection claim separate from application trust, inspect where the record layer sits in Figure 12.3. The stack placement explains both what DTLS adds and what remains above or below its boundary.

DTLS security architecture where a DTLS record layer providing AES-GCM encryption, certificate or PSK authentication, and HMAC integrity sits above UDP and IP and beneath application protocols.
Figure 12.3: DTLS sits between an application exchange and UDP datagrams, with clear boundaries around what it can prove.

Read Figure 12.3 from UDP and IP upward into the DTLS record layer, then continue to the application protocol. Inside the DTLS layer, identify encryption, integrity, and peer-authentication functions; outside it, keep datagram loss and application authorization as separate questions. This layered reading anchors the chapter’s claim that protected records do not prove the whole system outcome.

Handshake Context

Peer identity, expected roles, selected version, protection policy, and key establishment evidence.

Protected Record

Encrypted and integrity-checked application data tied to one DTLS session and record context.

Datagram Boundary

UDP behavior remains visible: loss, reordering, duplication, and fragmentation still shape the design.

Outside Questions

Authorization, payload meaning, device trust, service policy, and operational monitoring need separate evidence.

Use DTLS evidence for a bounded transport-protection claim: which traffic path, which endpoint roles, which handshake context, which protected records, which replay behavior, and which limits.

12.6.3 Practitioner: Build a DTLS Review Record

A useful DTLS fundamentals review record does not ask only whether DTLS is present. It names the protected traffic, endpoint roles, observation point, handshake context, record evidence, replay evidence, limits, owner, and retest trigger.

Start with a narrow claim sentence before collecting packet captures. For the meter example, the claim might be: "uplink readings from meter-class devices to the gateway are protected by DTLS and duplicate protected records do not reach the CoAP application as new readings." That sentence tells the reviewer where to look: the gateway capture, the endpoint log that binds the session to the expected identity, a normal protected request, a replay or duplicate-record attempt, and the application outcome. It also prevents overclaiming. The same evidence cannot prove device calibration, business-rule authorization, or cloud-side retention.

The architectural boundary needs a review record that ties it to a real endpoint pair and session. Figure 12.4 shows the fields that keep that evidence narrow and repeatable.

DTLS fundamentals review record with eight fields: scope, handshake, record, replay, limits, decision, owner, and retest trigger.
Figure 12.4: A compact review record keeps DTLS evidence narrow, testable, and reusable.

In Figure 12.4, begin with scope and handshake identity, then follow the protected record and replay evidence. Finish with limits, decision, owner, and retest trigger. That order connects a packet trace to its session context while preserving the application and operational questions DTLS cannot answer for the reviewer.

Record part
Question to answer
Common evidence
Scope
Which traffic path, endpoint roles, and observation point are under review?
Scenario note, device role list, trace location, and excluded paths.
Handshake
Which peer identity, version, and protection policy were accepted or rejected?
Endpoint log, handshake trace, configuration reference, and failure case.
Record
Which protected exchange was observed after the handshake?
Packet trace plus endpoint log tying the record to the session.
Replay
What happens to stale, repeated, modified, or reordered records when that behavior is claimed?
Duplicate or stale-record test, rejection log, ignored-record log, or explicit limit.
Decision
What narrow claim is accepted, held, revised, or escalated?
Decision, owner, evidence limit, and retest trigger.

For a protected CoAP request, a defensible conclusion might be: "This request was carried inside a DTLS-protected session with the recorded peer identity and protection policy." That conclusion does not decide whether the CoAP action was authorized. It only states the transport-protection evidence.

If a record claims replay handling but only shows one normal protected record, hold the replay claim. Ask for evidence that a repeated or stale protected record is rejected, ignored, or recorded according to policy, and confirm whether the application receives duplicate data.

12.6.4 Under the Hood: Handshake, Records, Replay, and Datagram Limits

The handshake establishes session state: endpoint identity evidence, selected version, selected protection policy, and keys for later records. A completed handshake is important, but it is not the same as a full application security decision.

Protected records carry encrypted and integrity-checked application data after the handshake. Reviewers should connect each record to the session that produced it and keep epoch, sequence, replay policy, and acceptance outcome visible.

The datagram substrate is why those fields matter. UDP can drop, duplicate, reorder, or fragment traffic, so a DTLS review has to distinguish normal retransmission behavior from application-level duplicate effects. A practical trace might show handshake messages retransmitted while the peer is still establishing state, then protected application records under one epoch and sequence progression once the session is active. If record sequence 41 is accepted, a replayed copy of sequence 41 should be rejected, ignored, or logged according to policy, while sequence 42 can still be accepted when it is fresh. The reviewer should not infer those outcomes from encryption alone; they need transport evidence and, when the claim mentions business effects, the application log that shows whether a second reading, command, or actuator event was created.

Loss

A record may never arrive. The application may still need timeout, retry, or idempotency behavior.

Reordering

Datagrams can arrive out of order. The replay policy and application semantics must handle that reality.

Duplicate Data

A repeated record should be rejected, ignored, or recorded according to policy before a replay claim is accepted.

Fragmentation

Fragmentation can change what a trace shows and where a failure appears, especially on constrained paths.

DTLS retransmission behavior is most visible during handshake messages. Ordinary application semantics still belong to the application layer, so duplicate commands, stale state, and authorization should not be inferred from DTLS metadata alone.

Retest triggers keep evidence current. Reopen the review when endpoint roles, identity material, protocol stack, firmware, protection policy, replay policy, observation point, or application authorization logic changes.

12.6.5 Summary

DTLS adapts TLS-style transport protection for UDP. Its architecture matters because handshake context, protected records, datagram behavior, replay policy, and application boundaries answer different review questions.

A strong DTLS fundamentals record names the protected traffic, peer identity model, negotiated protection policy, protected record evidence, replay evidence when claimed, open limits, owner, and retest trigger. It avoids turning transport protection into a broader security conclusion.

12.6.6 Key Takeaway

DTLS evidence is strongest when it stays bounded: session context, protected records, replay behavior, explicit limits, and retest triggers. Application authorization and device trust still need their own evidence.

12.6.7 See Also

DTLS and Transport Security

Frames the broader DTLS security boundary and where transport evidence fits.

DTLS: Securing UDP for IoT

Introduces why UDP-based IoT traffic may need DTLS protection.

DTLS Attacks and Auth

Connects fundamentals to authentication and attack-resistance evidence.

DTLS Handshake Protocols

Expands the handshake messages, transcript evidence, and negotiation behavior.

12.7 Summary

DTLS attack-resistance and authentication checks should be bounded. A cookie challenge can support a return-reachability and server-state claim. Replay handling can support a duplicate or stale-record claim. Transcript and Finished-message checks can support a handshake-tamper claim. Authentication records support a peer-identity claim only when the expected material, trust source, rejection behavior, owner, and retest trigger are visible.

DTLS does not close every security question. It protects and authenticates a transport path under a stated policy; authorization, provisioning governance, telemetry truth, and command safety still need their own records.

12.8 Key Takeaway

Treat DTLS as a bounded transport and identity control. Accept a security assertion only when the record shows the claim, accepted behavior, rejected behavior, open limit, owner, and retest trigger.

12.9 See Also

DTLS and Transport Security

DTLS and Transport Security

DTLS: Securing UDP for IoT

DTLS: Securing UDP for IoT

DTLS Fundamentals and Architecture

DTLS Fundamentals and Architecture

DTLS Handshake Protocols

DTLS Handshake Protocols

12.10 Continue Your Route

This final part closes the route from Inside the DTLS Handshake through See Also. Return to DTLS: Authentication Boundaries or continue from the transport-protocols module index.