Sample code for 30+ languages & platforms
VB.NET

Verify a Zip's Password

See more Zip Examples

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

Chilkat VB.NET Downloads

VB.NET
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 New Chilkat.Zip

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


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

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


zip.CloseZip()