message_cipher.rsa_decrypter module
RSA Decryprtion module.
The RSA decryption module defines the RsaDecrypter class. Uses the RSA decryption algorithm to decrypt messages in the form of arrays of integers encrypted with the RSA encryption algorithm.
- class message_cipher.rsa_decrypter.RsaDecrypter
Bases:
Decrypter
RSA Decryption.
RsaDecrypter performs calculations to decrypt arrays of integers into string messages.
- __init__(product: int, private_key: int) None
Initialize a new RSA decryption system with values
product
andprivate_key
.- Parameters:
product (int) – The product of two large prime numbers.
private_key (int) – The private key used for decryption.
- Return type:
None
- decrypt(ciphertext: list[int]) str
Decrypts the encrypted message using the RSA system.
- Parameters:
ciphertext (list[int]) – An encrypted message to decrypt. The message should be a list of integers, as per output of
RsaEncrypter.encrypt
.- Returns:
The decrypted message as a string.
- Return type:
str