An easy and simplified cryptographic utility package (fernet, RSA, hashes...)
Project description
Cryptographic utility package
An easy and simplified cryptographic utility package (fernet, RSA, hashes...) with some common encryption stuff already programmed (very simple and with common secure parameters by default). It uses the 'cryptography' module
Installation
pip install crypt-utilities
Modules
Symmetric
def encrypt ...
def encrypt_file ...
def decrypt_file ...
Hashes
def derive(data:bytes, salt:bytes, length:int=32, iterations=400000) -> bytes:...
Asymmetric
def rsa_encrypt (...
def generate_rsa_key_pairs (...
def generate_private_key (...
def serialize_pem_public_key (...
def load_pem_private_key (...
Usage Example
# Encrypt with RSA (asymmetric)
# -- John
secret_msg = "Very secret msg to send"
public_key = load_pem_public_key(file_path="./public_key")
encrypted:bytes = rsa_encrypt(secret_msg.encode(), public_key)
...
# Decrypt with RSA (asymmetric)
# -- Michael
private_key_path = str(input(" -> Introduce your private key file path: "))
password = str(input(" -> Introduce the private key password (blank if None was used): "))
if password == "":
password = None
try:
private_key = load_pem_private_key(file_path=private_key_path, password=password)
except :
print("[!] Wrong Password"); exit(1)
secret_msg_sent_by_john = rsa_decrypt(encrypted, private_key).decode()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file crypt_utilities-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: crypt_utilities-0.0.7-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2300f0f4f7fdc6632652c6c2e9fb332c9d836b094d6f41df4ca79ddc0e4370ec |
|
MD5 | e0ff6841c8dcaca127b9bac65de8f4fd |
|
BLAKE2b-256 | 70998cdaf782ec2564a11170579bbd05e823bdbdb5b0259dd9f13fb58c0926ff |