Skip to main content

encrypt_tools

Project description

encrypt_tools: encrypt and decrypt

Github License Updates Python 3 Code coverage

encrypt_tools is a Python package of low-level cryptographic primitives.

Installation

The code is packaged for PyPI, so that the installation consists in running:

pip install encrypt-tools

Usage AES

from encrypt_tools import CryptoAes
from encrypt_tools import generate_b64decode

KEY = generate_b64decode("onAGSOj7NXlJo0xo5iorF3vQT+ip/uRBcZDMuEljyCo=")
IV = generate_b64decode("WvdNOBeWH+nApbbqz/WAZg==")

cipher = CryptoAes()
text = "51123456789"

encrypt = cipher.encrypt(text, KEY, IV)
print(f'encrypt:\n{encrypt}')

decrypt = cipher.decrypt(encrypt, KEY, IV)
print(f'decrypt:\n{decrypt}')

Usage RSA

from encrypt_tools import CrypyoRsa
from encrypt_tools import generate_key_pair

cipher = CrypyoRsa()
text = "51955376623"

passphrase_private = "passphrase_private"
passphrase_public = "passphrase_public"
generate_key_pair(passphrase_private,
                  passphrase_public)

encrypt = cipher.encrypt(text, passphrase_public)
print(f'encrypt:\n{encrypt}')

decrypt = cipher.decrypt(encrypt, passphrase_private)
print(f'decrypt:\n{decrypt}')

Usage RSA Files

from encrypt_tools import CryptoFiles
from pathlib import Path

cipher = CryptoFiles()
text = "51955376623"
passphrase_private = "passphrase_private"
passphrase_public = "passphrase_public"

private_key = Path('private.pem')
public_key = Path('public.pem')
unencrypted_file = Path('file.txt')

encrypt = cipher.encrypt(unencrypted_file, public_key, passphrase_public)
print(f'encrypt:\n{encrypt}')


decrypt = cipher.decrypt(encrypt, private_key, passphrase_private)
print(f'decrypt:\n{decrypt}')

License

Apache License 2.0.

New features v1.0

BugFix

  • choco install visualcpp-build-tools

Reference

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

encrypt_tools-0.0.2.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

encrypt_tools-0.0.2-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

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