Objective-Zip icon indicating copy to clipboard operation
Objective-Zip copied to clipboard

Moving password-protected zips between 64 & 32 bit platforms

Open dpr11 opened this issue 10 years ago • 11 comments

Hi

Love this library, but I’m having problems with password-protected zip files. I can create them and open them fine when building as a 64 bit Mac app. However when trying to open them in the 32 bit iOS simulator I have problems. The zip opens fine, but the password-protected file cannot be extracted and it gives an error:

Error reading ‘file’ in the zipfile

The zip that is created on the 64 bit Mac app also has the same problems when attempting to be opened by 7-zip on Windows:

Data error in encrypted file ‘file’. Wrong password?

There are no problems if I don’t password-protect the zip and in this case they can be passed between 64 bit and 32 bit iOS and Mac systems and also Windows. Although, curiously, I cannot double-click and extract the zips in the Finder - I get a .cpgz file created instead.

There were many compiler warnings about loss of precision from longs to ints when using XCode 5.1. I can silence the compiler with casts in the code, but the issues above remain whether I add the casts or leave the code as it is.

I am using XCode 5.1 on OS X 10.9.2 and version 0.8.3 of Objective-Zip.

Hope you can help Thanks

dpr11 avatar Apr 04 '14 17:04 dpr11

i get the same problem. if i encrypt a file on a 32 bit device and open on a 64bit device it fails or vice versa.

bcyng avatar Sep 20 '14 13:09 bcyng

when change the code in crypt.h, the problem fixed #define CRC32(c, b) ((*(get_crc_table()+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))

RyouZhang avatar Sep 29 '14 23:09 RyouZhang

Hi Guys...! Hope you are all be fine...!

I am facing the issue in archiving an audio file password protected. I am getting wrong password alert, or it prompts again and again when I enter password. Please see this : https://cloudup.com/cbncMokTum7

When I zipped the file without password protecting, it works fine, I unzipped the file and it gives me audio file which runs perfectly. But not working when Password protected. I also tried, @RyouZhang solution, and change the crypt.h file, Now it looks like this : https://cloudup.com/cDLQzdUME45 But still no success.

Please help me to resolve this issue, I will be greatly thankful to you...!!!

Thanks...!

ahmadtbox avatar May 12 '17 10:05 ahmadtbox

Seems to me that this is just a duplicate of #37. I asked for the latest 'minizip' to be merged into project quite a long time ago...

Gauleiter avatar May 12 '17 12:05 Gauleiter

Hi @Gauleiter , I have integrated the Objective-Zip project through pods. I did not add the files manually.

Is it fine... ?

ahmadtbox avatar May 12 '17 12:05 ahmadtbox

@Gauleiter , I also edit applied this solution, https://github.com/nmoinvaz/minizip/commit/58921f6b960975f0f5a19e990615c8cc6204e47a But still not working...!

Please help me to resolve this issue.

ahmadtbox avatar May 12 '17 12:05 ahmadtbox

I will update the MiniZip sources in the following days, as per @Gauleiter request. I'm not so confident it will fix the issue, though. Encryption has always been a PITA. Let's try and see. Will update this and #37 when done.

gianlucabertani avatar May 12 '17 13:05 gianlucabertani

@gianlucabertani , Can you please tell me that the wrong password issue is due to the MiniZip resources. ?

Because I integrated this library through pods. And facing this issue.

Thanks...!

ahmadtbox avatar May 12 '17 13:05 ahmadtbox

MiniZip is part of the sources of Objective-Zip, it's compiled in. As explained in #37, Objective-Zip is just a wrapper around lower-level libraries that actually do the heavy lifting. Most of the times the source of errors is in those libraries, the wrapper by itself is quite shallow.

I can't know for sure what causes your problem with the password, what I can do is update MiniZip to the latest version (an operation that is long overdue) and add some tests on encryption. It will take some time, though. Please be patient.

If you really are in a hurry, consider alternative libraries, such as:

  • https://github.com/ZipArchive/ZipArchive
  • https://github.com/marmelroy/Zip
  • https://github.com/pixelglow/ZipZap

gianlucabertani avatar May 12 '17 14:05 gianlucabertani

Version 1.0.4 is out now, with MiniZip updated and some tests showing that password encryption works as expected.

Let me know if your issue is fixed.

gianlucabertani avatar May 13 '17 14:05 gianlucabertani

Perfect! Thank you very much. I'll have a chance to test it only in a few days, will report of the results.

Gauleiter avatar May 13 '17 16:05 Gauleiter