Skip to content
Velloreth
Cybersecurity 10 min read

Encryption at Rest vs in Transit: What Each Protects

Encryption at rest protects stored data from disk theft and provider access. Encryption in transit protects moving data from network interception. Both matter, differently.

By

Encryption gets described as a single thing when it is really two different protections applied at different points in a system’s life. Encryption in transit protects data while it moves between machines. Encryption at rest protects data while it sits on a disk, a tape, or a blob store. Confusing them is common, and the confusion shows up in real incidents: a company that spent months on TLS discovery leaves its database backups unencrypted, or a team that encrypts everything at rest assumes users are safe on coffee-shop WiFi.

This post separates the two, covers what each actually defends against, and walks through the decisions you make in practice.

The two states of data

Data in a running system exists in a few states, and each has its own protection:

StateWhere it livesProtectionAttacker you are defending from
In transitNetwork between client and server, server to serverTLS (HTTPS), mTLS, VPNsNetwork eavesdropper, MITM, compromised router
At restDisks, SSDs, backups, snapshots, object storageDisk or file encryption, KMS, database TDEStolen hardware, disposed media, leaked backup, rogue ops staff
In useRAM, CPU registers, cachesRare — confidential computing, enclavesSomeone with root on the running host

Most application security focuses on the first two. The third exists but is a specialized tool, not a default.

Encryption in transit

What it protects

When a browser talks to your site over HTTPS, TLS provides three properties:

  • Confidentiality. An observer on the path sees encrypted bytes, not the request body or response.
  • Integrity. Modified packets are detected and the connection fails rather than delivering tampered data.
  • Authentication. The server proves it holds a certificate for the domain, so a rogue hotspot cannot silently impersonate your site.

That covers the classic attacks: coffee-shop sniffing, ISP-level interception, DNS hijacking followed by a fake site, and session cookie theft on the wire.

What it does not protect

TLS ends at your server. Once the request is decrypted, the data exists in plaintext in application memory, and then usually in a database. If your database connection is not encrypted, the hop from app server to database is a gap. If backups are unencrypted files on a shared disk, TLS did nothing for that copy.

TLS also does nothing about an attacker who sends valid authenticated requests. A stolen session token used over a perfectly encrypted connection is indistinguishable from legitimate traffic.

The standards that matter in 2026

TLS 1.3 is the version you should be running by default. Compared to TLS 1.2 it:

  • Reduces the handshake to one round trip (0-RTT resumption in some cases).
  • Removes legacy cipher suites and weak key-exchange options entirely.
  • Eliminates downgrade attacks by design.
  • Makes the protocol easier to configure securely, because there are fewer knobs to get wrong.

TLS 1.2 is not broken. If you must support old clients, keep it, but with AEAD cipher suites only (AES-GCM, ChaCha20-Poly1305) and disable everything else. Everything below TLS 1.2 should be off the table entirely.

Certificate management is now mechanical: ACME (the protocol behind Let’s Encrypt and most modern CAs) automates issuance and renewal. There is no reason in 2026 for a manually renewed certificate on a public site.

Encryption inside your infrastructure

The client-to-server hop gets the attention, but internal traffic matters too:

  • Database connections. Enable TLS on Postgres, MySQL, and managed database services. Managed providers usually default to encrypted connections; self-hosted setups often do not.
  • Service-to-service. For anything on a shared or semi-trusted network, mutual TLS or a service mesh (Linkerd, Istio) gives you authenticated encryption between services, not just between client and app.
  • Message queues and caches. Redis and Kafka both support TLS; enable it if traffic crosses a network you do not fully control.

Forward secrecy, briefly

One property of modern TLS worth naming: forward secrecy (ephemeral key exchange, usually ECDHE). With forward secrecy, each session negotiates a temporary key pair that is discarded after the session ends. Even if an attacker later steals the server’s long-term private key, they cannot decrypt past recorded sessions — they can only impersonate the server for future ones.

