简体   繁体   English

使用DotNetZip C#解密受密码保护的压缩文件

[英]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.

相关问题 如何在C#中使用dotnetzip检查文件是否受密码保护以及用户传递的密码是否正确 - How to check if file is password protected & password passed by user is correct or not using dotnetzip in c# Excel 文件在使用 EPPLUS 生成多个 excel 文件并使用 DotNetZip 从 C# 中的 ActionResult 压缩后损坏 - Excel file is corrupted after generating multiple excel files using EPPLUS and Zipped using DotNetZip from an ActionResult in C# 如何使用C#验证文件是受密码保护的ZIP文件 - How to validate that a file is a password protected ZIP file, using C# 在C#中使用OLEDB读取受密码保护的Excel文件 - Read password protected excel file using OLEDB in C# 为什么Windows 7无法从使用DotNetZip创建的受密码保护的zip文件中提取文件? - Why can't Windows 7 extract files from my password protected zip-file created using DotNetZip? 如何将文件(使用FTP)上传到C#中受密码保护的文件夹? - How to upload a file (using FTP) to a password protected folder in C#? C#使用文件密码从受密码保护(加密)的Excel文件中删除密码 - C# Remove password from password protected(encrypted) excel file using the file password 使用C#将压缩文件上传到Dropbox - Upload zipped file to Dropbox using C# 如何使用C#和DotNetZip将zip文件添加到zip文件中 - How to add a zip file to zip file using C# and DotNetZip 如何在C#中创建受密码保护的文件 - How to make a password protected file in C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM