简体   繁体   中英

Python's zipfile library can't extract password protected file

For some reason, Python's zipfile library cannot extract the files in this password-protected zipfile archive . Here is the code I used:

import zipfile

zip_filename = 'extract_public_2018_20201006094007483_71129_20201001-20201006Texas.zip'

zipfile_password = b'&CkN52mKji3R8^4aI#7Z'

with zipfile.ZipFile(zip_filename) as myzip:
    myzip.extractall(pwd=zipfile_password)

This is the error I get: NotImplementedError: That compression method is not supported

I dug a little deeper and found that the compression method for the files inside this archive is 99. Where can I find what this compression method really is? And does this just mean I can't unzip this file using Python's zipfile librabry?

I'm using Python 3.8.

PKWare's appnote says that 99 is:

99 - AE-x encryption marker (see APPENDIX E)

...

APPENDIX E - AE-x encryption marker


E.1 AE-x defines an alternate password-based encryption method used in ZIP files that is based on a file encryption utility developed by Dr. Brian Gladman. Information on Dr. Gladman's method is available at

http://www.gladman.me.uk/cryptography_technology/fileencrypt/

I'm guessing there are no libraries to help with that. You're probably stuck using 7z or PKZIP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM