Data encryption
Encryption turns a stolen disk or a sniffed connection into a non-event, but
only when the keys are managed as carefully as the data. Hardcoded keys and
homemade ciphers imitate protection while leaving the door open, which is worse
than none because it buys false confidence.
Method
- Require TLS 1.2 or higher on every hop, service-to-service traffic
included. Terminate with certificates from a managed CA (ACM, Let's Encrypt),
disable TLS 1.0 and 1.1 and weak ciphers, and turn on HSTS at public edges so
no downgrade slips through.
- Encrypt at rest with AES-256 via managed storage encryption: EBS, S3
SSE-KMS, RDS, Cloud SQL. Switch it on at creation, because retrofitting an
unencrypted volume is a full migration, not a config toggle.
- Hold keys in a KMS, never in code. Use AWS KMS, GCP KMS, or HashiCorp
Vault, and let the application call the service to encrypt, decrypt, or
unwrap a data key without ever touching the master key. Scan the repo for
high-entropy strings before each release.
- Use envelope encryption for bulk data. Generate a data encryption key
(DEK) per object, encrypt the payload with it, wrap the DEK under the KMS
master key (KEK), and store the wrapped DEK beside the ciphertext. One master
key then protects millions of objects it never directly touches.
- Rotate on a clock and on compromise. Enable automatic annual rotation of
master keys and re-wrap DEKs against the new version; on a suspected leak,
rotate now and re-encrypt. Rotation you cannot complete in a day is a plan,
not a control.
- Reach for vetted primitives only. libsodium/NaCl, the platform crypto
library, or AES-GCM for authenticated encryption. Never ECB mode, never a
static or reused IV, and never MD5 or SHA-1 where the value bears security
weight.
- Scope key use with least privilege. Grant encrypt and decrypt separately,
per service. An ingestion service that only writes should not hold a decrypt
grant, or one stolen credential reads the whole store.
Checks
- Does any endpoint still accept TLS 1.0 or 1.1, or fall back to plaintext HTTP?
- Can you rotate a master key today without shipping an application code change?
- Is any key, IV, or password sitting anywhere in the git history?
Boundaries
This covers transport and storage encryption. Finding secrets that slipped into
code is secrets-scanning. Choosing algorithms for a regulated regime (FIPS
140-2, for example) follows that standard's approved list, not general
preference.
1---2name: data-encryption3description: Encrypt data at rest and in transit with vetted primitives and a managed key service that rotates on schedule. Use when handling sensitive data on disk or over the network, or when reviewing how a system stores and moves it.4---56# Data encryption78Encryption turns a stolen disk or a sniffed connection into a non-event, but9only when the keys are managed as carefully as the data. Hardcoded keys and10homemade ciphers imitate protection while leaving the door open, which is worse11than none because it buys false confidence.1213## Method14151. **Require TLS 1.2 or higher on every hop,** service-to-service traffic16 included. Terminate with certificates from a managed CA (ACM, Let's Encrypt),17 disable TLS 1.0 and 1.1 and weak ciphers, and turn on HSTS at public edges so18 no downgrade slips through.192. **Encrypt at rest with AES-256 via managed storage encryption:** EBS, S320 SSE-KMS, RDS, Cloud SQL. Switch it on at creation, because retrofitting an21 unencrypted volume is a full migration, not a config toggle.223. **Hold keys in a KMS, never in code.** Use AWS KMS, GCP KMS, or HashiCorp23 Vault, and let the application call the service to encrypt, decrypt, or24 unwrap a data key without ever touching the master key. Scan the repo for25 high-entropy strings before each release.264. **Use envelope encryption for bulk data.** Generate a data encryption key27 (DEK) per object, encrypt the payload with it, wrap the DEK under the KMS28 master key (KEK), and store the wrapped DEK beside the ciphertext. One master29 key then protects millions of objects it never directly touches.305. **Rotate on a clock and on compromise.** Enable automatic annual rotation of31 master keys and re-wrap DEKs against the new version; on a suspected leak,32 rotate now and re-encrypt. Rotation you cannot complete in a day is a plan,33 not a control.346. **Reach for vetted primitives only.** libsodium/NaCl, the platform crypto35 library, or AES-GCM for authenticated encryption. Never ECB mode, never a36 static or reused IV, and never MD5 or SHA-1 where the value bears security37 weight.387. **Scope key use with least privilege.** Grant encrypt and decrypt separately,39 per service. An ingestion service that only writes should not hold a decrypt40 grant, or one stolen credential reads the whole store.4142## Checks4344- Does any endpoint still accept TLS 1.0 or 1.1, or fall back to plaintext HTTP?45- Can you rotate a master key today without shipping an application code change?46- Is any key, IV, or password sitting anywhere in the git history?4748## Boundaries4950This covers transport and storage encryption. Finding secrets that slipped into51code is secrets-scanning. Choosing algorithms for a regulated regime (FIPS52140-2, for example) follows that standard's approved list, not general53preference.