Unlock ZIP password

Forgotten password

It is common to forget password “partly”, i. e. remember some characters of it while forgetting others. Aspose.ZIP API lets you play with such half-forgotten passwords to unlock the archive. This article shows guessing the decryption password of the AES-encrypted zip archive.

Identifying password template

Let’s say your password starts with “T0p$ecret” symbols followed by capital English letter and two digits. So, we can describe a template like this:

string template = "T0p$ecret{0}{1}";

where former placeholder is for capital english letter, latter is for two-digit number.

Verifying single password

This simple decryption code

 using (var a = new Archive("encrypted.zip", new ArchiveLoadOptions() {DecryptionPassword = password}))

raises an InvalidDataException if wrong password has been supplied.

Brute force attack on the archive

So compose and test passwords one by one. If there will be success program prints the proper password to the console.