tezvyn:

Database Encryption: Protecting Data at Rest

AI-drafted, machine-checkedSource: Wikipedia: Database encryptionintermediate

Database encryption turns your data into useless gibberish for anyone without the key. It protects sensitive data at rest, like PII or financial records, from direct theft of the database files.

WHY IT EXISTS Databases often store sensitive information like customer data or financial records. If an attacker gains access to the server's file system or steals a physical hard drive, they could read this data directly. Database encryption was created to make this stolen data unreadable and worthless without the proper decryption keys, protecting data even when physical or file-level access is compromised.

THE MENTAL MODEL Database encryption transforms readable data (plaintext) into incomprehensible gibberish (ciphertext) using a secret key. It's like writing a diary in a secret code. Even if someone steals the diary, they can't understand it without the codebook (the encryption key). This protection applies to data 'at rest'—when it's sitting on a disk, in a backup, or on other storage media.

HOW IT WORKS An encryption algorithm (like AES-256) and a secret key are used to encrypt data as it's written to the database and decrypt it when an authorized user or application reads it. The main approaches are: first, Transparent Data Encryption (TDE), where the database encrypts entire files automatically, invisible to the application; second, column-level encryption, where only specific sensitive columns are encrypted; and third, application-level encryption, where the application encrypts data before it even reaches the database. The security of the entire system hinges on securely managing the encryption keys.

WHEN TO USE IT Use database encryption whenever you store sensitive data that must be protected against theft or unauthorized access at the file system level. This is essential for regulatory compliance like GDPR, HIPAA, and PCI-DSS, and for protecting any Personally Identifiable Information (PII), financial details, or trade secrets.

WHEN NOT TO USE IT Encryption introduces computational overhead, slowing down reads and writes. For non-sensitive, public data where performance is critical and the risk of a data-at-rest breach is low, the overhead may not be justified. Importantly, encryption is not a magic bullet; it does not protect against attacks like SQL injection where the attacker uses the application's own legitimate permissions to access data, which the database will dutifully decrypt for them.

ONE CANONICAL EXAMPLE A cloud application stores user profiles. The database is protected with TDE. An attacker breaches the cloud provider's storage and downloads the database backup files. When they try to open the files, the data is unreadable ciphertext because they do not have the encryption keys. The data-at-rest protection worked. However, if the attacker had instead used a SQL injection flaw in the web app, the database would have decrypted the data for the query, and the data would have been exposed.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.