TLS 1.3 connection
Atlas uses rustls to establish TLS connections with CA certificate verification:webpki-roots crate provides Mozilla’s trusted CA bundle, ensuring the server presents a valid certificate signed by a recognized authority.
ALPN configuration
Optional ALPN (Application-Layer Protocol Negotiation) protocols can be specified:["http/1.1"]- HTTP/1.1["h2"]- HTTP/2["http/1.1", "h2"]- Both, with preference order
Connection establishment
server_name is used for:
- SNI (Server Name Indication) in the TLS handshake
- Certificate hostname verification
- Later attestation verification
Certificate extraction
After the handshake completes, extract the server’s leaf certificate:Atlas captures the entire certificate chain, but only uses the leaf certificate for attestation binding. The chain validation is handled by rustls during the handshake.
Session binding with EKM
Atlas extracts the TLS session Exported Keying Material (EKM) as specified in RFC 5705 and extended in RFC 9266:What is EKM?
EKM is a unique value derived from the TLS session keys. It has these properties:- Session-specific - Different for every TLS connection
- Secret - Known only to the client and server
- Cryptographically derived - Cannot be guessed or forged
- Stable - Doesn’t change during the session
Why use EKM for session binding?
The EKM solves a critical security problem: relay attacks. Without session binding:- Attacker connects to legitimate TEE server
- Client connects to attacker’s proxy
- Attacker relays the TEE’s attestation quote to the client
- Client believes it’s talking to the TEE
- Attacker can now MITM the connection
- Client extracts EKM from its TLS session with the proxy
- Client sends EKM to server as part of attestation request
- Server includes SHA512(nonce || EKM) in the attestation quote’s
report_data - Client verifies the
report_datamatches its EKM - Because the attacker’s EKM differs from the client’s EKM, verification fails
The EKM uniquely identifies the TLS session. By including it in the attestation quote, the server proves the quote was generated specifically for this TLS connection.
EKM in the verification flow
The EKM is used later in attestation verification:- The quote was generated for this verification request (nonce binding)
- The quote was generated within this TLS session (EKM binding)
Platform support
Atlas supports both native and WASM platforms for TLS:Native (tokio)
tokio-rustls for async TLS operations.
WASM (futures)
futures-rustls which works in browser environments.
Both implementations provide identical APIs. The platform-specific code is hidden behind conditional compilation, making Atlas portable across environments.
Error handling
Common TLS handshake errors:Invalid server name
- Invalid hostname format
- Punycode decoding failure
Handshake failure
- Certificate validation failure
- Unsupported TLS version
- Cipher suite mismatch
- Network errors
Missing certificate
- Server sent empty certificate chain
- Client auth configured incorrectly
EKM extraction failure
- TLS session not fully established
- Unsupported TLS version (< 1.3)
Example usage
Complete TLS handshake with attestation:See also
- Quote retrieval - Fetching attestation evidence
- Verification steps - Complete verification process