Sample code for 30+ languages & platforms
PureBasic

Open and Unzip an AES Encrypted Zip

See more Zip Examples

Open and unzip an AES encrypted Zip.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkZip.pb"

Procedure ChilkatExample()

    success.i = 0

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

    zip.i = CkZip::ckCreate()
    If zip.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success = CkZip::ckOpenZip(zip,"/myZips/aes.zip")
    If success <> 1
        Debug CkZip::ckLastErrorText(zip)
        CkZip::ckDispose(zip)
        ProcedureReturn
    EndIf

    ; Set the password needed to unzip.
    ; This password must match the password used when the zip
    ; was created.
    CkZip::setCkDecryptPassword(zip, "myPassword")

    unzipCount.i

    ; Unzip the .zip into /unzipDir.   
    ; Returns the number of files and directories unzipped.
    unzipCount = CkZip::ckUnzip(zip,"/unzipDir/")
    If unzipCount < 0
        Debug CkZip::ckLastErrorText(zip)
    Else
        Debug "Success!"
    EndIf



    CkZip::ckDispose(zip)


    ProcedureReturn
EndProcedure