14  E3-E4: Transport Encryption

Opaque Payloads, TLS/DTLS Sessions, Identity Validation, and Evidence

cryptography
encryption
e3
e4
In 60 Seconds

E3 and E4 solve different problems. E3 keeps selected payloads opaque through gateways, brokers, queues, and proxies so only the device and cloud application can read them. E4 protects an authenticated transport session such as gateway-to-cloud TLS or DTLS. E4 does not hide data from a gateway that already decrypted it; E3 does.

Think of a field gateway as a mailroom. E4 locks the mailroom’s network connection to the cloud, while E3 seals selected letters so the mailroom can route them but cannot read them. This page is about choosing which envelopes stay opaque, which metadata stays visible, and which session identity proves the mailroom reached the right cloud endpoint.

14.1 Learning Objectives

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

  • Separate E3 opaque payload protection from E4 transport session protection.
  • Decide whether a gateway should decrypt, forward opaque payloads, or only terminate transport.
  • Define object-security evidence for nonce or sequence freshness, associated data, payload integrity, and key ownership.
  • Define TLS/DTLS evidence for certificate validation, service identity, mutual authentication, version policy, and downgrade rejection.
  • Identify common failures such as disabled certificate checks, accepting any hostname, replayable early data, plaintext fallback, and embedded secrets.

14.2 Prerequisites

14.3 Keep Payload Secrecy Separate From Transport Security

Start with two questions:

  1. Should the gateway be able to read this payload?
  2. Which network session needs authenticated transport protection?

If the gateway must not read the payload, use E3 object or device-to-cloud protection. If the gateway is sending data to the cloud over the Internet, use E4 transport protection for that session. Many systems use both.

E3 opaque payload protection through gateway and E4 TLS or DTLS transport session from gateway to cloud.
E3 controls payload plaintext ownership; E4 controls authenticated transport sessions.
E3

Opaque payload protection

The gateway routes ciphertext but does not have the payload key or plaintext authority.

E4

Transport session protection

TLS or DTLS authenticates peers and protects a session such as gateway-to-cloud MQTT, HTTPS, or CoAP.

Together

Defense by boundary

E3 can keep sensitive fields opaque inside an E4-protected transport session.

Not equivalent

E4 is not E3

Transport security does not erase plaintext exposure at a gateway that decrypts or receives data first.

Naming Used in This Book

This book uses E3 for device-to-cloud or object-level payload protection that remains opaque to gateways, and E4 for authenticated transport sessions such as gateway-to-cloud TLS or DTLS.

14.4 Use E3 When Gateways Should Only Route

E3 is appropriate when an intermediary should route, buffer, translate, or broker messages without reading selected payload fields. E3 can be implemented with a protocol such as OSCORE, COSE-based object protection, an application envelope, or a platform-approved device-to-cloud protection scheme. The important property is key ownership: the gateway does not have the payload decryption key.

E3 object envelope with routing metadata outside and protected payload, nonce, key epoch, and authentication tag inside.
E3 lets gateways route useful metadata while sensitive payload fields remain opaque.
Element
Protects
Plaintext owner
Review evidence
Routing metadata
Non-sensitive fields needed to route or prioritize a message.
Gateway may read only the approved routing fields.
Metadata classification says which fields are visible and which are protected.
Associated data
Headers that remain readable but must not be altered.
Gateway can see them, but cannot tamper without verification failure.
Tampered device ID, topic, route, or message type fails authentication.
Nonce or sequence
Freshness and uniqueness under the selected key.
Device and cloud track freshness according to the protocol.
Replays, duplicate nonces, rollback, and out-of-window messages fail closed.
Ciphertext and tag
Confidentiality and integrity for protected payload fields.
Device and cloud application or object-security endpoint.
Gateway cannot decrypt test payloads; cloud rejects wrong key or modified ciphertext.
Key epoch
Rotation, recovery, and overlap between old and new payload keys.
Device and cloud key owner.
Expired, revoked, retired, and future epochs follow documented policy.

