AsymmetricCipher Module¶
- class AsymmetricCipher¶
A class for handling asymmetric encryption.
- generate_key_pair()¶
Generate a pair of private and public keys for RSA encryption.
- Returns:
The generated private and public keys.
- Return type:
tuple
- rsa_encrypt(message, public_key)¶
Encrypt a message using RSA encryption.
- Parameters:
message (bytes) -- The message to be encrypted.
public_key (RSAPublicKey) -- The public key for RSA encryption.
- Returns:
The encrypted message.
- Return type:
bytes
- rsa_decrypt(ciphertext, private_key)¶
Decrypt a ciphertext message using RSA decryption.
- Parameters:
ciphertext (bytes) -- The ciphertext message to be decrypted.
private_key (RSAPrivateKey) -- The private key for RSA decryption.
- Returns:
The decrypted message.
- Return type:
bytes