|
Post by HS on Jul 3, 2005 10:03:28 GMT -5
I seem to have encountered a password protected zip file that doesn't fire the OnBadPassword event when I supply a specific invalid password! (other non-invalid passwords are detected though)
Digging through kpUnzipp.pas line 654, it seems...
CRCHighByte <> DecryptCRCByte
...compares equal values in this particular case, IOW perhaps the hash algorithm isn't guaranteed to be unique.
Any thoughts?
|
|
|
Post by Kevin on Jul 5, 2005 9:07:23 GMT -5
The hash alogorithm is definitely not gurarteed to be unique, the key that is hashed from an entered bad password will often match the stored key. However, only one password/key should successfully extract the file, which is why the OnBadPassword event is only called after extracting the file. In that case, it should find that the CRC of the resulting file and the stored CRC do not match.
Did the file in your case actaully unzip? And if so, was it corrupted?
Kevin
|
|
|
Post by HS on Jul 10, 2005 13:28:18 GMT -5
The file itself is fine - when I supply the correct password it unzips without any problems.
However, like I mentioned if I try a specific invalid password the event doesn't fire, and I get a weird file access error instead.
According to you, I should be getting a "bad CRC" instead since it technically wouldn't know 100% if the password was incorrect - right? This doesn't seem to happen though, but I'll recheck my code...
Background: In my particular application I'm supplied a series of "random" passwords over time for a set of regular arriving zip files from a client. I accumulate these passwords, however, I don't keep a record of the password attached to any particular file, rather I simply cycle through the password pool until I find one that "works" on the file...
|
|
|
Post by Kevin on Jul 11, 2005 9:38:22 GMT -5
You shouldn't get an OnBadCRC event fired for a password protected file, it is just that by comparing the CRC after extracting is how it is determined if the password was correct, and, it should fire an OnBadPassword error. The error you are getting must be happening before it is done extracting though.
Is it ONE particular password that causes this every time you try to use it on any archive?
Kevin
|
|
|
Post by HS on Jul 13, 2005 8:55:01 GMT -5
No, it seems to be this particular combination of password and file.
Nevermind, I've worked around the problem...
|
|
|
Post by Kevin on Aug 23, 2005 15:55:01 GMT -5
Would your workaround possibly be helpful in figuring out what is causing the problem?
Thanks,
Kevin
|
|