AES encryption for zipfile.
Project description
pyzipper
A replacement for Python’s zipfile that can read and write AES encrypted zip files. Forked from Python 3.7’s zipfile module, it features the same zipfile API from that time (most notably, lacking support for pathlib-compatible wrappers that were introduced in Python 3.8).
Installation
pip install pyzipper
Usage
import pyzipper
secret_password = b'lost art of keeping a secret'
with pyzipper.AESZipFile('new_test.zip',
'w',
compression=pyzipper.ZIP_LZMA,
encryption=pyzipper.WZ_AES) as zf:
zf.setpassword(secret_password)
zf.writestr('test.txt', "What ever you do, don't tell anyone!")
with pyzipper.AESZipFile('new_test.zip') as zf:
zf.setpassword(secret_password)
my_secrets = zf.read('test.txt')
AES Strength
The strength of the AES encryption can be configure to be 128, 192 or 256 bits. By default it is 256 bits. Use the setencryption() method to specify the encryption kwargs:
import pyzipper
secret_password = b'lost art of keeping a secret'
with pyzipper.AESZipFile('new_test.zip',
'w',
compression=pyzipper.ZIP_LZMA) as zf:
zf.setpassword(secret_password)
zf.setencryption(pyzipper.WZ_AES, nbits=128)
zf.writestr('test.txt', "What ever you do, don't tell anyone!")
with pyzipper.AESZipFile('new_test.zip') as zf:
zf.setpassword(secret_password)
my_secrets = zf.read('test.txt')
Documentation
Official Python ZipFile documentation is available here: https://docs.python.org/3/library/zipfile.html
Credits
The docs skeleton was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyzipper-0.3.6.tar.gz
.
File metadata
- Download URL: pyzipper-0.3.6.tar.gz
- Upload date:
- Size: 31.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0adca90a00c36a93fbe49bfa8c5add452bfe4ef85a1b8e3638739dd1c7b26bfc |
|
MD5 | 9e2c5425b93dd789ecf3264cadc0f12d |
|
BLAKE2b-256 | ac972f03c67b40e531b30f0e1357476b4db989097a92cd30c6d2389cfa12db49 |
File details
Details for the file pyzipper-0.3.6-py2.py3-none-any.whl
.
File metadata
- Download URL: pyzipper-0.3.6-py2.py3-none-any.whl
- Upload date:
- Size: 67.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d097f465bfa47796b1494e12ea65d1478107d38e13bc56f6e58eedc4f6c1a87 |
|
MD5 | 39e5c2e716404a742f4cefd1e1edba84 |
|
BLAKE2b-256 | 2db89d5d7cf4d96db8efa39f232fb152e87231fdaa5072229e6517f77a18d9c7 |