1.4
3.3
In progress
Encryption Supporting Confidentiality
Summary
Data needs protection in three states: at rest, in transit and in use. Encryption protects confidentiality in each, and real systems combine symmetric and asymmetric encryption: a fast symmetric key encrypts the data, and an asymmetric key protects that symmetric key.
In plain words
Data can be at rest (stored), in transit (moving over a network) or in use (in memory). A common design encrypts the data with a fast symmetric key (the DEK), then protects that key with the user's asymmetric key pair (the KEK).
Detailed explanation
Data states
- Data at rest: Data stored on disks, databases, backups or removable media.
- Data in transit: Data moving across a network. Also called data in motion.
- Data in use: Data loaded in memory and being processed by an application.
Combining key types
- Bulk encryption: Encrypting large amounts of data, which is done with symmetric ciphers such as AES because they are fast.
- Data encryption key (DEK): The symmetric key that encrypts the data itself.
- Key encryption key (KEK): A key used only to encrypt and protect other keys, such as DEKs.
- Envelope encryption: Encrypting data with a DEK and then encrypting the DEK with a KEK, often held in a KMS or HSM.
Typical flow
- 1. Generate a DEK: A random symmetric key, for example AES-256.
- 2. Encrypt the data: Use the DEK.
- 3. Wrap the DEK: Encrypt it with the user's public key or a KEK.
- 4. Store together: Keep the wrapped DEK with the ciphertext; only the private key or KEK holder can unwrap it.
Important terms
taken from the text above- Data at rest
- Data stored on disks, databases, backups or removable media.
- Data in transit
- Data moving across a network. Also called data in motion.
- Data in use
- Data loaded in memory and being processed by an application.
- Bulk encryption
- Encrypting large amounts of data, which is done with symmetric ciphers such as AES because they are fast.
- Data encryption key (DEK)
- The symmetric key that encrypts the data itself.
- Key encryption key (KEK)
- A key used only to encrypt and protect other keys, such as DEKs.
- Envelope encryption
- Encrypting data with a DEK and then encrypting the DEK with a KEK, often held in a KMS or HSM.
Examples & real-world scenarios
- Data at rest: an encrypted database file.
- Data in transit: HTTPS traffic.
- Data in use: information loaded in RAM for processing.
Scenario
An encrypted file store uses AES-256 for the files (DEK). Each user's DEK access is wrapped with their key pair (KEK). Revoking a user means re-wrapping keys, not re-encrypting terabytes of files.
Common mistakes
- Believing there is a 512-bit AES. The largest AES key is 256 bits.
- Forgetting data in use. Encryption at rest and in transit doesn't protect data in memory.
Practical skills
- Name the data state and the matching protection in a scenario.
What I should remember
- Data at rest: Protected by disk, file and database encryption.
- Data in transit: Protected by TLS, IPsec and similar protocols.
- Data in use: The hardest state to protect; secure enclaves help.
- Envelope encryption: Data encrypted with a DEK, and the DEK encrypted with a KEK.