SECTION 1
Historical Context & Motivation
The challenge of protecting sensitive information during storage and transmission predates cloud computing by decades. When organizations began migrating workloads from on-premises data centers to third-party cloud service providers (CSPs) in the late 2000s, a fundamental trust problem emerged: how can an enterprise ensure the confidentiality and integrity of its data when the underlying hardware, network fabric, and administrative access belong to another entity? Encryption — the mathematical transformation of plaintext into ciphertext using a secret key — became the primary control for addressing this concern, evolving from a military and diplomatic tool into a ubiquitous infrastructure layer embedded in every major cloud platform.
1976 • Diffie–Hellman Key Exchange
2001 • AES Standardized by NIST
2006 • Launch of AWS S3 & EC2
2014 • Google Encrypts Inter-Datacenter Traffic
2018–Present • Default Encryption & Zero-Trust Architectures
This historical trajectory reveals a recurring pattern: every expansion of the attack surface — from local disks to network links to shared multi-tenant infrastructure — has been met with a corresponding expansion of cryptographic controls. The central question that this lesson addresses is: what are the distinct threat models, mechanisms, and trade-offs of encrypting data at rest versus data in transit within cloud environments?
SECTION 2
Core Principles & Definitions
Before examining encryption at rest and in transit individually, it is essential to establish the foundational concepts that underlie both. Cloud encryption is not a single monolithic feature but rather a layered architecture involving multiple actors — the data owner, the cloud service provider, and potentially third-party key management services — each playing a distinct role in key generation, storage, rotation, and access control. The following principles form the conceptual bedrock of the entire domain.
Symmetric Encryption
Asymmetric Encryption
Key Management
Envelope Encryption
Defense in Depth
KEY TAKEAWAY
SECTION 3
Visual Explanation — Data Lifecycle in the Cloud
The following diagram illustrates the two primary encryption domains within a typical cloud architecture. On the left, a client application communicates with the cloud over a public network secured by TLS (encryption in transit). On the right, the cloud storage subsystem protects persisted data with AES-256 encryption at rest. The key management service sits centrally, issuing and managing keys for both domains. Observe how data transitions from plaintext inside the client, to ciphertext on the wire, back to plaintext in the application tier, and finally to ciphertext on disk — each transition represents a potential vulnerability that encryption addresses.
Notice the critical gap between the in-transit and at-rest encryption zones: the application tier processes data in plaintext in memory. This is by design — the application must be able to read and manipulate the data to perform its function. However, this gap is precisely why encryption in use (sometimes called confidential computing) is an active research area. Technologies like Intel SGX and AMD SEV attempt to protect data even while it is being processed, but they remain outside the mainstream scope of most cloud encryption discussions today.
SECTION 4
How Cloud Encryption Works — Mechanisms in Depth
Encryption at Rest
When a cloud service encrypts data at rest, the goal is to render stored data unintelligible to anyone who gains physical or logical access to the storage medium without possessing the corresponding decryption key. This includes scenarios such as a stolen hard drive, an unauthorized database administrator, or a government subpoena served to the cloud provider. The dominant algorithm is AES-256 operating in Galois/Counter Mode (GCM), which provides both confidentiality and integrity through authenticated encryption. The CSP typically implements encryption at one or more layers: the storage controller (full-disk encryption), the object/block storage service (server-side encryption), or the client SDK (client-side encryption before data leaves the tenant's application).
SYMMETRIC ENCRYPTION (AES)
Where C is the ciphertext, P is the plaintext, K is the symmetric key (256 bits for AES-256), E is the encryption function, and D is the decryption function. The same key K is used in both directions, which is why secure key storage is paramount.
Envelope Encryption in Detail
Rather than encrypting every stored object directly with a master key, cloud providers employ envelope encryption. A unique data encryption key (DEK) is generated per object (or per chunk), and the DEK itself is then encrypted ("wrapped") by a key encryption key (KEK) stored in the KMS. The wrapped DEK is stored alongside the ciphertext. To decrypt, the application first sends the wrapped DEK to the KMS for unwrapping, receives the plaintext DEK, and then uses it locally to decrypt the data. This architecture means the master key (KEK) never leaves the HSM, limiting its exposure surface dramatically.
ENVELOPE ENCRYPTION
The stored artifact consists of two components: the ciphertext produced by encrypting the plaintext with the DEK, and the wrapped DEK produced by encrypting the DEK with the KEK. Key rotation involves re-wrapping DEKs with a new KEK without re-encrypting the bulk data.
Encryption in Transit
Encryption in transit protects data as it moves between the client and the cloud service, between microservices within the cloud, or between data centers in a multi-region deployment. The foundational protocol is Transport Layer Security (TLS), currently at version 1.3 (RFC 8446). A TLS connection is established via a handshake that combines asymmetric and symmetric cryptography: the client and server use asymmetric algorithms (e.g., ECDHE for key agreement, RSA or ECDSA for authentication) to securely negotiate a shared symmetric session key, which is then used to encrypt the application-layer payload using AES-GCM or ChaCha20-Poly1305. This hybrid approach leverages the strengths of both families — asymmetric for key exchange, symmetric for bulk throughput.
TLS 1.3 HANDSHAKE (SIMPLIFIED)
The session key is derived from the shared secret produced by Elliptic Curve Diffie–Hellman Ephemeral (ECDHE) key exchange, then expanded using HKDF (HMAC-based Key Derivation Function). Ephemeral keys ensure forward secrecy: even if the server's long-term private key is compromised later, past sessions remain secure.
Mutual TLS (mTLS)
SECTION 5
Encryption Models — Who Holds the Keys?
A crucial dimension of cloud encryption is not just which algorithm is used, but who controls the encryption keys. The key custodian determines the trust boundary: if the CSP holds all the keys, the CSP can technically access your plaintext data. Conversely, if the customer holds all the keys, the CSP cannot offer value-added services that require reading the data (e.g., indexing, compression, deduplication). Cloud providers typically offer multiple models along this spectrum, each with distinct security, usability, and cost trade-offs.
| Model | Key Generation | Key Storage | Encryption Location | CSP Access to Plaintext? |
|---|---|---|---|---|
| SSE – Provider Keys | CSP | CSP KMS | Server-side | Yes |
| SSE – Customer-Managed Keys | Customer (in CSP KMS) | CSP KMS (customer's key ring) | Server-side | Technically, during processing |
| SSE – Customer-Provided Keys | Customer (external) | Customer's infrastructure | Server-side (key in memory only) | Briefly, during operation |
| Client-Side Encryption | Customer (external) | Customer's infrastructure | Client-side | No |
Comparison of cloud encryption key custody models
SECTION 6
Worked Example — Designing an Encryption Architecture
Consider a healthcare startup building a patient records application on AWS. The application stores protected health information (PHI) in Amazon S3 and communicates with a React front-end via an API Gateway. Federal regulations (HIPAA) require encryption of PHI both at rest and in transit. The security team must choose appropriate encryption models and document the architecture.
Healthcare Cloud Encryption Architecture
- 1
Step 1 — Identify Regulatory Requirements
HIPAA's Security Rule (§ 164.312(a)(2)(iv) and § 164.312(e)(2)(ii)) specifies encryption as an addressable implementation specification for data at rest and in transit. The startup's risk assessment determines that encryption is a reasonable and appropriate safeguard for PHI stored in S3 and transmitted over the internet. This means both encryption at rest and encryption in transit are required.Both at-rest and in-transit encryption required by HIPAA - 2
Step 2 — Select Encryption at Rest Model
Given the sensitivity of PHI, the team selects SSE-KMS (customer-managed keys) for S3. They create a customer master key (CMK) in AWS KMS with a key policy that restricts decrypt permissions to the application's IAM role only. They enable automatic key rotation (every 365 days) and configure CloudTrail to log all KMS API calls for audit purposes.S3 bucket policy:"x-amz-server-side-encryption": "aws:kms"with customer CMK ARN - 3
Step 3 — Implement Envelope Encryption Flow
When the application uploads a patient record to S3, the following occurs automatically: (1) S3 calls KMS to generate a unique DEK; (2) KMS returns both the plaintext DEK and a copy encrypted (wrapped) with the CMK; (3) S3 uses the plaintext DEK to encrypt the object with AES-256-GCM; (4) S3 stores the ciphertext alongside the wrapped DEK; (5) S3 discards the plaintext DEK from memory. On retrieval, S3 sends the wrapped DEK back to KMS for unwrapping, receives the plaintext DEK, decrypts the object, and returns the plaintext to the authorized caller.Envelope encryption ensures the CMK never leaves the HSM boundary - 4
Step 4 — Configure Encryption in Transit
The team configures AWS API Gateway with a custom domain and an ACM (AWS Certificate Manager) TLS certificate. They enforce TLS 1.2 as the minimum protocol version on the API Gateway's security policy, disabling all older cipher suites. For S3 access, they apply a bucket policy that denies any request whereaws:SecureTransportisfalse, ensuring all API calls to S3 must use HTTPS. Internal communication between the API service and the database uses TLS with certificates managed by AWS Private CA.S3 bucket policy condition:"Condition": {"Bool": {"aws:SecureTransport": "false"}} → Deny - 5
Step 5 — Validate and Document
The team validates the architecture by: (a) usingopenssl s_clientto confirm TLS 1.2+ negotiation on the API endpoint; (b) checking S3 object metadata to verify thex-amz-server-side-encryptionheader is present with valueaws:kms; and (c) reviewing CloudTrail logs to confirm KMS Decrypt events correlate with authorized application reads. They document these controls in the HIPAA Security Risk Assessment as evidence of compliance.Architecture achieves defense in depth: TLS on the wire, AES-256-KMS on disk, customer-controlled keys, full audit trail
SECTION 7
Strengths, Limitations & Trade-offs
Cloud encryption is a powerful control, but it is not a panacea. Understanding its limitations is as important as understanding its strengths, because overestimating what encryption provides can lead to dangerous false confidence. The following table contrasts the two primary encryption domains across several dimensions.
| Dimension | Encryption at Rest | Encryption in Transit |
|---|---|---|
| Primary Threat Mitigated | Physical theft of storage media, unauthorized disk access, insider threats at the storage layer | Network eavesdropping, man-in-the-middle attacks, packet sniffing on shared infrastructure |
| Primary Algorithm | AES-256-GCM (symmetric) | TLS 1.3 (hybrid: ECDHE + AES-GCM / ChaCha20) |
| Performance Impact | Minimal — AES-NI hardware acceleration in modern CPUs reduces overhead to < 2% | Handshake latency (1 RTT for TLS 1.3); negligible symmetric encryption overhead after handshake |
| What It Does NOT Protect | Data in memory, data accessible via authorized application queries, metadata (file names, sizes) | Data after arrival at the endpoint, traffic analysis (packet sizes/timing), compromised endpoints |
| Key Risk | Key loss = permanent data loss; key compromise = full exposure | Certificate mismanagement, expired certs, failure to enforce minimum TLS version |
| Operational Complexity | Key rotation, access policy management, cross-region key replication | Certificate lifecycle management, cipher suite configuration, mTLS rollout |
Comparative analysis of encryption at rest vs. encryption in transit
KEY TAKEAWAY
kms:Decrypt can still read the plaintext. Think of encryption as a locked door: the lock is important, but the real security question is who has the key and under what conditions can they use it. Encryption must always be paired with robust identity management, least-privilege policies, and continuous monitoring to be effective.SECTION 8
Connection to Advanced Topics — Beyond At-Rest and In-Transit
The at-rest/in-transit dichotomy, while foundational, leaves an important gap: data that is being actively processed in memory is typically unencrypted. This has driven the emergence of confidential computing, a paradigm that uses hardware-based Trusted Execution Environments (TEEs) such as Intel SGX, AMD SEV-SNP, and ARM TrustZone to protect data even during computation. Additionally, advances in homomorphic encryption (FHE) promise the ability to perform computations on ciphertext directly, though current schemes remain orders of magnitude slower than plaintext operations and are not yet practical for general workloads. The table below positions the concepts covered in this lesson relative to these advanced approaches.
| Data State | This Lesson's Scope | Advanced Approach | Maturity |
|---|---|---|---|
| At Rest (on disk) | AES-256-GCM via SSE/CSE with KMS | Searchable encryption, format-preserving encryption (FPE) | Production-ready (standard); niche (advanced) |
| In Transit (on wire) | TLS 1.3 / mTLS | Post-quantum key exchange (ML-KEM / Kyber) | Production-ready (standard); standardizing (advanced) |
| In Use (in memory) | Not covered — plaintext gap | TEEs (Intel SGX, AMD SEV-SNP), Fully Homomorphic Encryption (FHE) | TEEs: GA on major CSPs; FHE: research/early adoption |
Mapping data states to current and advanced encryption approaches
Post-Quantum Readiness
As you advance in cloud security, consider how encryption in use completes the triad and how the shift toward zero-trust architectures — where every network segment is treated as hostile — further blurs the traditional at-rest/in-transit boundary. Service meshes, for example, apply mTLS between every microservice, effectively making all internal communication encrypted in transit by default, while confidential computing extends the at-rest guarantee into the CPU cache and registers.
SECTION 9
Practice Problems
Question 1: CONCEPTUAL
Show answer
Question 2: BASIC CALCULATION
Show answer
Question 3: INTERMEDIATE
Show answer
Question 4: APPLIED
Show answer
Question 5: CRITICAL THINKING
Show answer
SUMMARY
Lesson Summary
Summary
Cloud encryption addresses the fundamental trust challenge of storing and transmitting data on infrastructure controlled by a third party. Encryption at rest uses AES-256-GCM to render stored data unintelligible without the decryption key, protecting against physical media theft, unauthorized disk access, and storage-layer insider threats. Envelope encryption structures the key hierarchy into data encryption keys (DEKs) and key encryption keys (KEKs), enabling efficient key rotation and limiting master key exposure. Encryption in transit relies on TLS 1.3 to protect data from network eavesdropping and man-in-the-middle attacks, using a hybrid of asymmetric key exchange (ECDHE) and symmetric bulk encryption with forward secrecy.
The choice of key custody model — CSP-managed, customer-managed, or client-side — determines the trust boundary and the operational burden on the data owner. Neither encryption at rest nor encryption in transit protects data in use, which remains an active frontier addressed by confidential computing and homomorphic encryption. Effective cloud security requires treating encryption as one layer in a defense-in-depth strategy, always paired with robust identity and access management, audit logging, and continuous monitoring.