Skip to main content

Python high level library for symmetric & asymmetric encryption

Project description

cryptidy

Python high level library for symmetric & asymmetric encryption

License Percentage of issues still open Maintainability codecov linux-tests windows-tests GitHub Release

This library has been written to make encryption / decryption of any python object as simple as possible, while keeping the encryption solution secure. It is based on pycryptodomex AES and RSA encrpytion implementations.

It's main features are:

  • Encrypt any pickable Python object / variable / blob
  • Add an UTC timestamp to the encrypted message
  • Verify that decrypted messages timestamps aren't in the future or too old (for bad RTC clock diags)
  • Allow symmetric encryption (AES-EAX mode)
    • 128, 192 or 256 bits encryption
  • Allow asymmetric encryption (RSA encryption with SHA384 hash algorithm and above AES encryption)
    • 1024, 2048 or 4096 bits RSA encryption with AES-256 session encryption
  • Provide the encypted data as base64 string for maximum portability between platforms and encodings
  • Unload AES key from memory as soon as possible to help prevent memory attacks

Setup

Current cryptidy tests are Python 3.7 and up.
Nevertheless, cryptidy v1.2.3 still runs on Python 2.7+ ;)

pip install cryptidy

Symmetric encryption usage

from cryptidy import symmetric_encryption

key = symmetric_encryption.generate_key(32)  # 32 bytes == 256 bits

some_python_objects = ['foo', 'bar'], 'some long string', 12
encrypted = symmetric_encryption.encrypt_message(some_python_objects, key)
timestamp, original_object = symmetric_encryption.decrypt_message(encrypted, key)

Asymmetric encryption usage

from cryptidy import asymmetric_encryption

priv_key, pub_key = asymmetric_encryption.generate_keys(2048)  # 2048 bits RSA key

some_python_objects = ['foo', 'bar'], 'some long string', 12
encrypted = asymmetric_encryption.encrypt_message(some_python_objects, pub_key)
timestamp, original_object = asymmetric_encryption.decrypt_message(encrypted, priv_key)

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

cryptidy-1.2.4.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cryptidy-1.2.4-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file cryptidy-1.2.4.tar.gz.

File metadata

  • Download URL: cryptidy-1.2.4.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cryptidy-1.2.4.tar.gz
Algorithm Hash digest
SHA256 dd2984d09c920211a862e5718dc87ea2db8fdc597f5faec961a4d4b30f7fe923
MD5 8bd4a085f42d8268c98f42b7976991d9
BLAKE2b-256 4a1ace39f7d5b1dc3bc53aec644e8b99a154e1ca3f15797fb315742b0a7f5d66

See more details on using hashes here.

File details

Details for the file cryptidy-1.2.4-py3-none-any.whl.

File metadata

  • Download URL: cryptidy-1.2.4-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cryptidy-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dbd3e020200a10721bcf1ab0baad9c6ad46a5029402b4fe6904328b23f5a6198
MD5 dbad6c0029563b429d31a96f2c51a7fc
BLAKE2b-256 2155ce1116d87e3ef11440e81b171707c1b2b7f832aaf42af7772f7f617f3ce9

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