Lesson 12 of 14 · 15m
KMS: Who Can Decrypt Is the Real Security Boundary
Envelope encryption means useToDecrypt turns storage reads into plaintext — split encrypt, decrypt, and admin across principals.
What the key actually protects
Cloud storage encryption is envelope encryption: your data is encrypted by a data encryption key; the DEK is wrapped by a key encryption key held in KMS. The service does the wrapping silently — GCS encrypts each object's DEK under the bucket's KEK, for instance. So the security question is never "is the bucket encrypted" — it always is — but "whose KEK, and who can unwrap."
On GCP, that permission is cloudkms.cryptoKeyVersions.useToDecrypt. Whoever holds it converts ciphertext access into plaintext. roles/storage.objectViewer plus useToDecrypt means encryption at rest is a formality. The role split exists for precisely this reason: roles/cloudkms.cryptoKeyEncrypter, cryptoKeyDecrypter, cryptoKeyEncrypterDecrypter, and cloudkms.admin are separate roles — the administrator manages keys but cannot encrypt or decrypt with them. The service writing backups gets encrypt; the restore path gets decrypt; the operator gets admin. Three principals, no overlap, and the composition nobody should hold.
Key rings and the destroy window
Keys live in key rings pinned to a location — a key cannot leave its ring or region, so plan rings per environment up front rather than retrofitting. Rotation (rotationPeriod) affects only new encryptions; old ciphertext still decrypts under old versions until the versions are destroyed. destroyScheduledDuration — 24 hours by default, configurable up to 120 days — is the window between "schedule destroy" and "cryptographically gone."
That window is a double-edged feature. Deliberate destruction is crypto-shredding: destroy the only versions holding a ciphertext and the data is unrecoverable by anyone, including you — the cleanest deletion-compliance mechanism in either cloud. Careless destruction of a version still wrapping live data is an outage you caused yourself. On data that matters, lengthen the window and rehearse the destroy path.
Three more tools in the box. Asymmetric keys serve asymmetricSign — workloads sign while the private half never leaves KMS. Key Access Justifications, paired with EKM, attach a stated reason to every decrypt you can approve or deny — visibility into why, not just who. And BYOK import jobs let you bring keys generated on your own HSM for the regulated cases where "the provider generated the key" is itself the objection.
CMEK, and what you're actually buying
Google-managed keys mean the provider's key hierarchy and the provider's IAM are your boundary — fine for most data. Customer-managed encryption keys move the boundary to your key ring's IAM and buy you the kill switch: revoke useToDecrypt or destroy the versions and every ciphertext under the key dies on your word, not the provider's. The costs are explicit — rotation discipline is now yours, region pinning constrains architecture, every dependent service must support CMEK, and external key management (EKM, hold-your-own-key) adds latency plus a dependency whose outage becomes your outage.
Azure's equivalents land in the same vault you already learned: Key Vault keys with Key Vault Crypto Officer (manage) versus Key Vault Crypto User (use), Managed HSM when you need FIPS 140-3 Level 3, and Customer Lockbox gating Microsoft's own support access to subscriptions.
The wrong model is "CMEK everywhere for compliance theater." CMEK buys control and revocability, not more encryption — the data was already encrypted. Pay the ops cost where a revoke or an audited destruction actually matters: regulated data, customer data, anything you'd need to kill on demand.
Land it
Split encrypt, decrypt, and admin across principals. Key ring per environment. Destroy windows sized to the data's real recovery needs. Monitor Decrypt and useToDecrypt calls in audit logs — decrypts are the money events. And rehearse restore under key revocation before the incident, not during it. Azure's per-key equivalent is az keyvault key rotation-policy — same discipline, different name.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
AWS Emulator Puts AWS on Your Laptop. Keep Your IAM Tests Off It.
AWS released AWS Emulator on November 11, a free local server that answers AWS API calls on 127.0.0.1 with per-run keys and fresh certificates.
Big Tech Plans to Work with the Public Sector for Cybersecurity
Both Microsoft, Inc. and Alphabet, Inc. will put a combined $30 billion dollars into cybersecurity over the next five years and work with the public sector on several initiatives to help improve cybersecurity.
Zero Trust Everything: The Complete Guide to Self-Hosting Teleport for Secure Infrastructure Access
SudoSecurity runs Teleport internally for everything — admin panel access, secure database connections, Kubernetes, and zero-trust philosophy across our entire team. This is the complete technical guide to installing, configuring, and running your own self-hosted Teleport cluster from scratch.
What is SSRF? Server-Side Request Forgery and the Attack That Breached Capital One
SSRF tricks your server into making requests to internal systems — cloud metadata services, internal APIs, AWS credentials endpoints. It turned a WAF misconfiguration into 100 million stolen Capital One records