E3 is not automatically “encrypt everything.” A practical design may leave routing metadata visible while protecting sensitive fields. The review requirement is to state which fields are visible, which are authenticated, and which are confidential.

14.5 Use E4 to Authenticate the Transport Session

E4 protects a session between endpoints. The endpoints might be a gateway and cloud service, a device and cloud service, or a local controller and gateway. The key review question is whether the session authenticates the expected peer identity and rejects downgrade, expired credential, wrong-name, wrong-issuer, and revoked-credential cases.

E4 TLS or DTLS transport session showing client identity check, server certificate validation, key agreement, and encrypted records.
E4 is only as strong as its peer identity validation and failure behavior.
Choose transport

Use TLS for reliable streams and DTLS for datagram protocols where the application profile requires UDP.

Validate identity

Check the certificate chain, service name, validity period, key usage, and trust anchor.

Authenticate clients

Use mutual TLS or another approved client authentication method when the cloud must identify the gateway or device.

Derive session keys

Let the protocol key schedule derive traffic keys from authenticated key agreement.

Reject fallback

Block plaintext ports, obsolete protocol versions, wrong identities, and insecure debug bypasses.

Certificate Parsing Is Not Certificate Validation

A gateway that accepts any certificate, ignores the expected service name, disables expiry checks, or trusts a self-signed test certificate in production has lost the main protection that TLS and DTLS are meant to provide.

14.6 Prove the TLS Session Has the Right Peer

“Using TLS” is not one security decision. The release evidence needs to show which peer identity was verified, which key exchange created the traffic keys, which authenticated encryption protected the records, and which failure cases were rejected.

TLS 1.3 raises the baseline because it requires a forward-secret key exchange and authenticated encryption. That does not remove the need to validate certificates. A gateway can negotiate modern cryptography and still build a private session to the wrong endpoint if it accepts the wrong name, wrong issuer, expired certificate, or unapproved trust anchor.

Lever
Protects
Plaintext owner
Review evidence
Forward secrecy
Recorded sessions after a later long-term key compromise.
Only the authenticated TLS or DTLS endpoints derive session traffic keys.
TLS 1.3 or approved ECDHE policy is enforced; obsolete static key transport and downgrade paths are rejected.
Peer identity
Connections to the intended cloud service, gateway, device, or service peer.
The authenticated endpoint named by certificate and enrollment policy.
Wrong-name, wrong-issuer, expired, revoked, and unapproved-root test certificates fail closed.
AEAD records
Transport confidentiality and integrity after handshake completion.
The session endpoints, after identity validation and key agreement.
Approved cipher suite policy is enforced and unauthenticated or obsolete ciphers are unavailable.
TLS Review Levers

14.7 Keep Old Sessions Safe After Key Theft

Forward secrecy means the session uses ephemeral key agreement, such as ECDHE, so fresh traffic keys are created for that session and discarded afterward. If the server’s long-term private key is stolen later, old packet captures should still remain sealed because there is no reusable transport key that decrypts them.

Certificate validation is the matching identity control. The client checks that the presented certificate chains to an approved trust anchor, names the expected service, is within its validity period, has the right key usage, and has not been rejected by revocation or local policy. Parsing a certificate is only syntax; validation is the decision to accept or reject the endpoint.

Without forward secrecy:
  Attacker records traffic today, steals the server key later,
  and may decrypt old sessions if the protocol used static key transport.

With ephemeral ECDHE:
  Each session derives fresh keys and discards them.
  Later server-key theft does not unlock previously recorded sessions.

This is why TLS 1.3 removed static-RSA key transport. For IoT releases, the proof should include positive configuration evidence and negative tests that obsolete protocol versions, static key transport, wrong names, wrong issuers, and expired certificates fail closed.

Forward Secrecy

14.8 Manage Trust Roots, Early Data, and Mutual TLS

The hardest E4 failures are often trust failures rather than cipher failures. A client that disables certificate validation, accepts any certificate, or trusts an unapproved test root creates an encrypted channel to whoever intercepted the connection. The traffic may be private, but it is private with the wrong party.

