Powered by Tachyonic Project Luxon Framework v0.0.0

Luxon Framework for rapid application development. (luxon)

Version

RSA Cryptography

class luxon.utils.rsa.RSAKey[source]

Utility class to work with RSA keys.

decrypt(message)[source]

Method to decrypt a message with the private Key.

Parameters:message (str) – message encrypted wit the public key.
Returns:Unicode encoded decrypted message.
encrypt(message)[source]

Method to encrypt a message with the public Key.

Parameters:message (str) – Cleartext message to be encrypted.
Returns:base64 encoded encrypted message.
generate_private_key(bits=4096, password=None)[source]

Method to generate a private RSA key.

Parameters:
  • bits (int) – Key bit length.
  • password (str) – Key password.
Returns:

Unicode encoded private key.

load_pem_key(pem_key, password=None)[source]

Method to load the key from string.

Parameters:
  • pem_key (str) – Key to be loaded.
  • password (str) – Password for the key.
load_pem_key_file(file, password=None)[source]

Method to load the key from string.

Parameters:
  • file (str) – Location of file containing the key.
  • password (str) – Password for the key.
public_key

Property to return the unicode encoded RSA public key

sign(message)[source]

Method to sign a message with the Private key.

Parameters:message (str) – Message to by cryptograpically signed
Returns:base64 encoded signed message.
verify(signature, message)[source]

Method to verify the authenticity of a signed message

Parameters:
  • signature (str) – The message’s signature.
  • message (str) – The cleartext message that was signed and for which authenticity is to be verified.