Skip to main content

AES encryption for zipfile. Including Callback.

Project description

Current Version on PyPi Supported Python Versions Travis build (Linux/OsX)

pyzipper

A 100% API compatible replacement for Python’s zipfile that can read and write AES encrypted zip files. Callback function added to extracting zipfiles

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evo-pyzipper-0.3.2.tar.gz (108.0 kB view details)

Uploaded Source

File details

Details for the file evo-pyzipper-0.3.2.tar.gz.

File metadata

  • Download URL: evo-pyzipper-0.3.2.tar.gz
  • Upload date:
  • Size: 108.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for evo-pyzipper-0.3.2.tar.gz
Algorithm Hash digest
SHA256 4ab7a226620cb76367633314fae179ac2ad2be6d7a5fab64f1a1024e59b90731
MD5 a6c77e2af9dead042636012483f07df4
BLAKE2b-256 625b37fa6150c7dc3d070a80038865a073845c03a87d121edb39dc2b388d2fc4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page