Vault Health & Salvage Engine
Hard drive sector degradation, flash memory bit-rot, and interrupted network transfers can damage parts of a multi-gigabyte file. In monolithic encrypted archives (like classic PGP or encrypted 7z), a single corrupted bit often ruins the entire file forever. ZevSafe's Vault Health & Salvage Engine isolates damage to individual 4 MB chunks and rescues all intact files with forensic certainty.
Checking Health & Rescuing Corrupted Vaults
Run Cryptographic Health Check
In the Vault Explorer, click "Vault Health". ZevSafe immediately verifies the container header, manifest signatures, key derivation strength, and overall cryptographic integrity, rendering an intuitive 0–100% Scorecard.
Trigger Deep AEAD Scan
Click "Verify All Chunks (Deep Scan)". ZevSafe reads through the entire vault in the background, testing every 4 MB cryptographic block. A live visual map highlights healthy chunks in green and flags any damaged blocks in red.
Salvage Surviving Files
If damage is detected, click "Emergency Salvage". ZevSafe extracts every file stored in healthy chunks and packs them into a clean ZIP archive, accompanied by a detailed report explaining which files survived.
The Diagnostic Scorecard Engine
The health diagnostic framework runs a deterministic 5-point verification suite:
| Diagnostic Phase | Target Fields | Pass Criteria |
|---|---|---|
| 1. Magic & Version | Header bytes 0..4 |
Magic strictly ZV3\0; Version 0x03. |
| 2. Chunk Framing | Header bytes 6..9 |
Chunk size matches 0x00400000 (4 MB). |
| 3. PBKDF2 Work Factor | Iterations parameter | Iteration count ≥ 600,000 rounds (OWASP 2026+ tier). |
| 4. Manifest Authenticity | Tail trailer AES-GCM tag | 16-byte authentication tag matches with 0 bit errors. |
| 5. File Checksum Consistency | Catalog CRC32 hashes | Plaintext file CRC32 digests match manifest indices. |
STREAM AEAD Deep Bit-Rot Scanning
The deep scan function verifyAllVaultChunks() executes without expanding plaintext payloads to RAM, verifying only the GCM tag for each chunk:
// js/stream-crypto.js: Lightweight chunk integrity scan
async function verifyChunkIntegrity(cryptoKey, baseIv, chunkIndex, isLast, ciphertextWithTag) {
const iv = buildChunkIV(baseIv, chunkIndex, isLast);
const aad = buildChunkAAD(chunkIndex, isLast);
try {
// SubtleCrypto.decrypt returns ArrayBuffer if tag is valid; throws on bit-rot
await crypto.subtle.decrypt(
{ name: "AES-GCM", iv, additionalData: aad, tagLength: 128 },
cryptoKey,
ciphertextWithTag
);
return { status: 'OK', chunkIndex };
} catch (err) {
return { status: 'CORRUPTED', chunkIndex, error: err.message };
}
}
Fault-Tolerant Partial Salvage Pipeline
When salvageVault() is invoked, the engine establishes an error-tolerant extraction loop:
- Chunk Isolation: If chunk $k$ fails authentication, chunk $k$ is quarantined. The pipeline logs the failure and advances to chunk $k+1$.
- File Span Mapping: The engine queries the manifest for files whose byte ranges span exclusively healthy chunks.
- Clean Export: All intact files are decompressed and written to an emergency rescue archive.
- Forensic Audit Trail: A companion text file
salvage-report.txtdocuments exact corrupted byte offsets, affected filenames, and recovery percentages.
Security Invariants
| Invariant | Guarantee | Status |
|---|---|---|
| Cryptographic Truth | Corrupted chunks cannot be forged or guessed; authentication failure is absolute. | VERIFIED |
| Quarantine Boundary | Damaged blocks are never written to disk or mixed with valid files. | VERIFIED |
| Memory Isolation | Failed decryption attempts zeroize intermediate buffers immediately. | VERIFIED |