Crypto-shredding: deleting data by destroying its key
Encrypt data under a key you control, then destroy the key: the ciphertext left in replicas, backups and logs becomes unreadable once the key is gone, without a delete having to reach each copy.
What it is
Crypto-shredding, also called cryptographic erase, deletes data by deleting or overwriting the key that encrypts it. The encrypted bytes stay where they are; as long as the key isn't recovered later and the cipher isn't broken, the data is treated as gone. NIST's glossary, drawing on SP 800-88 Rev. 2, defines it as a purge sanitization technique in which key sanitization is applied to the keys protecting the encrypted target data, so that recovering the plaintext becomes infeasible. The attraction is what you don't have to do: you don't need to reach the data itself, an encrypted backup tape for instance, and far less material has to be destroyed, since the key is small.
The key you destroy need not be the one that touched the data. In envelope encryption, plaintext is encrypted with a data key and the data key is encrypted under another key, with a root key at the top kept in plaintext inside the key service. Once a wrapping key is deleted, a data key that exists nowhere except wrapped under it can no longer be unwrapped, so its ciphertext is out of reach too; a plaintext copy of that data key cached or stored elsewhere keeps working until it is gone. The design consequence, in our words: the grain of your keys is the grain of your deletion. One key per user lets you forget a user; one key per conversation or message lets you delete at that size; our advice: make the key store the place where deletion is decided, and log each key deletion there.
In a managed key service, "destroy" is a scheduled operation with two moments. In AWS KMS you schedule deletion with a waiting period of 7 to 30 days (30 by default, and the real wait may run up to 24 hours longer). During that window the key is in the Pending deletion state and is refused for cryptographic operations, so new requests to unwrap data keys with it fail, though a data key already decrypted and cached might keep working for a time; you can still cancel. When the window ends, the key material and metadata are erased, the step is documented as irreversible, and data encrypted under the key is no longer decryptable, with exceptions for multi-Region replica keys and for asymmetric or HMAC keys with imported material. Scheduling and the final deletion each leave a CloudTrail entry. Google Cloud KMS applies a similar schedule at the level of a key version, keeps the key name and version number, notes that destroyed material can remain in its systems for up to 45 days, and calls data whose key version was destroyed crypto-shredded: destruction is scheduled, the default window is 30 days and can be set per key, an organization policy can enforce a minimum, and a version can be restored until the window closes. Both services point to disabling a key as the safer first step, and the key-version procedure has you disable it and watch logs for failed uses before you schedule destruction.
The same move works inside an application, not just on a drive. A Confluent post on forgetting users in Kafka describes an approach, credited to Daniel Lebrero, in which each message is encrypted on arrival with a per-user key, the keys live in a compacted topic, and forgetting a user means deleting that user's key: the records stay in the log, intact but unintelligible. The post lists the upsides (one small key record per user, and the long-term log stays immutable) and the cost: encryption and decryption now sit on the critical path of producing and consuming.
When to use it
Reach for it when copies are many and finding them all is hard: a replicated store, nightly backups kept for weeks, an immutable log, object storage in a cloud where you don't hold the disk. Those are the settings where a delete call has to reach each copy, can fail or arrive late, and makes the result harder to prove. In a messaging design, a message that landed in a primary, two replicas, a backup and an analytics pipeline has one key; a key store that drops that key covers all five without a round trip to any of them, and the key store's own audit log is your evidence of when it happened.
For the erase to count, the data has to have been encrypted before it was stored: shredding a key does nothing for plaintext written earlier. The key also has to be out of everyone's reach. Shredding has no effect on a key that was already compromised, and a key loaded into memory can end up on disk when a machine hibernates, outside the place you thought it lived. Our advice for the room: name which key level you destroy and list who else might hold a copy, because that list is the whole argument that the data is gone.
When not to
It does nothing for plaintext that already left the ciphertext. A recipient's phone that decrypted and displayed a message, a cache holding the decrypted body, a search index or analytics table built from the plaintext, a log line with the field in clear: destroying the key leaves all of them readable, and each needs its own delete. The method requires that the data was encrypted, and it assumes the key isn't recovered later. A key that was compromised before the shred, copied into a backup of the key store, or written to disk from memory during hibernation is a key that can decrypt the data afterwards.
Skip it when the ciphertext itself must stay secret for decades: the bytes remain, and the method assumes the encryption stays unbroken, which is a lot to assume over that span. Skip it, too, when a retention rule applies; Google Cloud warns that destroying a key for data still under a retention period can put you in breach of a compliance requirement. And prefer a plain delete when you can reach each copy and read back the result: one table with no long-lived backups doesn't need a key hierarchy, and a compacted Kafka topic already removes a record when you write a null value for its key and compaction runs. Adding per-user keys puts encryption and decryption on the critical path and makes the key store a dependency you have to keep up.
Compared
| Approach | How a copy goes away | When it's the right choice | Main risk |
|---|---|---|---|
Delete the row or object | Each store removes its copy when asked | One store, or a few you can list and read back | Replicas, backups and logs keep copies; a failed call leaves one behind |
Tombstone and compaction | Write a null value for the key; compaction drops older records later | Compacted log topics where you know the record key | Data remains until compaction runs; copies in downstream sinks need the delete to propagate to them, which change data capture can do |
Overwrite or destroy the media | Blocks are rewritten, or the drive is physically destroyed | You hold the physical disk or tape and are retiring it | Needs physical access to each tape or drive, which cloud storage doesn't give you |
Crypto-shredding | Destroy the key; copies written as ciphertext become unreadable wherever they are | Many or unreachable copies: backups, logs, cloud storage | Plaintext copies and key copies survive; ciphertext stays exposed to future breaks; crypto on the hot path |
In a picture
Step 1 of 4
Encrypt on write
The service fetches the user's data key from the key service and writes ciphertext, so the stores receive encrypted bytes rather than plaintext.
How to say it in an interview
The common mistake
Quiz
Questions that use this
Related
- Event sourcing and ledgers
- Replication and read replicas
- Queues and logs
- Multi-tenant isolation
- Snapshots and log compaction
Sources
- NIST Computer Security Resource Center glossary: cryptographic erase
- Wikipedia: Crypto-shredding
- AWS Key Management Service Developer Guide: Delete an AWS KMS key
- AWS Key Management Service Developer Guide: AWS KMS cryptography essentials
- Google Cloud KMS documentation: Destroy and restore key versions
- Confluent blog: Handling GDPR with Apache Kafka: How does a log forget?