[英]Decrypting a Password Protected Zipped File using DotNetZip C#
I m trying to extract a zipped file through DotNetZip
. 我正在尝试通过
DotNetZip
提取压缩文件。 The file is encrypted
with a password and needs to be either reset or removed. 该文件已使用密码
encrypted
,需要重置或删除。 I used ExtractAll
method but received exception: 我使用了
ExtractAll
方法,但收到异常:
BadPasswordException was unhandled, the password didnot match.
BadPasswordException未处理,密码不匹配。
My code is below: 我的代码如下:
using (Ionic.Zip.ZipFile zip = Ionic.Zip.ZipFile.Read(source_file))
{
zip.Password = "1234";
zip.ExtractAll(dest_path, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently);
}
Any help will be appreciated. 任何帮助将不胜感激。
According to the documentation use 根据资料用途
using (ZipFile zip = ZipFile.Read(ExistingZipFile))
{
ZipEntry e = zip["TaxInformation-2008.xls"];
e.ExtractWithPassword(BaseDirectory, Password);
}
http://dotnetzip.herobo.com/DNZHelp/Index.html http://dotnetzip.herobo.com/DNZHelp/Index.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.