Sample code for 30+ languages & platforms
Lianja

Verify a Zip's Password

See more Zip Examples

Demonstrates how to verify the password for an encrypted or password-protected zip archive.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

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

loZip = createobject("CkZip")

// To verify a password for a Zip, the Zip must be opened:
llSuccess = loZip.OpenZip("myProtected.zip")
if (llSuccess <> .T.) then
    ? loZip.LastErrorText
    release loZip
    return
endif

// Set the password to be verified:
loZip.DecryptPassword = "secret"

llPasswordOk = loZip.VerifyPassword()
if (llPasswordOk = .T.) then
    ? "Password is correct."
else
    ? "Password is incorrect."
endif

loZip.CloseZip()


release loZip