A simple tools to hybrid encryption and decryption
Project description
Installation
pip install -U xrypt-xethhung12
Usage
import json
from xrypt_xethhung12.xrypt.xrypt import read_public_key_from_pem, read_private_key_from_pem, DeEnCryptor
def load_file(file_path: str) -> dict:
with open(file_path, 'r') as f:
data = json.load(f)
return data
if __name__ == '__main__':
base_path = "./"
s_pub = read_public_key_from_pem(base_path + "s_pub.key")
s_pri = read_private_key_from_pem(base_path + "s_pri.key")
r_pub = read_public_key_from_pem(base_path + "r_pub.key")
r_pri = read_private_key_from_pem(base_path + "r_pri.key")
d = load_file(base_path + "encrypted-data")
deen = DeEnCryptor(s_pub, s_pri)
container = deen.encryptToContainer(r_pub, "helloworld")
containerStr = deen.encryptToJsonContainer(r_pub, "helloworld")
print(containerStr)
deen = DeEnCryptor(r_pub, r_pri)
print(deen.decryptContainer(s_pub, container))
Scripts
Generate rsa key pair
pri={pri}
pub={pub}
openssl genrsa -out $pri 4096
openssl rsa -in $pri -outform PEM -pubout -out $pub
Build
rm -fr dist
python3 -m build
Build and Deploy
rm -fr dist
python3 -m build
twine upload dist/* -u __token__ -p $pwd
Update version dev
python3 -m xh_py_project_versioning --patch
Update version
python3 -m xh_py_project_versioning --patch -d
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
xrypt_xethhung12-0.0.7.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for xrypt_xethhung12-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81ae31cee9636f725af1dcbcb2608f675a396f56f3c88147d380e7720ba3a445 |
|
MD5 | dbd431d1e39de456f3d04116563eca81 |
|
BLAKE2b-256 | 09c9f49b97d052cdb6fc7760e7776473414faa7cef0197a4028f16ca05a90504 |