views:

774

answers:

4

I'm trying to find an zip compression and encryption component with encryption suitable for use by the US Federal Government, so I can't use Zip 2.0 encryption, it has to be AES or the like. I've already found SharpZipLib (can't do AES encyrption), and Chilkat (can do AES encryption, but costs money). Am I missing any other options?

+6  A: 

If money is a big issue, you could take an open source library like this http://www.codeplex.com/DotNetZip, which now has AES support

Matt Briggs
Update: AES is now supported in DotNetZip. http://DotNetZip.codeplex.com/
Cheeso
edited to take update into account
Matt Briggs
+6  A: 

What about 7-Zip? It's open source under the LGPL (so should be usable in your project) and according to the spec it supports ZIP with AES encryption.

MadKeithV
I like 7-zip, but it requires either launching a process (to run it from command line) or COM/unmanaged code interop.
MatthewMartin
Actually, they have the LZMA SDK which now has C# code to use it as well: http://www.7-zip.org/sdk.html
MadKeithV
A: 

Check out this awesome article on the Stream Pipeline. It not only defines a cool way to link streams to each other in a multithreaded fashion, the example used is compression followed by encryption.

Jesse C. Slicer
+3  A: 

How much would you be willing to pay for AES in DotNetZip? ;)

DotNetZip supports AES Encryption, with 128 or 256-bit keys.

http://www.codeplex.com/DotNetZip

Example code:

  using (ZipFile zip = new ZipFile())
  {
    zip.AddFile("ReadMe.txt"); // no password for this entry

    // use a password for subsequent entries
    zip.Password= "This.Encryption.is.FIPS.197.Compliant!";
    zip.Encryption= EncryptionAlgorithm.WinZipAes256;
    zip.AddFile("Rawdata-2008-12-18.csv");
    zip.Save("Backup-AES-Encrypted.zip");
  }

The AES-encrypted zip files produced by DotNetZip can be read and extracted by WinZip, and vice-versa.

You can also just create regular zip files without encryption.

oh, and it's free.

Cheeso
Does any of you have a way to see what method was used to encrypt an archive? If I open a generated archive with WinZip I see that it is indeed encrypted, but I have no way on telling with what algorithm (Zip2.0, AES128, AES256, etc.).
WowtaH
DotNetZip will tell you with the ZipFile.Encryption property on a zip file you have read. I don't know how to do it with WinZip.
Cheeso