Encryption and MemoryStream

Aug 13, 2009 at 11:48 PM

I'm trying to create Encrypted in Memory ZIP which can be attached to E-mail, but it seems to be not working properly for me. Please let me know what's wrong with my code.  Setting Encryption and Password at ZipFile dosen’t work either.

MemoryStream mstrm = new MemoryStream();
using(ZipFile zip = new ZipFile())
{
ZipEntry entry = zip.AddEntry("test.txt", "", "HelloWorld");
entry.Password = "hello";
entry.Encryption = EncryptionAlgorithm.WinZipAes256;
zip.Save(mstrm);
}
File.WriteAllBytes("test.zip",mstrm.ToArray()); 

It saves fine and can be opened using WinZip but when try to extract file it fails with invalid password.

Coordinator
Aug 13, 2009 at 11:50 PM

what you are trying to do, should work. what version of the library are you using?

Aug 13, 2009 at 11:55 PM

I'm using latest stable release '1.8.4.17'.

Coordinator
Aug 14, 2009 at 12:18 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Aug 14, 2009 at 4:13 AM

Thanks for reporting the problem.  I believe this is fixed in v1.8.4.18, which you can download now.

 

Aug 14, 2009 at 6:22 AM

Downloaded latest version and it’s working like champ. Thanks for quick response.