Sample code for 30+ languages & platforms
Rust

Open and Unzip an AES Encrypted Zip

See more Zip Examples

Open and unzip an AES encrypted Zip.

Chilkat Rust Downloads

Rust

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

let zip = chilkat::Zip::new();

if zip.open_zip("/myZips/aes.zip").is_err() {
    println!("{}", zip.last_error_text());
    return;
}

// Set the password needed to unzip.
// This password must match the password used when the zip
// was created.
zip.set_decrypt_password("myPassword");

// Unzip the .zip into /unzipDir.   
// Returns the number of files and directories unzipped.
let unzip_count = zip.unzip("/unzipDir/");
if unzip_count < 0 {
    println!("{}", zip.last_error_text());
} else {
    println!("Success!");
}