PKI also has a trust-root problem. A compromised or mis-issuing certificate authority can make a certificate look valid unless the deployment has governance around approved roots, certificate transparency monitoring where applicable, and a rotation plan for any certificate pinning. Pinning can reduce exposure to unexpected issuers, but it must not strand deployed devices when certificates rotate.

TLS 1.3 also changes deployment evidence. Its normal handshake is faster than older TLS handshakes, and 0-RTT resumption can send early data with even less latency. Early data is replayable, so it should be limited to idempotent requests and rejected for state-changing commands. For service-to-service E4 hops, mutual TLS adds client identity proof so both sides present certificates and each peer maps the other to an enrolled service, gateway, or device record.

Certificate Validation Failure

14.9 Select the Layer by Who May Read

Design choice
Protects
Plaintext owner
Review evidence
E2 trusted gateway
Device-to-gateway messages that the gateway is allowed to inspect.
Device and gateway.
Gateway key store controls, per-device keys, replay protection, and local policy logs.
E3 opaque payload
Sensitive payload fields through gateways, brokers, queues, and proxies.
Device and cloud application or object endpoint.
Gateway cannot decrypt; cloud rejects tampering, replay, wrong key, and wrong epoch.
E4 transport
A network session between authenticated endpoints.
Session endpoints after protocol validation.
TLS/DTLS version policy, certificate validation, mTLS policy, and negative identity tests.
E5 lifecycle
Long-lived trust after rotation, revocation, recovery, and decommission.
Credential owner according to policy.
Trust anchor update, key rotation, revocation, fallback, and recovery tests.

14.10 Practical Rule

  • Use E2 when the gateway is trusted and needs plaintext.
  • Use E3 when the gateway should route data but not read selected payloads.
  • Use E4 for authenticated transport sessions regardless of whether the payload is already E3-protected.
  • Use E5 so the design can rotate, revoke, and recover credentials without insecure bypass modes.

14.11 Check Identity Before Trusting the Session

TLS and DTLS are protocol frameworks. Production security depends on the certificate and identity policy you actually enforce.

Server identity

Connect to the intended service

Validate the expected service name and issuer chain. Do not accept a certificate merely because it is syntactically valid.

Client identity

Authenticate gateway or device

Mutual TLS can bind a gateway or device certificate to an enrolled identity and authorization policy.

Time and status

Handle expiry and revocation

Define how constrained devices handle clock uncertainty, expiry, revocation evidence, and renewal failure.

Early data

Treat replay as a design issue

Session resumption can reduce setup cost, but replayable early data must not carry unsafe commands or non-idempotent actions.

14.12 Build the Third-Party Field Gateway Case

Scenario

A utility operator deploys field sensors that report equipment condition through a third-party gateway service. The gateway provider is trusted to route packets and maintain availability, but it should not inspect detailed readings or control commands.

14.12.1 Step 1: Classify Plaintext Ownership

Data path
Protects
Plaintext owner
Review evidence
Sensor local hop
Nearby radio capture and unauthorized local participation.
Local link endpoints after join and frame validation.
E1 link protection and secure commissioning evidence.
Detailed condition report
Operational readings that the gateway does not need to inspect.
Sensor and utility cloud analytics service.
E3 object payload cannot be decrypted by the gateway; cloud rejects tampering and replay.
Routing header
Topic, destination, priority, and delivery metadata.
Gateway may read only approved routing fields.
Visible metadata is classified and authenticated where required.
Gateway-cloud session
Internet transit between gateway service and utility cloud endpoint.
Gateway service and cloud transport endpoint.
E4 TLS or DTLS validates service identity and rejects wrong issuer, wrong name, expiry, and downgrade.
Long-term operation
Expired keys, sold gateways, retired sensors, and recovery after outage.
Credential owner according to policy.
E5 rotation, revocation, trust-anchor update, and recovery drills.

