Hi James
I am old enough to have used PKZip and I would have thought that Winzip and PKZip formats are sufficiently compatible. I don't hear much from PKZip these days but Phil Katz did a good job of setting an open standard.
These are the comments from the Version property in SharpZip. It certainly supports PkzipClassic encryption.
Minimum features are defined as:
1.0 - Default value
1.1 - File is a volume label
2.0 - File is a folder/directory
2.0 - File is compressed using Deflate compression
2.0 - File is encrypted using traditional encryption
2.1 - File is compressed using Deflate64
2.5 - File is compressed using PKWARE DCL Implode
2.7 - File is a patch data set
4.5 - File uses Zip64 format extensions
4.6 - File is compressed using BZIP2 compression
5.0 - File is encrypted using DES
5.0 - File is encrypted using 3DES
5.0 - File is encrypted using original RC2 encryption
5.0 - File is encrypted using RC4 encryption
5.1 - File is encrypted using AES encryption
5.1 - File is encrypted using corrected RC2 encryption
5.1 - File is encrypted using corrected RC2-64 encryption
6.1 - File is encrypted using non-OAEP key wrapping
6.2 - Central directory encryption (not confirmed yet)
6.3 - File is compressed using LZMA
6.3 - File is compressed using PPMD+
6.3 - File is encrypted using Blowfish
6.3 - File is encrypted using Twofish
To get you going here is some basic code to extract to the c:\temp folder, you may need to adjust that line.
private void DoExtract(string sArchive) {
ZipFile zf = null;
try {
zf = new ZipFile(File.OpenRead(sArchive));
zf.Password = "whatever"; // if needed
foreach (ZipEntry theEntry in zf) {
String entryFileName = Path.GetFileName(theEntry.Name);
byte[ buffer = new byte[4096];
Stream zipStream = zf.GetInputStream(theEntry);
String fullZipToPath = Path.Combine(@"c:\temp\", entryFileName);
// unzip file in buffered chunks
// the "using" will close the stream even if an exception occurs
using (FileStream streamWriter = File.Create(fullZipToPath)) {
StreamUtils.Copy(zipStream, streamWriter, buffer);
}
}
}
catch (Exception ex) {
throw new Exception(ex.Message + " (extracting from zipfile " + Path.GetFileName(sArchive) + ")");
} finally {
if (zf != null) {
zf.IsStreamOwner = true; // Makes close also shut the underlying stream
zf.Close(); // Ensure we release resources
}
}
}
Regards
David