How to un-protect the zip files using Syncfusion.Compression.Base?

8 Dec 20231 minute to read

The following complete code snippet explains how to unprotect the zip file.

using Syncfusion.Compression.Zip;
using System.IO;

class Program
{
  static void Main(string[] args)
  {
    //Initailize ZipArchive
    ZipArchive zipArchive = new ZipArchive();

    //Load the zip file into ZipArchive
    zipArchive.Open(new FileStream("../../Data/Protected.zip", FileMode.Open), false, "password");

    //Unprotect the ZipArchive
    zipArchive.UnProtect();

    //Save the ZipArchive
    zipArchive.Save("WithOutPassword.zip");
  }
}
Imports Syncfusion.Compression.Zip
Imports System.IO

Module Module1
  Sub Main()
    'Initailize ZipArchive
    Dim zipArchive As ZipArchive = New ZipArchive

    'Load the zip file into ZipArchive
    zipArchive.Open(New FileStream("../../Data/Protected.zip", FileMode.Open), False, "password")

    'Unprotect the ZipArchive
    zipArchive.UnProtect()

    'Save the ZipArchive
    zipArchive.Save("WithOutPassword.zip")
  End Sub
End Module

See Also