feat(02-02): implement pack, unpack, and inspect archive commands
- pack: two-pass algorithm reads/hashes/compresses/encrypts files then writes header+TOC+data - inspect: reads header and TOC, displays all metadata (sizes, offsets, IVs, HMACs, SHA-256) - unpack: HMAC-first verification, AES-256-CBC decryption, optional gzip decompression, SHA-256 check - CLI dispatch wired from main.rs to archive module - Directory traversal protection: rejects filenames starting with / or containing .. - Compression auto-detection: .apk/.zip/etc stored without gzip (flags=0x00 when no file compressed) - Round-trip verified: pack+unpack produces byte-identical files - HMAC tamper detection verified: flipped ciphertext byte triggers rejection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
19
src/main.rs
19
src/main.rs
@@ -17,27 +17,18 @@ fn main() -> anyhow::Result<()> {
|
||||
output,
|
||||
no_compress,
|
||||
} => {
|
||||
println!(
|
||||
"Pack: {} files -> {:?} (no_compress: {:?})",
|
||||
files.len(),
|
||||
output,
|
||||
no_compress
|
||||
);
|
||||
println!("Not implemented yet");
|
||||
Ok(())
|
||||
archive::pack(&files, &output, &no_compress)?;
|
||||
}
|
||||
Commands::Unpack {
|
||||
archive,
|
||||
output_dir,
|
||||
} => {
|
||||
println!("Unpack: {:?} -> {:?}", archive, output_dir);
|
||||
println!("Not implemented yet");
|
||||
Ok(())
|
||||
archive::unpack(&archive, &output_dir)?;
|
||||
}
|
||||
Commands::Inspect { archive } => {
|
||||
println!("Inspect: {:?}", archive);
|
||||
println!("Not implemented yet");
|
||||
Ok(())
|
||||
archive::inspect(&archive)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user