Sample code for 30+ languages & platforms
Java

Open and Unzip an AES Encrypted Zip

See more Zip Examples

Open and unzip an AES encrypted Zip.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Zip;

public class ChilkatExample {

    public static void main(String[] args) {
        // This example requires the Chilkat API to have been previously unlocked.
        // See Global Unlock Sample for sample code.

        Zip zip = new Zip();

        try {
            zip.openZip("/myZips/aes.zip");
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

        // Set the password needed to unzip.
        // This password must match the password used when the zip
        // was created.
        zip.setDecryptPassword("myPassword");

        // Unzip the .zip into /unzipDir.
        // Returns the number of files and directories unzipped.
        int unzipCount = zip.unzip("/unzipDir/");
        if (unzipCount < 0) {
            System.out.println(zip.getLastErrorText());
        } else {
            System.out.println("Success!");
        }
    }
}