RSA is a public key encryption algorithm. (a) Implement the RSA algorithm. Assume the length of n and e in the public (e,n) is 4 digits (decimal), and the length of the private key is also 4 digits. Only characters are input to the algorithm. As described in class, characters are encoded.
Test the algorithm by encrypting and decrypting sample text. Include screenshots. Submit code. [10 marks]
(b) An attacker knows the algorithm, knows the public key, and the lengths of e, n, and d are 4 digits. They can generate any plaintext and get the corresponding ciphertext. They can do this as many times as they want.
RSA keys are of lengths 1,024 or 2,048 or 4,096 bits. This means that for a key of length 2,048 bits, there are 2^2048 possible keys. Hence, a brute force approach where every possible key is tested to determine if it is the key is not practical. Can an attacker obtain the private key without using a brute force approach? How? Explain.