"The password did not match" Error

Oct 23, 2010 at 6:23 PM
Edited Oct 23, 2010 at 6:25 PM


I´m trying to extract a file that the password is "RAPHAEL" (in upper case).

When I tried to extract it return the error "The Password did not match", but the password is correct.

Is there anything I can do?

Here is the part of code:


                    string passwd = @"RAPHAEL";

                    ZipFile zip = new ZipFile(fileWithPath);

                    foreach (ZipEntry a in zip)
                        a.ExtractWithPassword("C:\\TESTE", passwd);


Oct 23, 2010 at 9:45 PM

How many entries are in the zip file? 

Is it possible that at least one of the entries is NOT protected by a password, or has a password that is not RAPHAEL ?  If either of those is true, then you could get the exception you described.

In a zip file, each entry can be protected with a different password, or no password.  That's why, when programming defensively, you should test the ZipEntry.UsesEncryption property, before calling ZipEntry.ExtractWithPassword.

Also - how do you know the password is correct?  Have you tried to unzip using a different tool (say, WinZip) that accepted and confirmed the password you are using?

If these suggestions don't solve your problem, then I suggest you dump the information on the zipfile in question, using the unzip.exe command-line utility with the -i option.  You can also read the ZipFile.Info property from within a program, to get the same information.


Oct 25, 2010 at 1:14 AM
Edited Oct 25, 2010 at 1:14 AM


I've made this file to test the application. There is just one file .txt and when I tried to unzip it with Winzip or Winrar, the password is correct.


In the examples section, there is one that uses just "a.Extract" and sets the password at the propertie a.Password, but when I tried to use it, it showed me the following message "This entry requires a password.", that is, "a.Password" have been ignored.