Archived Forum Post

Index of archived forum posts

Question:

Reliably detect AES encrypted zip files using CkZip

Nov 20 '13 at 08:31

Hello,

I’m trying to find a way (using CkZip and/or CkZipEntry) to detect if a given zip file is aes encrypted and if I have the correct password.

If was hoping I could do something like;

CkZip zip;
zip.OpenZip(“/path/to/zip”);
zip.setPassword(“mysecretpassword”);

if (zip.get_Encryption() == 4 && zip.VerifyPassword()) {
 // encrypted zip validated….
} else {
 // not encrypted or wrong pw
}

However the get___Encryption() method only seems to return 4 for specific implementations of aes zip. In my scenario, the .zip file comes from 7zip using AES-256 encryption. It decrypts just perfectly with CkZip, but get_Encryption() returns 0 nevertheless.

VerifyPassword() by itself returns true for non-encrypted zips also, so it’s only useful once you know the file is encrypted.

Another possibility is the CkZipEntry get_Crc() method which returns zero for aes encrypted entries, but that could happen by chance also (for example if the file is empty).

Any suggestions?

Sune