Here we will use the following resources:- https://drive.google.com/drive/folders/1-hugfGRaFiWQaxi7eQS9a4WY8hQN23Oo?usp=share_link
The RSA, named after its inventors Rivest, Shamir, and Adleman [RSA78], is a popular public-key cryptosystem. A cryptosystem is an encryption-cum-decryption scheme for communication between a sender and a receiver. Such a system is secure if it is infeasible for a (potentially malicious) third party to eavesdrop on the encrypted message and decrypt it efficiently. In a public-key cryptosystem, the receiver publishes a common key (also known as the public key), using which anyone can encrypt a message and send it to the receiver. On the other hand, only the receiver knows a secret private key using which the message can be decrypted efficiently.
The RSA key generation procedure is as follows.
ALGORITHM 1 RSA: Key Generation
- Fix a key length, say,
$2^{r}$ bits. - Randomly select two distinct primes
$p$ and$q$ each of$2^{r-1}$ bits. - Let
$n = pq$ and$\phi(n) = (p-1)(q-1)$ , the totient function. - Randomly select an
$e$ such that$3\le e\le \phi(n)$ and$gcd(3,\phi(n))=1$ . - Find the smallest
$d$ such that$d \cdot e = 1 \mod \phi(n)$ . - The pair
$(n, e)$ is the encryption key. - The decryption key is
$d$ .
The public key consists of the modulus
ALGORITHM 2 RSA: Encryption
- Let
$m$ be the message to be encrypted. - Treat
$m$ as a number less than$n$ , and assume that$gcd(m, n) = 1$ . - Compute
$c = m^{e} \mod n$ . -
$c$ is the encrypted message.
The assumption that
ALGORITHM 3 RSA: Decryption
- Compute
$c^{d} \mod n = m^{ed} \mod n = m$ .
Since