Confidential Computing — Complete Guide: How to Protect Data In Use

Encryption protects data at rest and in transit — but what about while it's being processed? Confidential computing uses hardware-based Trusted Execution Environments (TEEs) to protect data even while it's being computed on, keeping it secret from cloud providers, hypervisors, and even the OS. This guide covers TEE technologies, attestation, and real-world use cases.

3 states

of data: at rest, in transit, in use

TEE

Trusted Execution Environment — the core technology

Intel SGX

most widely deployed TEE technology

Zero trust

even the cloud provider cannot see your data

1

The Problem: Data In Use Is Exposed

The gap in traditional encryption

Even with full-disk encryption and TLS in transit, when your application processes data, it is decrypted in memory. The OS kernel, hypervisor, cloud provider operations staff, and any other compromised process on the same physical machine can potentially access that plaintext memory. Confidential computing closes this gap with hardware-enforced memory isolation.

ItemTraditional CloudConfidential Computing
Data at restEncrypted with AES-256Encrypted (same — no change)
Data in transitEncrypted with TLS 1.3Encrypted (same — no change)
Data in usePlaintext in memory — exposed to OS and hypervisorEncrypted in TEE — CPU decrypts only inside the enclave boundary
Cloud provider trustMust trust cloud provider staff and infrastructureZero-trust — provider cannot access data even with physical server access
Hypervisor accessCan read VM memory at any timeHardware blocks hypervisor from reading enclave memory
Rogue admin attackRoot access → memory dump → plaintext dataRoot access still cannot read encrypted enclave memory
2

How TEEs Work

1

Secure enclave is created

The CPU creates an isolated memory region (the enclave) that is encrypted by the Memory Encryption Engine. This happens at hardware level — the CPU uses a key that is only known to itself, stored in protected fuses, never accessible to software.

2

Code and data loaded

The application code and sensitive data are loaded into the enclave. Everything inside is encrypted in DRAM. The CPU transparently decrypts when executing code and re-encrypts when writing back to memory — all in the CPU die, invisible to the rest of the system.

3

Attestation proves integrity

Before sending sensitive data to the enclave, you remotely verify: is the expected code running? Is it on genuine hardware? Is the hardware firmware up to date? This cryptographic proof prevents MitM attacks.

4

Secure channel established

After attestation succeeds, a TLS-like secure channel is established directly to the enclave, bypassing the untrusted OS. Sensitive data is sent only through this verified channel.

5

Computation in isolation

The enclave processes data with complete hardware isolation. Even DMA attacks are blocked. The hypervisor, kernel, other VMs, and cloud provider cannot observe memory contents during computation.

6

Results returned securely

Results are returned through the secure channel, re-encrypted before leaving the enclave. Keys and intermediate state are destroyed when the enclave closes — no data leaks to the untrusted environment.

3

TEE Technologies

