Sample code for 30+ languages & platforms
AutoIt

Verify a Zip's Password

See more Zip Examples

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

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

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

$oZip = ObjCreate("Chilkat.Zip")

; To verify a password for a Zip, the Zip must be opened:
$bSuccess = $oZip.OpenZip("myProtected.zip")
If ($bSuccess <> True) Then
    ConsoleWrite($oZip.LastErrorText & @CRLF)
    Exit
EndIf

; Set the password to be verified:
$oZip.DecryptPassword = "secret"

Local $bPasswordOk
$bPasswordOk = $oZip.VerifyPassword()
If ($bPasswordOk = True) Then
    ConsoleWrite("Password is correct." & @CRLF)
Else
    ConsoleWrite("Password is incorrect." & @CRLF)
EndIf

$oZip.CloseZip