757  Transport Review: DTLS Security Architecture

757.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Understand DTLS architecture: Explain how DTLS secures UDP-based IoT communication
  • Analyze handshake process: Describe the DTLS handshake stages and their purpose
  • Apply DoS protection: Explain cookie-based protection for constrained devices
  • Optimize for IoT: Use session resumption to reduce handshake overhead

757.2 Prerequisites

Required Chapters:

Estimated Time: 20 minutes

757.3 DTLS Security Architecture

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D', 'fontSize': '14px'}}}%%
flowchart TB
    subgraph CLIENT["IoT Device (Client)"]
        C1["Application<br/>(CoAP)"]
        C2["DTLS Layer<br/>(Encryption)"]
        C3["UDP Layer<br/>(Transport)"]
        C1 --> C2 --> C3
    end

    subgraph HANDSHAKE["DTLS Handshake"]
        H1["1. ClientHello"]
        H2["2. HelloVerifyRequest<br/>(Cookie for DoS protection)"]
        H3["3. ClientHello + Cookie"]
        H4["4. ServerHello + Certificate"]
        H5["5. Key Exchange<br/>(PSK or ECC)"]
        H6["6. Finished"]
        H1 --> H2 --> H3 --> H4 --> H5 --> H6
    end

    subgraph RECORD["DTLS Record Protection"]
        R1["Plaintext Data"]
        R2["Add Sequence Number<br/>(Replay protection)"]
        R3["Encrypt with AES-GCM<br/>(Confidentiality)"]
        R4["Add Auth Tag 16B<br/>(Integrity)"]
        R5["DTLS Record Header 13B<br/>(Type, Version, Length)"]
        R1 --> R2 --> R3 --> R4 --> R5
    end

    subgraph SERVER["Cloud Server"]
        S1["UDP Layer<br/>(Transport)"]
        S2["DTLS Layer<br/>(Decryption)"]
        S3["Application<br/>(CoAP)"]
        S1 --> S2 --> S3
    end

    CLIENT --> HANDSHAKE
    HANDSHAKE --> RECORD
    RECORD --> SERVER

    FEATURES["DTLS Features<br/>━━━━━━━━━━━━<br/>βœ“ Cookie-based DoS protection<br/>βœ“ Session resumption (68% savings)<br/>βœ“ Replay protection (sequence numbers)<br/>βœ“ AES-GCM encryption (confidentiality)<br/>βœ“ HMAC authentication (integrity)<br/>βœ“ PSK or certificate-based auth<br/>━━━━━━━━━━━━<br/>Overhead: 13B header + 16B tag<br/>Handshake: 620B full, 200B resumed"]

    HANDSHAKE --> FEATURES
    RECORD --> FEATURES

    style CLIENT fill:#2C3E50,stroke:#16A085,stroke-width:3px,color:#fff
    style SERVER fill:#2C3E50,stroke:#16A085,stroke-width:3px,color:#fff
    style HANDSHAKE fill:#E67E22,stroke:#2C3E50,stroke-width:3px,color:#fff
    style RECORD fill:#16A085,stroke:#2C3E50,stroke-width:3px,color:#fff
    style FEATURES fill:#7F8C8D,stroke:#2C3E50,stroke-width:2px,color:#fff
    style C1 fill:#34495E,stroke:#16A085,stroke-width:1px,color:#fff
    style C2 fill:#34495E,stroke:#16A085,stroke-width:1px,color:#fff
    style C3 fill:#34495E,stroke:#16A085,stroke-width:1px,color:#fff
    style S1 fill:#34495E,stroke:#16A085,stroke-width:1px,color:#fff
    style S2 fill:#34495E,stroke:#16A085,stroke-width:1px,color:#fff
    style S3 fill:#34495E,stroke:#16A085,stroke-width:1px,color:#fff
    style H1 fill:#F39C12,stroke:#2C3E50,stroke-width:1px,color:#000
    style H2 fill:#F39C12,stroke:#2C3E50,stroke-width:1px,color:#000
    style H3 fill:#F39C12,stroke:#2C3E50,stroke-width:1px,color:#000
    style H4 fill:#F39C12,stroke:#2C3E50,stroke-width:1px,color:#000
    style H5 fill:#F39C12,stroke:#2C3E50,stroke-width:1px,color:#000
    style H6 fill:#F39C12,stroke:#2C3E50,stroke-width:1px,color:#000
    style R1 fill:#1ABC9C,stroke:#2C3E50,stroke-width:1px,color:#fff
    style R2 fill:#1ABC9C,stroke:#2C3E50,stroke-width:1px,color:#fff
    style R3 fill:#1ABC9C,stroke:#2C3E50,stroke-width:1px,color:#fff
    style R4 fill:#1ABC9C,stroke:#2C3E50,stroke-width:1px,color:#fff
    style R5 fill:#1ABC9C,stroke:#2C3E50,stroke-width:1px,color:#fff

