Network Security Technology Project

1. Implement the textbook RSA algorithm.

The textbook RSA is essentially RSA without any padding. Here we give a brief definition:

Choose two large primes p and q. Let n=pq. Choose e such that gcd(e,φ(n))=1, where φ(n)=(p1)(q1). Find d such that ed1modφ(n). In other words, d is the modular inverse of e, i.e., de1modφ(n).

(e,n) is the public key, (d,n) the private one.

To encrypt a plaintext m, compute cmemodn.
To decrypt a ciphertext c, compute mcdmodn.

In this part, you should achieve following goals:

2. Perform a CCA2 attack on textbook RSA.

Textbook RSA is elegant, but has no semantic security. Therefore it is not secure against chosen plaintext attacks or ciphertext attacks. A real-world case can be found here: When Textbook RSA is Used to Protect the Privacy of Hundreds of Millions of Users. In section 4.1, the authors explore the CCA2 attack on QQ browser. In this part, we aim to verify this type of attack on the textbook RSA you have built in the last part:

3. Implement a RSA-OAEP algorithm and discuss why RSA-OAEP can thwart such kind of attacks.

Since textbook RSA is vulnerable to attacks, in this paper, the authors give a solution: using OAEP key padding algorithm. In this part, you need implement the RSA-OAEP algorithm and discuss its effectiveness:

Note: feel free to choose your preferred programming language to work on this project.