ItemTechnologyDescription
Intel SGXApplication-level TEE — process isolationFine-grained memory isolation, strong attestation. ~256MB EPC limit (expandable with SGX2). High overhead for large workloads.
AMD SEV-SNPVM-level TEE — full VM isolationEntire VM is confidential. Larger memory, lower overhead (~5-10%). Strong attestation. Available on Azure, GCP, AWS.
ARM TrustZoneProcessor-level TEE — two worldsSplits processor into Secure/Normal worlds. Used in smartphones, IoT, payment terminals. Qualcomm Secure Execution Environment built on TrustZone.
Intel TDXVM-level TEE (Intel's SEV equivalent)Confidential VMs on 4th gen+ Intel Xeon. Lower overhead than SGX. Emerging cloud support.
AWS Nitro EnclavesCloud-native enclaveIsolated EC2 enclaves with no persistent storage, no external networking. Attestation via AWS KMS. AWS-specific.
Google Confidential SpaceContainer-based confidential computingRuns container workloads in AMD SEV-SNP. Integrates with Google Cloud Attestation and Workload Identity Federation.
4

Attestation — Proving the Enclave is Trusted

Attestation is what makes TEEs genuinely trustworthy

Attestation lets you cryptographically verify: (1) the exact code running in the enclave matches what you expect (code integrity), (2) the enclave is on genuine hardware with a valid CPU, and (3) the firmware and microcode are up to date (no known vulnerabilities). Verify this before sending any sensitive data to the enclave — without attestation, you're trusting blindly.
pythonIntel SGX Remote Attestation Flow
# Simplified attestation flow using Intel SGX + DCAP
# Real implementation uses gramine, Open Enclave SDK, or Fortanix EDP

# 1. Request a quote from the enclave
from sgx import Enclave

enclave = Enclave("my_secure_app.signed.so")
quote = enclave.get_quote()  # Signed by Intel SGX hardware

# 2. Verify the quote with Intel PCCS (Provisioning Certificate Caching Service)
import requests

response = requests.post(
    "https://api.trustedservices.intel.com/sgx/dev/attestation/v4/report",
    json={"isvEnclaveQuote": quote.base64()},
    headers={"Ocp-Apim-Subscription-Key": INTEL_API_KEY}
)

attestation_report = response.json()

# 3. Verify the attestation report
assert attestation_report["isvEnclaveQuoteStatus"] == "OK"
assert attestation_report["platformInfoBlob"]["tcbStatus"] == "UP_TO_DATE"

# What you've now verified:
# - The enclave contains exactly the code you compiled (MRENCLAVE hash matches)
# - It's running on a genuine Intel SGX processor
# - The firmware has no known vulnerabilities (TCB is up to date)

# 4. Now safe to establish a TLS channel and send sensitive data
enclave.establish_secure_channel()
enclave.send_secret_data(sensitive_payload)
5

Use Cases for Confidential Computing

Multi-Party Computation

Multiple organizations compute on combined datasets without revealing raw data to each other. Example: banks collaborating on fraud detection models using combined transaction data without exposing customer records to competitors.

AI Model Protection

Run AI inference on sensitive data (medical imaging, financial records) without exposing either the patient data or the proprietary model weights to the cloud provider. The TEE sees both — no one else does.

Regulated Data Processing

Process HIPAA-regulated medical records or GDPR-sensitive personal data in public cloud without violating data residency and access requirements. Attestation provides the audit trail for compliance.

Cryptocurrency Key Management

Store and sign transactions with private keys that never leave the TEE — even in memory. Coinbase, Anchorage, and institutional custodians use TEEs for this to prevent insider theft and server compromise.

Federated Learning Privacy

Train ML models across distributed data sources. Each participant's gradient updates are computed in a TEE — the aggregation server sees encrypted gradients, preventing reverse-engineering of training data.

Secure Database Queries

Query encrypted databases where the query planner runs inside a TEE. The planner decrypts only the data needed for the query result, then re-encrypts. Examples: CipherCore, Microsoft Always Encrypted with secure enclaves.

6

Cloud Provider Support

ItemCloud ProviderConfidential Computing Offering
Microsoft AzureMost mature offeringConfidential VMs (AMD SEV-SNP, Intel TDX), Confidential Containers (AKS), Azure Attestation Service, SGX VMs (DCsv3 series)
Google CloudStrong AMD SEV integrationConfidential VMs (AMD SEV-SNP), Confidential GKE Nodes, Confidential Space (container workloads), Confidential Dataflow
AWSNitro-based architectureAWS Nitro Enclaves (isolated EC2 partitions), Nitro System hardware security, AWS KMS integration for attestation
IBM CloudLinuxONE + SGXHyper Protect Services (LinuxONE), SGX-enabled bare metal, Hyper Protect DBaaS (confidential managed DB)

Frequently Asked Questions

Related Security & Privacy Guides

Continue with closely related troubleshooting guides and developer workflows.