Rust
Rust
Verify a Zip's Password
See more Zip Examples
Demonstrates how to verify the password for an encrypted or password-protected zip archive.Chilkat Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let zip = chilkat::Zip::new();
// To verify a password for a Zip, the Zip must be opened:
if zip.open_zip("myProtected.zip").is_err() {
println!("{}", zip.last_error_text());
return;
}
// Set the password to be verified:
zip.set_decrypt_password("secret");
let password_ok = zip.verify_password();
if password_ok {
println!("Password is correct.");
} else {
println!("Password is incorrect.");
}
zip.close_zip();