P17 — Envelope Encryption + Crypto-Shredding of Weights
Status
green· Claim PC15 · Corpus anchor matrix MM-E3; ch.7 decommissioning row · Effort S · Execution host external: omarchy
What it proves
Weights can be encrypted so that retiring them means destroying one small key, not scrubbing disks. You will encrypt a stand-in checkpoint with a random data key (DEK), wrap that key with a master key (KEK), then destroy the KEK and watch every wrong key fail the cryptographic check — the stored blob is inert. That is crypto-shredding: retirement proven by authentication failure, not by trusting a delete call.
Why it matters
Two corpus claims meet here. Encryption at rest is filed as commodity and user-runnable (matrix MM-E3), and ch.7’s decommissioning row demands that “retired bundles stop being recoverable”, with “key destruction records” as the evidence. If the envelope pattern were exotic or the shred unprovable, the textbook’s cheapest weight-protection advice would rest on faith.
Why this, not that
| We do (Y) | We don’t (X) | Because |
|---|---|---|
| One-host DEK/KEK with AES-256-GCM | Rent a cloud KMS | The claim is that the pattern is commodity; a local KEK proves the crypto with no account, and a KMS is the same primitive with an API and an audit log |
| Prove irrecoverability at the wrap layer | Delete files and call it shredding | SSD wear-leveling makes physical erasure unprovable from userspace; the crypto-shred guarantee survives that caveat — no KEK, no plaintext, whatever the flash retains |
What you need
- Python 3.9+ and
pip install -r requirements.txt(cryptography). Runs anywhere.
How to run it
pip3 install -r requirements.txt— installs the one dependency.python3 scripts/envelope_crypto_shred.py— encrypts, unwraps, shreds, and prints both gates.
What “done” looks like
python3 scripts/envelope_crypto_shred.py
# MUST print:
# POC-P17-OK-ENVELOPE-ROUNDTRIP: KEK unwrap + AES-256-GCM decrypt reproduced the weights
# POC-P17-OK-SHRED-IRRECOVERABLE: KEK destroyed; wrapped DEK fails authentication for wrong keys; ciphertext inertWhere the evidence goes
evidence/run.log— full output; both gate lines.
What this does not prove
- This proves the cryptographic property. Physical key destruction inside tamper-responsive hardware (matrix MM-E12, FIPS 140-3 zeroization) is a different, hardware-backed claim and is out of scope.
- Wrong-key failure surfacing as
InvalidTagis the mechanism, not a bug: GCM is authenticated encryption, so “cannot open” is a verifiable event.