Add your description here
Project description
multienc
A refined hybrid encryption/decryption library for secure data transmission.
Installation
pip install multienc
Usage
from multienc.crypto import RSAKeyManager, AESCipher, MultiEncrypter
# Configuration
PRIVATE_KEY_PATH = "private_key.pem"
PUBLIC_KEY_PATH = "public_key.pem"
PRIVATE_KEY_PASSWORD = b"secure-password" # Replace with a secure password
CLIENT_PUBLIC_KEY_FOR_AES = "clientpubkey1234" # Must match the client's key
UID = "user123" # Unique user identifier
# Initialize the key manager (generates keys if they don't exist)
rsa_key_manager = RSAKeyManager(PRIVATE_KEY_PATH, PUBLIC_KEY_PATH, PRIVATE_KEY_PASSWORD)
# Initialize the AES cipher
aes_cipher = AESCipher(CLIENT_PUBLIC_KEY_FOR_AES)
# Initialize the multi-encrypter
multi_encrypter = MultiEncrypter(rsa_key_manager, aes_cipher)
# Encryption
data = {"message": "This is a secret message!"}
encrypted_payload = multi_encrypter.encrypt_refined_hybrid(data, UID)
print("Encrypted payload:", encrypted_payload)
# Decryption
# (Assume you've received the encrypted_payload from the client)
decrypted_data = multi_encrypter.decrypt_refined_hybrid(encrypted_payload, UID)
print("Decrypted data:", decrypted_data)
Important:
- Replace
"secure-password"with a strong, randomly generated password for your RSA private key. - Ensure the
CLIENT_PUBLIC_KEY_FOR_AESmatches the value used by the client for AES key derivation. - Handle RSA key generation and storage securely. Do not hardcode the private key password in production.
- The
UIDshould be unique per user or session.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
multienc-0.1.0.tar.gz
(13.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multienc-0.1.0.tar.gz.
File metadata
- Download URL: multienc-0.1.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
210d8592da3f4130fb05d11c377009760821cb5d15c798f6b85ed7b488fa5ad0
|
|
| MD5 |
68a71ce2e99faae201952be3238d62a9
|
|
| BLAKE2b-256 |
05170a81ef9ad88afc65c3ab2b1d59f62a695cc448921f55b02cf6715fadfb76
|
File details
Details for the file multienc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: multienc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83fa419a051006dafe022d13b0e23afc3a01853137205a00024138d9742783a4
|
|
| MD5 |
63685846e4bdfa28129a8ea992ff6606
|
|
| BLAKE2b-256 |
6405b66d82b85c2b7850c59fae14ef44c343df1c9ece18cc2125d8cd0871a37c
|