Course contentsShow
← Cloud and Infrastructure
Lesson 2301 of 2,98949. KMS and EncryptionFree lesson

Database Encryption Patterns

Learn encryption options for databases including transparent data encryption, column-level, and application-level encryption.

Database Encryption Patterns

What you'll learn: You'll understand the three main approaches to encrypting database data — transparent data encryption, column-level encryption, and application-level encryption — and when to use each.

Why Multiple Patterns?

Databases hold sensitive data like credit card numbers, health records, and personal information. Different encryption patterns exist because you need to balance security, performance, and operational complexity based on what you're protecting and who you're protecting it from.

Three Core Patterns

1. Transparent Data Encryption (TDE)

What it is: The database engine encrypts the entire database storage layer automatically. Think of it like storing your entire filing cabinet in a locked vault — everything inside is protected, but authorized users with the vault key see files normally.

When to use: You want broad protection against disk theft or snapshot leaks without changing application code. Most cloud databases support TDE using provider-managed or customer-managed keys (from your KMS).

2. Column-Level Encryption

What it is: Specific sensitive columns (like social_security_number or credit_card) are encrypted while others remain in plaintext. Like locking only the confidential folders in your filing cabinet.

When to use: You need fine-grained control, want to protect sensitive fields even from database administrators, or must meet compliance requirements for specific data types. The database engine handles encryption/decryption with keys from KMS.

3. Application-Level Encryption

What it is: Your application code encrypts data before inserting it into the database and decrypts after retrieval. The database only ever sees ciphertext. Like sealing letters before putting them in the filing cabinet — even the cabinet manager can't read them.

When to use: Maximum security — protecting data from cloud provider, DBAs, and anyone with database access. Requires careful key management and prevents database-level operations on encrypted fields (searching, sorting).

Key Takeaway: TDE protects storage-at-rest broadly, column-level encryption targets specific sensitive fields with database-native features, and application-level encryption provides maximum control but requires application changes and blocks database operations on encrypted data.