Sets the password to be used on the ZipInputStream instance.


When reading a zip archive, this password is used to read and decrypt the entries that are encrypted within the zip file. When entries within a zip file use different passwords, set the appropriate password for the entry before the first call to Read() for each entry.
When reading an entry that is not encrypted, the value of this property is ignored.

This example uses the ZipInputStream to read and extract entries from a
zip file, using a potentially different password for each entry.
CopyC#

byte[] buffer= new byte[2048]; int n; using (var raw = File.Open(_inputFileName, FileMode.Open, FileAccess.Read )) { using (var input= new ZipInputStream(raw)) { ZipEntry e; while (( e = input.GetNextEntry()) != null) { input.Password = PasswordForEntry(e.FileName); if (e.IsDirectory) continue; string outputPath = Path.Combine(_extractDir, e.FileName); using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite)) { while ((n= input.Read(buffer,0,buffer.Length)) > 0) { output.Write(buffer,0,n); } } } } }