Encryption At Rest & In Transit
Transparent Data Encryption (TDE) protects disks, but application-level encryption protects the data.
The Layered Cryptographic Model
A breached AWS S3 bucket often contains plaintext JSON because engineers assumed bucket-level encryption (SSE-S3) was sufficient. SSE protects against physical drive theft. It does not protect against an SSRF vulnerability dumping your bucket contents.
| Layer | Standard | Protects Against |
|---|---|---|
| In Transit | TLS 1.2 / 1.3 | Network sniffing, MitM attacks. |
| At Rest (Disk) | AES-256-XTS | Physical theft of datacenter hardware. |
| At Rest (App) | AES-256-GCM (AEAD) | Database dumps, SQL injection exfiltration. |
Tool: Key Size & Algorithm Selector
Worked Example: Application Level Encryption
Instead of writing `INSERT INTO users (email) VALUES ('[email protected]')`, you encrypt it in the application memory:
const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
let enc = cipher.update('[email protected]', 'utf8', 'hex');
enc += cipher.final('hex');
const tag = cipher.getAuthTag();
The database stores the ciphertext, the IV, and the Auth Tag. A SQL injection attack only retrieves useless bytes.
FAQ
What is KMS?
Key Management Service. Instead of hardcoding the master key in environment variables, the application requests the key from AWS/GCP KMS at runtime.
Is MD5 safe for hashing emails for gravatars?
Technically MD5 is completely broken for security, but Gravatar still uses it. You are leaking emails to rainbow tables if you use it publicly.
Explore Architecture Requirements
- GDPR Engineering
- CCPA/CPRA Technical Mechanics
- Automated Data Mapping
- Implementing Right to Erasure
- Data Portability JSON Exports
- Consent Management Architecture
- Automated Breach Response
- Cross-Border Data Transfers
- DSAR Automation Pipelines
- Catastrophic Cryptography Fails
- Database Deletion Workflows
- Gating Third-Party Scripts
- Auth via Identity Providers
- Cookie Banner Compliance
- Vendor & Subprocessor Risk
- API Privacy & Security
- End-to-End Encryption (E2EE)
- Log Retention
- Cloud Compliance
- DPO Specs
- Homepage