How to decompress password protected ZIP file

0 votes
asked Oct 12, 2010 by Rebex KB (7,140 points)
edited Oct 12, 2010

How do I decompress a ZIP archive which is protected by a password using Rebex ZIP?

2 Answers

0 votes
answered Oct 12, 2010 by Rebex KB (7,140 points)
edited Oct 12, 2010
 
Best answer

Following code shows how to do it in C#:

// open a ZIP archive 
using (ZipArchive zip = new ZipArchive(@"C:\archive.zip", ArchiveOpenMode.Open))
{
    // set the Password first 
    zip.Password = "PASSword#123";

    // extract whole ZIP content 
    zip.ExtractAll(@"C:\Data");
}
0 votes
answered Oct 12, 2010 by Rebex KB (7,140 points)
edited Oct 12, 2010

Following code shows how to do it in VB.NET

' open a ZIP archive 
Using zip As New ZipArchive("C:\archive.zip", ArchiveOpenMode.Open)
    ' set the Password first 
    zip.Password = "PASSword#123"

    ' extract whole ZIP content 
    zip.ExtractAll("C:\Data")
End Using 
...