I'm creating a password protected zip-file using DotNetZip. When I try to extract the files I'm met with an "unspecified error". Why is that?
using (var zipFile = new ZipFile())
{
zipFile.Encryption = EncryptionAlgorithm.WinZipAes256;
zipFile.Password = "pangolin";
foreach(var file in someFileCollection)
{
zipFile.AddEntry(file.Name, file.Stream);
}
zipFile.Save(aPathOnDisk);
}
This is because Windows and more specifically Windows Explorer can't handle AES-level encryption and requires the encryption level to be set to PkzipWeak which is documented as "Traditional or Classic pkzip encryption."
zipFile.Encryption = EncryptionAlgorithm.PkzipWeak;
According to the documentation on the EncryptionAlgorithm enumeration:
[...] if you produce a zip archive using WinZipAes256, you will be able to open it in Windows Explorer on Windows XP and Vista, but you will not be able to extract entries; trying this will lead to an "unspecified error".
Note: popular third-party archive-utilities such as WinZip or 7-Zip can handle AES-encryption just fine. It's Windows Explorer that's the weak card in the deck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With