TLS 1.3 mandates forward secrecy-capable key exchange; TLS 1.2 offered it as an option (look for cipher suites with ECDHE in the name). If you are configuring a TLS 1.2 server for compatibility, prefer ECDHE suites over the older DHE-less options for exactly this reason.

Certificate pinning, briefly

Mobile apps sometimes pin a server’s certificate or public key so that a compromised certificate authority cannot issue a trusted cert for the app’s domain. It is a strong control with a sharp edge: pinning that is not paired with a rotation plan will brick the app when the certificate changes. Most consumer apps now rely on standard TLS validation plus platform network security configs rather than hard pinning; consider pinning only for high-risk apps where CA compromise is in your threat model and you can ship an update quickly.

Encryption at rest

What it protects

At-rest encryption protects the copy on the medium. Disks get stolen. Decommissioned servers get resold. Backup tapes get lost. Cloud storage misconfigurations expose buckets. In all of those cases, encrypted data is ciphertext to the thief — useless without the key.

It also provides a weaker but useful property: operational separation. An engineer with disk-level access cannot read your database files, because the decryption key lives elsewhere (in a KMS, in a TPM, in a different system).

What it does not protect

  • An attacker with application-level access. If they can query your database through the app, TDE (transparent data encryption) does nothing — the database decrypts for them.
  • A compromised KMS or key-management process. If the key is available to whatever is reading the data, so is the plaintext.
  • Live memory. Data in use is decrypted; at-rest encryption does not apply to RAM.

How it is implemented

LayerMechanismWho holds the key
Full diskLUKS (Linux), BitLocker (Windows), FileVault (macOS)OS / user
Cloud block storageAWS EBS encryption, GCP PD encryption, Azure Disk EncryptionProvider or customer (via KMS)
Object storageS3 default encryption, GCS, Azure Blob encryptionProvider or customer
DatabaseTDE (SQL Server, Oracle, some managed services), field-level encryptionProvider or customer
BackupsEncrypted snapshot formats, client-side encryption before uploadWhoever runs the backup

In 2026, most major cloud providers encrypt at rest by default with provider-managed keys. AWS S3, GCP Persistent Disk, and Azure Storage all do this without any configuration. That default is real protection against physical media theft and disposal.

The key-management question

The meaningful decision is not whether to encrypt — it is who can decrypt.

Provider-managed keys. The cloud provider generates and stores the keys and decrypts data as part of normal service operation. Protection: physical media, disposed drives, rogue hardware operators. Not protection: the provider itself, or anyone with full administrative access to your account and its services.

Customer-managed keys (KMS). You create and control a key in a KMS (AWS KMS, GCP Cloud KMS, Azure Key Vault). The provider still handles the mechanics, but key policies determine who and what can use the key. Some configurations support customer-provided keys or hold-your-own-key models where the provider never sees the key material at all. Protection adds: provider access, cross-tenant isolation guarantees, and compliance requirements that demand key control (certain HIPAA, PCI, and government frameworks).

Client-side encryption. You encrypt data in the application before it ever reaches storage. Strongest against storage-provider compromise, but you own key distribution, rotation, and the “lost key means lost data” problem. Worth it for high-sensitivity fields (health data, cryptographic secrets, payment tokens), not for general application data.

A practical rule: if your compliance requirements or threat model include “the cloud provider should not be able to read this,” you need customer-managed keys or client-side encryption. If your threat model is “a stolen disk should not leak data,” the default provider encryption is sufficient.

Encryption is not hashing

A common category error in application design: treating a hash like encryption. They solve different problems.

PropertyEncryptionHashing
ReversibleYes, with the keyNo
Use forData you need to read backData you only need to compare
ExampleEncrypting a database columnStoring a password
Key required to verifyYesNo

