Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening encrypted zip files on Catalina MacOSX #18

Closed
jjtapia opened this issue May 20, 2021 · 5 comments
Closed

Opening encrypted zip files on Catalina MacOSX #18

jjtapia opened this issue May 20, 2021 · 5 comments

Comments

@jjtapia
Copy link

jjtapia commented May 20, 2021

Hello, I am having issues opening files encrypted with pyzipper using the native Archive utility app from MacOSX

When using ZIP_BZIP2 or ZIP_LZMA archiver will fail with error 79

image

When using ZIP_DEFLATED archiver will fail to accept the provided password

The zip file will open, accept the password and uncompress correctly though when using ZIP_STORED

macosx version: 10.15
pyzipper version :0.3.5 (from pypi)

The file will open correctly when using 7z though, so I'm guessing it is some kind of incompatibility with the native app

@danifus
Copy link
Owner

danifus commented May 20, 2021

Hi,

I'm not using that version of mac osx so I can't test it but I'm surprised that it worked with ZIP_STORED and not ZIP_DEFLATED. I haven't tested it on catalina but these AES encrypted files were unable to be opened by the native mac archiver when I last tested. Are you able to share the script you used to generate the files?

For lzma and bzip2, I think you are correct that this is an issue with the native app - I get similar errors when using Python's zipfile module.

@jjtapia
Copy link
Author

jjtapia commented May 20, 2021

Sure, here is the script

import pyzipper

zf = pyzipper.AESZipFile('test_def.zip', mode="w", compression=pyzipper.ZIP_DEFLATED, encryption=pyzipper.WZ_AES)
zf.setpassword(b'test')
zf.writestr('test.txt', 'hello world')
zf.close()

zf = pyzipper.AESZipFile('test_store.zip', mode="w", compression=pyzipper.ZIP_STORED, encryption=pyzipper.WZ_AES)
zf.setpassword(b'test')
zf.writestr('test.txt', 'hello world')
zf.close()

@danifus
Copy link
Owner

danifus commented May 20, 2021

Thanks for the script. I've found a Catalina mac to test and am seeing the same behaviour but the file extracted from the ZIP_STORED file is empty. Is there contents in your file extracted from the ZIP_STORED archive?

@danifus
Copy link
Owner

danifus commented May 20, 2021

I found a github issue for Keka (mac archiving program) that suggests the AES encryption isn't supported by the native mac archiver: aonez/Keka#477

I think this is a short coming of the native mac archiver program. Thanks for raising the issue and doing some testing for me though :)

@jjtapia
Copy link
Author

jjtapia commented May 21, 2021

Thank you for following up. I went back to the extracted file from the encrypted archive and after checking the contents it seems its just junk code rather than the original contents like the inforamtion you found suggests. Like you say this seems to be a shortcoming of the archiver program, which is a shame. Going through the code it does not seem the library supports CRC Encryption (with good reason, its old), so I guess I should look for an alternative if I want my pipeline to support MacOSX 10.15 clients.

@danifus danifus closed this as completed May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants