IRONSOFTWAREHOME
Access Protected ZIP
using IronZip;
using IronZip.Enum;

// Open protected ZIP
using (var archive = new IronZipArchive("existing.zip", "P@ssw0rd"))
{
    // Change to AES256-based encryption
    archive.Encrypt("P@ssw0rd", EncryptionMethods.AES256);
}
Imports IronZip
Imports IronZip.Enum

' Open protected ZIP
Using archive As New IronZipArchive("existing.zip", "P@ssw0rd")
    ' Change to AES256-based encryption
    archive.Encrypt("P@ssw0rd", EncryptionMethods.AES256)
End Using
NuGet Download
PM > Install-Package IronZip
Access Protected ZIP

Access Protected ZIP

ZIP archives offer a convenient way to compress multiple files for easy sharing over digital platforms. However, there are instances when a ZIP file containing sensitive information is accidentally sent to unintended recipients. Therefore, the capability to encrypt and decrypt files in compliance with industry standards is essential in any ZIP library.

IronZIP stands out by enabling users to decrypt protected ZIP files with just a few lines of code, and it also allows the encryption of existing ZIP archives using passwords and various encryption methods. This versatility makes it suitable for a wide range of situations.

Accessing Protected ZIP Archive

We first import the namespace IronZip. Afterward, we initialize a new IronZipArchive, and then we input two parameters, the first one being the path to the protected ZIP you're trying to access and the second being the password to access the protected ZIP. Do note that if the password or the path is incorrect, the operation will fail. Once the correct password is provided, the ZIP file can be decrypted, and its contents can be viewed, extracted, or modified.

Encrypting the Existing ZIP Archive

Aside from accessing the protected ZIP with the IronZipArchive class, IronZIP also allows you to encrypt the archive with a chosen encryption. To do this, we first import the IronZip.Enum, importing the enums will enable developers to select the encryption method used to encrypt the archive. Finally, we call the Encrypt method with two parameters passed in. The first one is the password that you wish to use to encrypt the ZIP Archive, while the second one is the EncrpytionMethods enum. Within this example, we will be using EncryptionMethods.AES256 to encrypt the file. After encrypting the file, you can confirm the operation by providing the password to access the protected ZIP again to verify. For a complete list of supported encryption methods and their related enums, please refer here.

Learn to Create, Read & Extract ZIP Files with IronZIP
View on GitHub

Ready to Get Started?

Nuget Downloads 23,187Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required