Cloud security Cloud key management 4 min read
How does cloud KMS encryption work?
An encrypted database backup is copied to another account. What does the KMS key permission decide when someone tries to restore it?
-
A data key encrypts the bytes
For large data, a service commonly generates a data encryption key (DEK) and uses it to encrypt the content. It then asks the key management service to encrypt the DEK under a managed key and stores the encrypted DEK with the ciphertext.
In short The data key encrypts data; the managed key wraps the data key.
-
Decrypt permission controls the unwrap step
To read the data, the service must use the managed key to decrypt the encrypted DEK, then use the DEK to decrypt the stored bytes. A principal may be allowed to read the backup but still lack permission to use its KMS key.
In short Data access and key access both matter for a restore.
-
Key policy is part of the access boundary
In AWS KMS, the key policy helps define who can use or administer the key, alongside applicable IAM policies and grants. Limit decrypt access, separate key administration from routine data access, and monitor key use.
In short A broad decrypt grant can make encrypted data readable.
What encryption at rest doesn’t guarantee
Encryption at rest does not stop an authorized application or identity from reading plaintext. It also does not protect data after it is decrypted in memory or copied elsewhere.
Key rotation is not the same as re-encrypting every existing object. Understand the provider and service behavior for existing ciphertext.
Keep this
Encryption protects stored bytes; key policy determines who can unlock them.
Know which key protects the data, who can call decrypt, and how the application receives plaintext. Encryption at rest does not help if an overpowered identity can decrypt everything.- Data key
- Encrypts the application data.
- KMS key
- Protects the data key and controls cryptographic use.
- Access
- Both the data service and key policy must permit the operation.