Database encryption explained: Learn how TDE, client-side encryption, and key management protect data, where gaps remain, and what to check in your design.
👉 Master your Security+ skills with Pluralsight here: Pluralsight
You’ll learn how database encryption works, including Transparent Data Encryption (TDE), client-side encryption, and key management. Understand what encryption protects, and where gaps remain, to evaluate database security and build your CompTIA Security+ foundation.
Chapters: 0:00 Intro 0:11 What does database encryption actually do? 0:43 How does transparent database encryption work? 1:31 How is record encryption different from database encryption? 2:19 How are database encryption keys protected? 3:14 Can you search an encrypted database? 3:53 What doesn't database encryption protect against? 4:41 Outro
Affiliate notice: Some links may earn a commission. Thanks for your support.
Key Takeaways
TDE protects database storage, not query access. It encrypts stored data transparently, but authorized queries, including those using compromised accounts, can still return plaintext.
Client-side encryption can keep selected values unreadable to the database server when keys and decryption remain outside its control. The application still needs protection wherever it handles plaintext.
Encryption scope and placement are different. Encrypting a column or field does not necessarily mean the database server cannot decrypt it.
Key management determines security and recoverability. Separate key-use permissions, protect keys with a KMS or HSM where appropriate, and test restoration with the required keys. Losing those keys can make intact data unrecoverable.
Key rotation does not always re-encrypt data. Rewrapping a data-encryption key under a new key-encryption key changes key protection, not necessarily the underlying ciphertext.
Protect every data state and copy. Use TLS for network traffic, verify protection for backups and exports, and check logs and caches for plaintext.
Encryption does not replace broader database security. Least privilege, prepared statements, monitoring, and tested backups remain essential; the OWASP Database Security Cheat Sheet provides complementary safeguards.
👉 Turn understanding into hands-on practice with Pluralsight, an optional next step offering guided security labs, feedback, assessments, and certification practice resources.
Database encryption turns readable information into ciphertext so that someone who obtains the protected data cannot read it without the necessary key. But an “encrypted database” is not automatically protected from every kind of attack.
Where encryption happens, and who can decrypt the data, determines what it protects. Transparent Data Encryption (TDE) protects database storage, while client-side encryption can keep selected sensitive values unreadable to the database server itself.
This guide explains how those approaches work, how encryption keys are protected, and why access controls and recovery planning still matter.
Database Encryption Explained: Plaintext, Ciphertext, and Keys
Database encryption uses a cryptographic algorithm and a key to transform , or readable information, into , its encrypted representation. Authorized software uses the appropriate key to reverse that transformation.
FAQ
Quick answers to the questions people usually ask about this topic.
Does database encryption slow down queries?
It can, but the impact depends on where encryption happens, the database implementation, hardware, and workload. TDE generally preserves ordinary query behavior while adding encryption and decryption work during storage operations. Client-side encryption can have a larger effect on query design because encrypted fields may not support ordinary filtering, sorting, or indexing. Test representative workloads rather than assuming a fixed performance penalty.
Should passwords be encrypted before storing them in a database?
Login passwords should generally be stored using a purpose-built, salted password-hashing algorithm, not reversible encryption. Authentication normally requires checking a submitted password, not recovering the original. Database encryption can provide an additional storage safeguard, but it does not replace secure password hashing.
Can you use TDE and client-side encryption together?
Yes. They address different exposure paths. TDE protects database storage, while client-side encryption can keep selected sensitive values unreadable to the database server when decryption keys remain outside its control. Using both can provide layered protection, but you still need TLS, access controls, and recovery procedures for every required key.
Is database encryption enough to meet security or privacy compliance requirements?
No, not by itself. Requirements vary by regulation, standard, and the data involved. Encryption may support compliance, but enabling TDE does not demonstrate that access permissions, key management, network connections, exports, and backups are adequately protected. Evaluate the complete system against the requirements that apply to your organization.
How can I turn database encryption knowledge into practical cybersecurity skills?
Start by mapping where plaintext exists, who can decrypt it, and what happens if a key becomes unavailable. For guided practice beyond the article, explore Pluralsight. It is an optional next step with security labs, feedback, assessments, and certification practice resources to help you apply foundational concepts and identify topics to review.
AES, the Advanced Encryption Standard, is commonly used for database encryption. It is a symmetric cipher, meaning the same secret key encrypts and decrypts the data. AES supports 128-, 192-, and 256-bit keys.
The algorithm is only one part of the design. A secure implementation also needs appropriate encryption modes, protected keys, restricted permissions, and reliable recovery procedures.
Some constructions provide more than confidentiality. Authenticated encryption, such as AES-GCM, also lets software detect unauthorized changes to protected messages. Simply saying a database “uses AES” does not explain all of these implementation details.
How Transparent Data Encryption Works
Transparent Data Encryption (TDE) encrypts database storage without requiring applications to perform the encryption themselves.
In SQL Server’s page-level implementation, the process works like this:
The database engine processes information in memory.
Before writing a protected database page to disk, it encrypts that page.
The storage system holds encrypted page contents.
When the engine reads the page, it decrypts it into memory.
Authorized queries use the information normally.
“Transparent” describes the application’s experience: ordinary queries generally continue working without application-level encryption code.
What TDE protects
TDE helps protect against disclosure when someone obtains encrypted database files or storage without the necessary decryption capability. For example, a stolen drive should not reveal readable database contents merely because an attacker can access its files.
Microsoft documents TDE as protecting stored data and log files. Exact coverage and recovery requirements depend on the database product and configuration, so backup and export protection should be checked separately.
What TDE does not protect
TDE does not stop the running database from returning plaintext to an authorized requester.
If an attacker compromises an account that can query sensitive records, the database may decrypt and return those records normally. Storage encryption does not determine whether the request should have been allowed.
TDE also does not encrypt network traffic. That requires a separate control, typically Transport Layer Security (TLS).
Encryption terms often describe how much information is encrypted, rather than where encryption occurs.
Encryption scope
What it protects
Example
Disk or volume
Storage containing database files and potentially other files
An encrypted server volume
Database level
Database files, pages, or underlying storage
TDE
Record level
An individual logical record or document payload
An encrypted patient document
Column level
Values in a selected table column
Employee tax identifiers
Field or cell level
A particular attribute or value
A clinical-notes field
Product terminology varies. A system might implement record protection by encrypting a serialized document in the application rather than offering a feature specifically named “record encryption.”
An application could encrypt only clinical_notes, leaving the identifier and department available for ordinary processing. Alternatively, it could encrypt a larger sensitive payload while retaining an identifier for retrieval.
The important distinction is that selective encryption is not necessarily client-side encryption. A database server can encrypt and decrypt individual columns itself. If it holds the keys and processes plaintext, the server remains inside the trusted environment.
Record encryption also differs from row-level security. Row-level security controls which rows a user may access; encryption changes the representation of the protected data. The two controls can work together.
How Client-Side Database Encryption Works
Client-side encryption moves encryption and decryption outside the database engine.
A typical workflow is:
An application receives a sensitive value.
A client library encrypts that value.
The application sends ciphertext to the database.
The database stores the ciphertext.
An authorized client retrieves and decrypts it.
When keys and decryption capabilities remain outside the database server’s control, this design can prevent database administrators from reading selected protected values.
For example, a database administrator might maintain tables containing customer identifiers without having permission to decrypt those identifiers.
However, client-side encryption does not mean plaintext never exists. The authorized application usually needs readable information to display or process it. The trust boundary moves to the client; it does not disappear.
How Database Encryption Keys Are Protected
Encryption is only useful if unauthorized parties cannot obtain or use the decryption keys. It also becomes an availability problem if legitimate users lose those keys.
Envelope encryption: DEKs and KEKs
Many systems use envelope encryption, which separates data encryption from protection of the data-encryption key.
Data-encryption key (DEK) → Encrypts the data
Key-encryption key (KEK) → Encrypts, or “wraps,” the DEK
The wrapped DEK can be stored near the ciphertext, while the KEK remains under separate protection. An authorized service obtains permission to unwrap the DEK and uses it to decrypt the information.
This avoids passing an entire database through a key-management service for every encryption operation. Google Cloud’s envelope-encryption guide explains the hierarchy.
KMS, HSMs, and access permissions
A key-management service or system (KMS) manages cryptographic keys and associated operations. A hardware security module (HSM) provides a protected hardware environment for keys and cryptographic operations.
Good key management includes:
Restricting who can use, administer, rotate, and destroy keys.
Separating database administration from decryption privileges where appropriate.
Monitoring access to sensitive key operations.
Planning rotation and recovery.
Protecting keys needed to restore historical backups.
Keeping unrestricted plaintext keys beside ciphertext undermines the intended separation.
Rotation is not the same as re-encrypting data
Rewrapping a DEK under a new KEK changes how the DEK is protected. It does not necessarily change the database ciphertext.
Replacing the DEK and re-encrypting the data is a different operation. That distinction matters when responding to a compromise involving the data-encryption key itself.
Recovery requires equal attention: losing every usable copy of a required key can make an intact database unrecoverable. Backup testing therefore needs to verify key access as well as data restoration.
Can You Search an Encrypted Database?
The answer depends on the encryption layer and supported query features.
Searching with TDE
Ordinary searches continue to work because the database engine decrypts stored pages internally. The query engine can process readable information.
That convenience also explains why TDE does not prevent authorized queries from exposing sensitive values.
Searching client-encrypted fields
When the database stores only ciphertext for a field, ordinary comparisons become more difficult.
Deterministic encryption can reveal patterns even when the underlying values remain encrypted. Fields with a small set of possible values, such as yes/no answers, are particularly susceptible to inference.
Randomized encryption conceals straightforward repetition better, but it complicates searching. Specialized queryable-encryption systems and secure enclaves can enable additional operations, though they do not provide unrestricted encrypted querying without trade-offs.
Database Encryption at Rest, in Transit, and in Use
A complete design considers each data state separately.
These controls are complementary. TLS does not encrypt database files, and TDE does not secure the network connection.
Client-side field encryption can keep selected values encrypted while they travel to and reside in the database. TLS still protects the connection more broadly, including information outside those selected fields.
What Database Encryption Does Not Protect Against
Encryption supports confidentiality, but it does not replace the rest of database security.
Compromised accounts and unsafe applications
An application allowed to retrieve plaintext may expose it if compromised. Encryption therefore needs authentication, least privilege, and access monitoring.
Storage encryption also does not fix SQL injection. If an injection attack reaches a query path that can return decrypted values, the information may still be exposed. Prepared statements, safe query construction, and restricted database permissions address that underlying vulnerability.
Deletion, disruption, and ransomware
An attacker does not need to decrypt information to delete it, corrupt it, or prevent access to it.
Encryption alone cannot provide availability. Backups, resilient services, tested restoration procedures, and continued access to necessary keys remain essential.
Plaintext copies outside the database
Logs, exports, caches, and downstream systems may contain readable copies of protected information. Enabling database encryption is not proof that every copy is encrypted.
The OWASP Database Security Cheat Sheet places encryption alongside access restrictions, secure configuration, and other database safeguards.
How to Evaluate a Database Encryption Design
Start with the threat you need to address. Protecting a stolen storage device is a different problem from preventing a database administrator from reading sensitive fields.
Then examine the design:
What is encrypted? Check files, selected values, logs, backups, snapshots, and exports.
Where does decryption happen? Identify whether plaintext appears in the database engine, application, or another component.
Who can use the keys? Review effective decryption permissions, not just key ownership.
Test rotation, revocation, and recovery procedures.
For Security+ study and practical security work, the central distinction is the same: encryption scope tells you what is transformed, while encryption placement tells you where plaintext and keys must be trusted.
Put Database Security Concepts Into Practice
Understanding TDE, client-side encryption, and key management builds a foundation. Guided practice can help you apply those concepts and identify gaps before working with real systems.
Pluralsight is an optional next step with guided security labs, feedback, assessments, and certification practice resources.
Affiliate link — I may earn a commission at no additional cost to you.
Jay's Recommendation
Turn understanding into hands-on confidence
You've built the foundations. Pluralsight adds opportunities to practice in guided security labs, get feedback, and check your knowledge with assessments and practice exams, so your next step is more than another video.
🛠Put concepts to workBuild practical skills with guided security labs and feedback.
🎯Find your weak spotsUse assessments to focus on what needs more work.
📝Check your understandingUse practice exams to guide your certification preparation.
🧭Give study sessions directionOrganize further learning with curated paths and progress tracking.