Ionic Zip Library v1.9.1.6
Password Property
ReferenceIonic.ZipZipOutputStreamPassword
Sets the password to be used on the ZipOutputStream instance.
Declaration Syntax
C#Visual BasicVisual C++
public string Password { set; }
Public WriteOnly Property Password As String
	Set
public:
property String^ Password {
	void set (String^ value);
}
Remarks

When writing a zip archive, this password is applied to the entries, not to the zip archive itself. It applies to any ZipEntry subsequently written to the ZipOutputStream.

Using a password does not encrypt or protect the "directory" of the archive - the list of entries contained in the archive. If you set the Password property, the password actually applies to individual entries that are added to the archive, subsequent to the setting of this property. The list of filenames in the archive that is eventually created will appear in clear text, but the contents of the individual files are encrypted. This is how Zip encryption works.

If you set this property, and then add a set of entries to the archive via calls to PutNextEntry, then each entry is encrypted with that password. You may also want to change the password between adding different entries. If you set the password, add an entry, then set the password to null (Nothing in VB), and add another entry, the first entry is encrypted and the second is not.

When setting the Password, you may also want to explicitly set the Encryption property, to specify how to encrypt the entries added to the ZipFile. If you set the Password to a non-null value and do not set Encryption, then PKZip 2.0 ("Weak") encryption is used. This encryption is relatively weak but is very interoperable. If you set the password to a null value (Nothing in VB), Encryption is reset to None.

Special case: if you wrap a ZipOutputStream around a non-seekable stream, and use encryption, and emit an entry of zero bytes, the Close() or PutNextEntry() following the entry will throw an exception.

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.6 (1.9.1.6)