Zip encryption with password with special chars not working

0 votes
asked Oct 29, 2014 by Wompi (160 points)
edited Nov 3, 2014

Hi,

we created a zip archive with aes256 encryption and a password with special chars like €,ü,ö etc. It creates the zip correctly but if you then want to unzip the file with winrar or winzip it always says wrong password.
Seems like a encoding issue.


Is there any workaround.


Here is the source code in c#


 using (ZipArchive zip = new ZipArchive(ZipFileToCreate, ArchiveOpenMode.Create))
{
// set the Password first
zip.Password = "tüst";
//zip.Password = "€urope";
// optionally change the default Encryption algorithm
zip.EncryptionAlgorithm =EncryptionAlgorithm.Aes256; // now add files zip.Add(FileToZip); }

Applies to: Rebex ZIP

2 Answers

0 votes
answered Oct 29, 2014 by Pavel Matyska (13,440 points)
edited Nov 3, 2014

Hi,

AES-256 encryption is implemented according to WinZip encryption specification, which uses RFC2898 to generate key from password. Unfortunately, WinZip does not specify an encoding to use. As suggested in RFC2898 we use UTF-8 encoding.

It seems that WinZip chose to use windows-1252 encoding. Unfortunately, there is no workaround for this issue.

Would you like to send fixed trial version? Or if you have bought Rebex ZIP, you can send us order details and we can send you full version with the fix.

commented Oct 30, 2014 by Wompi (160 points)
edited Nov 3, 2014

Hi,

thank you for your answer. Yes if it is possible to send me a fixed trial version, this would be great. So I can evaluate further.

Thank you very much. Best regards, Mark

commented Oct 31, 2014 by Lukas Matyska (57,550 points)
edited Oct 31, 2014

You can download current BETA TRIAL version here.

Alternatively, download only binaries (without installer) here.

New version uses encoding Windows-1252 by default now. You can set custom encoding by ZipArchive.Options.PasswordEncoding. If a password cannot be encoded using given encoding an exception is thrown.

commented Nov 23, 2019 by -prh (140 points)
Hi,

I have the same problem.
What is the correct syntax for "ZipArchive.Options.PasswordEncoding"? How values are possible?

Thanks...

Peter
commented Nov 25, 2019 by Lukas Pokorny (115,370 points)
0 votes
answered Nov 3, 2014 by Wompi (160 points)
edited Nov 3, 2014

Hi,

thank you very much. It is working perfectly. If we buy the library, we then just have to replace the demo key with the new given key, or?

Thank you Best regards

commented Nov 3, 2014 by Tomas Knopp (58,890 points)
edited Nov 3, 2014

Hello,

when you buy the library there is no full version key. Simply discard the trial key setter line from your program and change the references from the trial ones to the new full version dlls you obtain from Rebex and that's it.

As the beta has not been released officially yet, so once you buy the Rebex ZIP for .NET, please write us from your registered email to support@rebex.net and we will send the full version of the beta back to you.

...