[英]Why can't Windows 7 extract files from my password protected zip-file created using DotNetZip?
I'm creating a password protected zip-file using DotNetZip . 我正在使用DotNetZip创建一个受密码保护的zip文件。 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. " 这是因为Windows,尤其是Windows资源管理器无法处理AES级加密,并且要求将加密级别设置为PkzipWeak,该文档记录为“ 传统或经典pkzip加密”。
zipFile.Encryption = EncryptionAlgorithm.PkzipWeak;
According to the documentation on the EncryptionAlgorithm enumeration: 根据EncryptionAlgorithm枚举的文档:
[...] 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; [...]如果您使用WinZipAes256生成zip存档,您将能够在Windows XP和Vista上的Windows资源管理器中打开它,但您将无法提取条目; 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. 注意:流行的第三方存档实用程序(如WinZip或7-Zip)可以很好地处理AES加密。 It's Windows Explorer that's the weak card in the deck. Windows资源管理器是甲板上的弱卡。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.