atlas-rs
Rust library for attested TLS (aTLS) verification. Verify that TLS servers are running inside Trusted Execution Environments (TEEs) like Intel TDX before sending sensitive data.
aTLS protocol documentation: This document describes the core aTLS protocol, policy configuration, security features, and verification flow.
Installation
Add to your Cargo.toml:
[]
= "0.1"
Or use cargo add:
Development/Latest: To use the latest development version from GitHub:
[]
= { = "https://github.com/concrete-security/atlas", = "main" }
Quick Start
Development Mode (Relaxed Verification)
For development and testing, use DstackTdxPolicy::dev() which accepts more TCB statuses but still verifies the TEE:
use ;
async
Full Verification (Production)
For production, provide bootchain measurements and app configuration:
use ;
use json;
async
JSON Policy Configuration
Policies can be loaded from JSON files:
use ;
async
Low-Level API
For custom TLS handling, use the AtlsVerifier trait directly:
use ;
use json;
async
Computing Bootchain Measurements
Bootchain measurements depend on hardware configuration (CPU count, memory, GPUs, etc.). You must compute measurements for your specific deployment.
See BOOTCHAIN-VERIFICATION.md for detailed instructions on:
- Understanding TDX measurement registers (MRTD, RTMR0-3)
- Computing measurements using
dstack-mr - Step-by-step reproducible build process
Policy Configuration
Policy fields vary by verifier implementation. The Policy enum wraps implementation-specific policy types.
DstackTdxPolicy
By default, all runtime fields are required. Missing any field will cause a configuration error unless disable_runtime_verification is set to true.
| Field | Description | Required |
|---|---|---|
expected_bootchain |
MRTD and RTMR0-2 measurements | Yes (unless disabled) |
os_image_hash |
SHA256 of Dstack image's sha256sum.txt | Yes (unless disabled) |
app_compose |
Expected application configuration | Yes (unless disabled) |
allowed_tcb_status |
Acceptable TCB statuses (e.g., ["UpToDate"]) |
Yes |
disable_runtime_verification |
Skip runtime checks (default: false) | No |
pccs_url |
Intel PCCS URL (defaults to Phala's) | No |
cache_collateral |
Cache Intel collateral (default: false) | No |
use ;
use json;
// Development policy - explicitly disables runtime verification
// (sets disable_runtime_verification: true internally)
let dev_policy = DstackTdx;
// Production policy - all runtime fields required
let prod_policy = DstackTdx;
// This will FAIL - missing runtime fields without disable_runtime_verification
let invalid_policy = DstackTdx;
// invalid_policy.into_verifier() returns Err(Configuration(...))
Error Handling
use ;
async
Security Features
Session Binding via EKM
aTLS binds attestations to specific TLS sessions using Exported Keying Material (EKM) per RFC 5705, RFC 8446 Section 7.5, and RFC 9266. This prevents attestation relay attacks where an attacker (non-TEE) with a compromised private key could relay attestations across different TLS sessions.
How It Works:
- After TLS handshake, both client and server extract a 32-byte session-specific EKM using the label
"EXPORTER-Channel-Binding" - Client generates a random 32-byte nonce for freshness
- Both parties compute
report_data = SHA512(nonce || session_ekm) - Server generates a TDX quote with this computed
report_data - Client verifies the quote, ensuring the
report_datamatches its own computation
Since the EKM is derived from the TLS session's master secret (unique per session), each attestation is cryptographically bound to its specific TLS connection. An attacker cannot relay an attestation from one session to another, even with access to the private key.
Key Properties:
- Always enabled - No configuration needed
- Transparent - Works automatically with all aTLS connections
- Standards-based - Uses RFC 9266 channel binding for TLS 1.3
- Defense-in-depth - Protects against key compromise scenarios
Protocol Specification
Step 1: TLS Handshake
TLS 1.3 handshake with a promiscuous verifier. The certificate is accepted temporarily and recorded for later verification.
Step 2: EKM Extraction & Quote Retrieval
After TLS handshake, both client and server extract session EKM:
session_ekm = export_keying_material
Client generates a 32-byte nonce and computes expected report_data:
nonce = random_bytes
report_data = SHA512
Client sends an HTTP POST over the established TLS channel:
POST /tdx_quote HTTP/1.1
Host: localhost
Content-Type: application/json
{
"nonce_hex": "<hex_nonce>"
}
Server extracts its own session EKM, computes the same report_data = SHA512(nonce || server_ekm), and generates a quote with that report_data.
Server responds:
Step 3: Verification
- Validate the quote signature using Intel PCCS collateral (DCAP verification flow)
- Ensure
report_datain the quote equalsSHA512(nonce || session_ekm)(session binding + freshness) - Recompute RTMR3 by replaying every event log entry in order and ensure the final digest matches the quote
- During that replay, locate the TLS key binding event (contains the certificate pubkey hash) to prove the attested workload owns the negotiated TLS key
- Verify bootchain (MRTD, RTMR0-2), app compose hash, and OS image hash against policy
TCB Status Values
TCB (Trusted Computing Base) status indicates the security posture of the TEE platform:
| Status | Meaning | Production Use |
|---|---|---|
UpToDate |
Platform is fully patched | ✅ Recommended |
SWHardeningNeeded |
Software hardening recommended but not critical | ⚠️ Acceptable with risk assessment |
ConfigurationNeeded |
Platform configuration changes recommended | ⚠️ Acceptable with risk assessment |
ConfigurationAndSWHardeningNeeded |
Both configuration and SW hardening needed | ⚠️ Use with caution |
OutOfDate |
Platform has known security vulnerabilities | ❌ Not recommended |
OutOfDateConfigurationNeeded |
Platform is out of date and needs reconfiguration | ❌ Not recommended |
Configure allowed statuses via allowed_tcb_status in your policy. For production, use ["UpToDate"]. For development/testing, DstackTdxPolicy::dev() allows more permissive statuses.
Documentation
- ARCHITECTURE.md - Design overview and extension guide for contributors
- BOOTCHAIN-VERIFICATION.md - Computing bootchain measurements for production deployments
Platform Support
- Native (Linux, macOS, Windows): Full support with tokio async I/O
- WASM: Browser support via futures async I/O (see wasm/)