Case FF5790 · Cryptography · L3 Applied

Encrypting Sensitive Database Fields

Practise as: InterviewLevel: L3 Applied

Interview questionWe store national ID numbers in Postgres and TDE is already on. Is that enough, and if not, what would you build?

  1. 01 Answer
  2. 02 Example
  3. 03 Trade-offs
What a strong answer covers

Try it out loud first. Then check yourself:

  1. TDE and disk encryption only stop stolen media or backups; SQL injection, app compromise and DBAs still see plaintext.
  2. App-layer AEAD with envelope keys from KMS; bind row ID and column as associated data so ciphertexts cannot be swapped.
  3. Search: an HMAC blind index with a separate key gives equality lookups; deterministic encryption leaks equality and frequency.
  4. Alternative: a tokenization vault removes the data from most systems entirely, shrinking compliance scope at a latency cost.
  5. Trade-offs: no range queries or LIKE, key rotation needs re-encryption jobs, and KMS access logs become your audit trail.

If the interviewer pushes back

  • A low-entropy field like a 9-digit ID makes the blind index brute-forceable if its key leaks. How do you reduce that risk?

More Cryptography cards

All Cryptography cards →

cardosec draws a security topic and gives you a clock: explain it out loud with no notes, then see what you covered and what you missed. Free during early access.

Reviewed 2026-10-09