14.12.2 Step 2: Approve the Layer Set

  • Use E1 for local wireless or local network access control.
  • Use E3 for condition reports and commands that the gateway should not inspect.
  • Use E4 for the gateway-to-cloud transport session with strict service identity validation.
  • Use E5 for device payload-key rotation, gateway certificate renewal, revocation, and recovery.
  • Do not rely on E4 alone to hide fields from a gateway that has already received plaintext.

14.12.3 Step 3: Define Release Evidence

  • Gateway cannot decrypt a sample E3 condition report.
  • Cloud rejects modified ciphertext, modified associated data, replayed nonce, and wrong key epoch.
  • Gateway can route only the visible metadata approved by the data classification.
  • Gateway-cloud TLS or DTLS rejects wrong service name, wrong issuer, expired certificate, and obsolete version.
  • Mutual authentication maps the gateway certificate to the enrolled gateway record when required.
  • Plaintext fallback ports and insecure debug endpoints are blocked before release.
  • Session resumption and early data policies are tested for replay-safe behavior.
  • Credential rotation and revocation do not require accepting unknown certificates or disabling validation.

14.13 Avoid the E3-E4 Mistakes That Leak Payloads

Mistake

Calling TLS end-to-end

TLS is end-to-end only between its session endpoints. If a gateway terminates TLS and forwards plaintext, the gateway saw the data.

Mistake

Disabling certificate validation

Accepting any certificate turns encrypted transport into an encrypted connection to whoever is intercepting the traffic.

Mistake

Leaving plaintext fallback open

Blocked TLS configuration is not enough if devices silently retry over an unencrypted port or debug endpoint.

Mistake

Protecting payload but not metadata

Visible metadata can still leak sensitive patterns or allow tampering unless it is classified and authenticated.

Mistake

Unsafe early data

Replayable early data should not carry state-changing commands unless the application has explicit replay defenses.

Mistake

No trust-anchor update path

A device that cannot replace trust anchors or renew certificates eventually forces insecure emergency bypasses.

14.14 Knowledge Check

Boundary Decision
Match Controls to Evidence

Order the Protected Send Path

Label the E3-E4 Evidence Path

Code Challenge

14.15 Release Evidence Checklist

Before production, the E3-E4 design should be reduced to evidence:

  • Every payload field is classified as visible metadata, authenticated metadata, or confidential payload.
  • Gateway plaintext ownership is stated for each payload, not assumed.
  • E3 payloads remain opaque to gateways, brokers, queues, and proxies that are not plaintext owners.
  • E3 verification rejects modified ciphertext, modified associated data, duplicate nonce, replay, wrong key, and wrong epoch.
  • E4 sessions validate certificate chain, expected service identity, key usage, validity period, and trust anchor.
  • Mutual authentication maps gateway or device certificates to enrolled identities where required.
  • Plaintext fallback, insecure debug ports, and obsolete protocol versions are blocked.
  • Session resumption and early data behavior is documented and replay-safe for the application.
  • Trust anchors, certificates, and object keys can be rotated, revoked, and recovered without disabling validation.
  • Logs distinguish identity failure, replay, object-verification failure, transport failure, downgrade, and policy rejection.

14.17 What’s Next

Continue with Elliptic Curve Cryptography for IoT for the public-key choices behind compact key agreement and signatures used by TLS, DTLS, certificates, and firmware trust.

Next Chapter Use it for
Elliptic Curve Cryptography for IoT ECDH, ECDSA, EdDSA, curve selection, and constrained-device tradeoffs
E5: Key Renewal and Asymmetric Rotation, revocation, trust-anchor update, and recovery
TLS/DTLS Transport Security for IoT Detailed transport protocol configuration and failure tests

14.18 Summary

Transport and application encryption protect IoT data beyond the local link. TLS, DTLS, and application payload encryption address different paths depending on whether data terminates at gateways, brokers, cloud endpoints, or end applications.

14.19 Key Takeaway

Choose the encryption level by where plaintext is allowed to exist. If gateways or brokers are not fully trusted, add application-layer protection instead of relying only on transport security.