Passwords are hashed (with a slow, salted algorithm — Argon2, bcrypt, or scrypt), never encrypted, because the application should never need to recover the plaintext. Personal data you must display to the user is encrypted, never hashed. Reversing the two produces either a system that leaks plaintext passwords or one that cannot function.

Within encryption, there is also a layering decision: envelope encryption. The data is encrypted with a data encryption key (DEK); the DEK itself is encrypted with a key encryption key (KEK) held in your KMS. This lets you rotate the KEK without re-encrypting terabytes, and it is how managed KMS services work under the hood.

Field-level encryption: when disk-level is not enough

Transparent data encryption and disk encryption protect against media theft. They do nothing for an attacker reading through the database with valid credentials — or for a support engineer running an ad-hoc query. For specific high-sensitivity fields, encrypt them in the application before storage:

// Conceptual: encrypt one column with a per-record key
const ciphertext = aesGcmEncrypt(record.ssn, fieldKey);
await db.insert({ user_id, ssn_encrypted: ciphertext });

// Read path
const ssn = aesGcmDecrypt(row.ssn_encrypted, fieldKey);

The trade-offs are real: you lose the ability to query the field directly (indexes do not work on ciphertext without extra machinery like blind indexing), backups of the database are useless without the keys, and application code owns key management. Field-level encryption is the right tool for social security numbers, payment tokens, and health identifiers — not for every column.

Putting them together: a small-team checklist

You do not need an enterprise program. You need these configurations turned on:

In transit:

  1. TLS 1.3 enabled on every public endpoint; TLS 1.2 allowed only with AEAD ciphers if old clients require it.
  2. HTTP to HTTPS redirect, with HSTS enabled.
  3. Certificate automation (ACME) so renewals never lapse.
  4. TLS on database connections, including internal ones.
  5. mTLS or an equivalent for service-to-service traffic on shared networks.

At rest:

  1. Encryption enabled on every disk, bucket, and database — confirm, do not assume, even if the provider says “default.”
  2. Backups encrypted with a key that is not the same as the production data key where possible.
  3. Customer-managed keys for anything with regulatory requirements or a stated provider-access threat.
  4. Key rotation on a schedule (annual at minimum; KMS makes this cheap).
  5. Access to keys scoped to the services that need them, with logging on key use.

The gap people still miss

The most common real-world failure is neither of the two encryptions — it is access control. An attacker with valid credentials reading a database through the application interface sees plaintext, because the application is authorized to decrypt. Encryption at rest and in transit both work exactly as designed in that scenario, and the attacker wins anyway.

Treat encryption as a layer that handles physical and network threats, and access control as the layer that handles everyone else. MFA, least privilege, short session lifetimes, and audit logging on data access are what close that gap — no cipher choice will.

Frequently asked questions

Is HTTPS enough to protect my data?
HTTPS protects the connection between the client and your server. Once the request reaches your server, the data sits in memory and then on disk — that is where encryption at rest applies. If your database or backups are unencrypted, a stolen disk or backup leak exposes everything HTTPS protected in flight.
Do cloud providers encrypt my data by default?
Most major providers encrypt data at rest by default with provider-managed keys (AWS S3, GCP Persistent Disk, Azure Storage all do). The default protects against physical media theft. It does not protect against the provider itself or a compromised provider account with full access.
What is the difference between provider-managed and customer-managed keys?
Provider-managed keys mean the cloud provider can encrypt and decrypt your data as part of normal operations. Customer-managed keys (AWS KMS, GCP Cloud KMS, Azure Key Vault) mean you control the key policy; the provider cannot read your data without your key granting it. That is a meaningful difference for compliance and threat models.
Does TLS 1.2 still count as secure?
Yes, when configured with modern cipher suites, TLS 1.2 is still cryptographically sound. TLS 1.3 is preferred because it removes weak options by design, negotiates faster, and eliminates downgrade attacks. Offering only TLS 1.2 is a compatibility decision, not a security failure.