A simple tools to hybrid encryption and decryption
Project description
Installation
Usage
from xrypt_xethhung12.xrypt import load_pub, load_pri, hybrid_encrypt, hybrid_decrypt
from Crypto.Cipher import PKCS1_OAEP as Cipher
from Crypto.Signature import PKCS1_v1_5
sender_pub = load_pub("rsa_public_key.pem")
sender_pri = load_pri("rsa_private_key.pem")
receiver_pub = load_pub("rsa_public_key_2.pem")
receiver_pri = load_pri("rsa_private_key_2.pem")
# normal case
key_str,iv_str,encrypt_data,sign = hybrid_encrypt(Cipher.new(receiver_pub), PKCS1_v1_5.new(sender_pri), "abcd1234567890".encode("utf-8"))
decrypted_data = hybrid_decrypt(Cipher.new(receiver_pri), PKCS1_v1_5.new(sender_pub), key_str, iv_str, encrypt_data, sign)
# decrypted_data -> b'abcd1234567890'
# incase the verify key fail
# there will be a exception raised
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
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.2.tar.gz
(1.8 kB
view hashes)
Built Distribution
Close
Hashes for xrypt_xethhung12-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6901011c343b32b26e143b4ae92e4efc68fce825ee85dde3c2637153f9a7799e |
|
MD5 | 72ea8f6a25021e248b22001e82421c83 |
|
BLAKE2b-256 | aa279f5a76f416bc1290370d84e0c46fef0808b2a8aea5978fad82c55921581b |