2 Replies - 1391 Views - Last Post: 11 July 2019 - 08:44 AM

#1 fearfulsc2   User is offline

  • D.I.C Regular

Reputation: 16
  • View blog
  • Posts: 281
  • Joined: 25-May 16

Password Protect a Zip File

Posted 11 July 2019 - 08:36 AM

Good morning, I am trying to replace a library called Ionic.Utils.Zip.

The library allows me to add a password to the zip file like this

using (ZipFile zip = new ZipFile(zipFilePath))
{
  zip.Password = "password";
  zip.AddFile(OutputFilePath, string.Empty);
  zip.Save();
}



Are there any microsoft libraries that I can use that will effectively do the same thing or roughly do the same thing? I've been trying to search online but can't find anything.

Is This A Good Question/Topic? 0
  • +

Replies To: Password Protect a Zip File

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15357
  • View blog
  • Posts: 61,575
  • Joined: 12-June 08

Re: Password Protect a Zip File

Posted 11 July 2019 - 08:42 AM

Zip package exists.
https://docs.microso...etframework-4.8

dude here shows how to encrypt and compress
https://code.msdn.mi...p-File-3aa15f9d
https://code.msdn.mi...p-File-d62f00ed

Though pretty sure that route doesn't make the zip openable by a third party program like 7zip. Most likely the most easy route is a third party library.

https://github.com/i...iki/Zip-Samples
Was This Post Helpful? 0
  • +
  • -

#3 fearfulsc2   User is offline

  • D.I.C Regular

Reputation: 16
  • View blog
  • Posts: 281
  • Joined: 25-May 16

Re: Password Protect a Zip File

Posted 11 July 2019 - 08:44 AM

So I'll have to use encryption and decryption and such. I was able to use the System.IO.Compression library to work with zip files and such but nothing on being able to add a password.

Thank you! I wish I could use a third-party library, but work does not have any of them approved.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1