Go
Go
Verify a Zip's Password
See more Zip Examples
Demonstrates how to verify the password for an encrypted or password-protected zip archive.Chilkat Go Downloads
success := false
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
zip := chilkat.NewZip()
// To verify a password for a Zip, the Zip must be opened:
success = zip.OpenZip("myProtected.zip")
if success != true {
fmt.Println(zip.LastErrorText())
zip.DisposeZip()
return
}
// Set the password to be verified:
zip.SetDecryptPassword("secret")
var passwordOk bool
passwordOk = zip.VerifyPassword()
if passwordOk == true {
fmt.Println("Password is correct.")
} else {
fmt.Println("Password is incorrect.")
}
zip.CloseZip()
zip.DisposeZip()