Encrypt symmetric keys with RSA.
Project description
Easy RSA
Encrypt symmetric keys with RSA.
Hierarchy
easyrsa
'---- EasyRSA()
|---- gen_private_key()
|---- gen_public_key()
|---- encrypt()
'---- decrypt()
Example
python
from easyrsa import *
# generate a key pair
kp = {}
EasyRSA(bits=512*2).gen_private_key(kp).gen_public_key(kp)
print(kp)
# encryption and decryption
from base64 import b64encode
symmetric_key = "abc" or b"abc"
encrypted_key = EasyRSA(public_key=kp["public_key"]).encrypt(symmetric_key)
key_in_b64 = b64encode(encrypted_key).decode("utf-8")
print(encrypted_key)
print(key_in_b64)
print(symmetric_key == EasyRSA(private_key=kp["private_key"]).decrypt(encrypted_key))
print(symmetric_key == EasyRSA(private_key=kp["private_key"]).decrypt(key_in_b64))
shell
rem easyrsa.exe {private key|public key} {base64 string to decrypt|key to encrypt}
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
easyrsa-0.0.3.tar.gz
(2.4 kB
view hashes)
Built Distribution
easyrsa-0.0.3-py3-none-any.whl
(15.2 kB
view hashes)