Sample code for 30+ languages & platforms
B4X

Verify a Zip's Password

See more Zip Examples

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

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

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

Dim zip As ChilkatZip
zip.Initialize("zip")

'  To verify a password for a Zip, the Zip must be opened:
success = zip.OpenZip("myProtected.zip")
If success <> True Then
    Log(zip.LastErrorText)
    Return
End If


'  Set the password to be verified:
zip.DecryptPassword = "secret"

Dim passwordOk As Boolean
passwordOk = zip.VerifyPassword
If passwordOk = True Then
    Log("Password is correct.")
Else
    Log("Password is incorrect.")
End If


zip.CloseZip