Le Ngoc Loan
Le Ngoc Loan

Reputation: 306

create file zip have password in sharpcompress(winrt)

i want create file zip have password in window store app( winrt).

i used sharpcompress https://sharpcompress.codeplex.com/ but not create file zip have password.

can you help me?

Upvotes: 4

Views: 2099

Answers (2)

Sean Kearon
Sean Kearon

Reputation: 11427

As of December 2021, there is no support to create password-protected archives using SharpCompress. But, there is some discussion about that in issue #61.

Upvotes: 0

Le Ngoc Loan
Le Ngoc Loan

Reputation: 306

Disclaimer:
Here is a solution using Dotnetzip for window 8.1., not SharpCompress as used by the question author.


https://www.nuget.org/packages/DotNetZipforWindows8.1/

it support write and read file zip have password

 using Ionic.Zip;
    void  WriteFile()
    {
        string s = Windows.Storage.ApplicationData.Current.TemporaryFolder.Path;
        System.Diagnostics.Debug.WriteLine(s);
        using (ZipFile zip = new ZipFile())
        {
            zip.Password = "123456!";
            zip.Encryption = EncryptionAlgorithm.PkzipWeak;
            zip.AddFile(s + "\\SaveXML.xml", "");
            zip.AddFile(s + "\\Advanced_Windows_Store_App_Development_Using_C#_Exam_Ref_70-485.pdf", "");
         


             zip.Save(s + "\\MyZipFile123.zip");
        }
    }

Upvotes: 1

Related Questions