Archived Forum Post

Index of archived forum posts


Reliably detect AES encrypted zip files using CkZip

Nov 20 '13 at 08:31


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;

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?