Skip to main content

Symmetric encryption and decryption compatible with openSSL.

Project description

Installation

You can grab the latest .whl file from repository and install it via pip or just simply type:

pip install opencrypt

If you want build from source code, then.

git clone https://github.com/EbryxLabs/opencrypt
cd opencrypt/
python setup.py install

You will have a package named opencrypt installed for your python.

Encryption / Decryption

You can encrypt / decrypt data using ebcrypt tool. (AES-256 Encryption)

For example, to encrypt you can do following:

ebcrypt <my-file.json> -e --new
# encrypts myfile.json using newly created crypto-secure key. Keys will be written to _keys file.

ebcrypt <my-file.json> -e
# encrypts using keys in AES_KEY, AES_IV environment variable.

For decryption, you'll need to have AES_KEY and AES_IV keys in your environment variables.

ebcrypt <my-file.json> -d

This is an optional step in case you want to decode your encrypted data explicitly for manual checking. Program decrypts your encrypted config file automatically.

You can get detailed help on crypto tool by typing.

ebcrypt -h

OpenSSL compatibility

Encryption done by openssl utility can be decrypted by ebcrypt utility and vice versa. For example, you can encrypt using openssl as follows.

openssl aes-256-cbc -a -e -K <hex-key> -iv <hex-iv> -in <input-file> -out <output-file>

hex-key and hex-iv should be replaced with actual keys in hex format. Using the same keys you used in openssl, you can decrypt using ebcrypt as follows.

ebcrypt <encrypted-file> -d
# AES_KEY environment variable should hold <hex-key>.
# AES_IV environment variable should hold <hex-iv>.

Similarly, you can encrypt using ebcrypt and decrypt the content using openssl, given that you're using the same keys.

Code Usage

You can also use it in your own code by importing the appropriate module.

import opencrypt
opencrypt.encrypt_file(filename, new_keys=False)
opencrypt.decrypt_file(filename, write_to_file=True, is_ciphertext=False)

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

opencrypt-0.5.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

opencrypt-0.5.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file opencrypt-0.5.1.tar.gz.

File metadata

  • Download URL: opencrypt-0.5.1.tar.gz
  • Upload date:
  • Size: 4.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.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for opencrypt-0.5.1.tar.gz
Algorithm Hash digest
SHA256 6ba9e3ee1da34f5f6c9429e3df9b2369d4828822226aa2b4922c66aab996899a
MD5 0fcdd40853689452865c765019778fdd
BLAKE2b-256 e2ec5013ae3542a426ef39ea09ad4361f369e5c34453f614f289ca22ab35d056

See more details on using hashes here.

File details

Details for the file opencrypt-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: opencrypt-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for opencrypt-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 731da08cfa76b16d73b252ac268a2d25c0793fd8fa7f079f754d8dc64476af3f
MD5 5ec1eec3e4eb68c24ba336c4f9c32d35
BLAKE2b-256 8476012b1fcedfc6ab3c083953f0ed5b2af2f3acb3922ae19352a93e8c377691

See more details on using hashes here.

Supported by

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