Figure 757.1: DTLS Security Architecture for IoT Communication

DTLS (Datagram Transport Layer Security) architecture for securing UDP-based IoT communication. System spans three components: IoT device client (application→DTLS→UDP layers), DTLS handshake protocol, record protection mechanism, and cloud server (UDP→DTLS→application). Handshake proceeds in 6 steps including cookie-based DoS protection (HelloVerifyRequest prevents resource exhaustion from spoofed ClientHello messages) and key exchange supporting PSK or ECC. Record protection applies 5-stage pipeline: plaintext data → sequence number (replay protection) → AES-GCM encryption (confidentiality) → 16-byte authentication tag (integrity) → 13-byte DTLS record header. Key features enable constrained IoT deployment: cookie verification protects limited-RAM gateways (64KB) from DoS attacks, session resumption reduces handshake energy by 68% (200B vs 620B), AES-GCM provides authenticated encryption, PSK mode avoids expensive certificate validation. Typical overhead: 29 bytes per record (13B header + 16B auth tag), amortized handshake cost with resumption. DTLS enables secure CoAP (CoAPS) achieving 5-10 year battery life for sensors reporting every minute.

757.4 DTLS Key Features

Feature Purpose Benefit for IoT
Cookie-based DoS protection Prevents resource exhaustion Protects constrained gateways
Session resumption Abbreviated handshake 68% energy savings
Sequence numbers Replay protection Prevents repeated commands
AES-GCM encryption Confidentiality Protects sensor data
Authentication tag Integrity Detects tampering
PSK mode Pre-shared keys Avoids certificate overhead

757.5 DTLS Handshake Process

The DTLS handshake establishes a secure session:

  1. ClientHello: Client initiates with supported cipher suites
  2. HelloVerifyRequest: Server sends cookie for DoS protection
  3. ClientHello + Cookie: Client proves address reachability
  4. ServerHello + Certificate: Server responds with chosen parameters
  5. Key Exchange: PSK or ECC-based key agreement
  6. Finished: Both sides confirm successful handshake

757.5.1 Handshake Overhead

Handshake Type Messages Bytes Round Trips
Full handshake 6 620 3 RTT
Session resumption 3 200 1 RTT

Session resumption saves 68% bytes and 2 round trips.

757.6 DoS Protection with Cookies

DTLS cookies prevent denial-of-service attacks:

Without cookies (vulnerable):

Attacker β†’ Server: ClientHello (spoofed source IP)
Server: Allocates state, generates keys, sends ServerHello
Result: Server wasted RAM/CPU for fake client
DoS attack: Send 1000s of ClientHellos β†’ Server runs out of memory

With cookies (protected):

1. Client β†’ Server: ClientHello
2. Server: Generates cookie = HMAC(client_IP, secret)
3. Server β†’ Client: HelloVerifyRequest(cookie)
   - No state allocated yet!
4. Client β†’ Server: ClientHello + cookie
5. Server: Verifies cookie, then allocates state
6. Continue normal handshake

Cookie generation:

cookie = HMAC-SHA256(
    key = server_secret,
    message = client_IP + client_port + server_IP + server_port
)

Why critical for constrained devices:

  • Limited RAM: IoT gateway with 64 KB RAM can’t handle 1000s of fake handshakes
  • Limited CPU: Expensive key generation (RSA, ECC) for fake clients wastes power
  • Stateless verification: Cookie HMAC is fast, doesn’t allocate state

757.7 Session Resumption for Battery Savings

Session resumption dramatically reduces energy consumption:

Without session resumption:

Every message: Full handshake (120 mJ) + data transmission (10 mJ)
Energy per message: 130 mJ
Per day (2,880 messages): 374 J = 104 mAh

With session resumption:

First message: Full handshake (120 mJ) + data (10 mJ) = 130 mJ
Subsequent: Abbreviated handshake (40 mJ) + data (10 mJ) = 50 mJ
Per day: 1 Γ— 130 mJ + 2,879 Γ— 50 mJ = 144 J = 40 mAh
Savings: 64% reduction!

How session resumption works:

  1. Initial handshake creates session ID and master secret
  2. Both parties cache session state
  3. Subsequent connections reference session ID
  4. Skip expensive key exchange, reuse master secret
  5. Session lifetime: hours to days (configurable)

Best practices:

  • Enable session resumption (IETF RFC 6347)
  • Session lifetime: 8-24 hours (balance security vs efficiency)
  • Periodic full handshake (daily) for key rotation

757.9 Summary

DTLS provides essential security for UDP-based IoT:

  • Cookie-based DoS protection prevents resource exhaustion attacks on constrained devices
  • Session resumption reduces handshake overhead by 68%, enabling long battery life
  • AES-GCM encryption provides confidentiality and integrity with minimal overhead
  • PSK mode avoids expensive certificate operations for constrained devices

757.10 What’s Next

Continue exploring transport protocol analysis: