Learn Mathematics

RSA Encryption

RSA encryption is a form of public key encryption cryptosystem utilizing Euler's totient function, $\phi$, primes and factorization for secure data transmission. For RSA encryption, a public encryption key is selected and differs from the secret decryption key.

RSA Key Creations

The algorithm for creating a decryption key is as follows:

Step 1

First select two large primes. We will denote these primes as p and q.

We will now have to solve the congruence $17d \equiv 1 \pmod {264}$. This can be done using the division algorithm to find the modular inverse of 17 (mod 264). We will omit showing this, but through the division algorithm we'll find that 233 is a modular inverse of 17 (mod 264). Hence $(233)17d \equiv (233)1 \pmod {264}$. Hence $d \equiv 233 \pmod {264}$. Hence, our decryption key d = 233.

Step 6

We will now public the public information [n, e] = [299, 17], and keep our decryption key d a secret.

Encryption

Suppose that we want to send a message P that is a least residue (mod n). We would first look up the public information [n, e] and would then calculate:

(1)

\begin{align} C \equiv P^e \pmod n \end{align}

We would then send the cyphertext C. If the recipient of the cyphertext has the decryption key d, then they could decrypt the cyphertex C by calculating:

(2)

\begin{align} P \equiv C^d \pmod n \end{align}

RSA Key Decryption

The algorithm for finding the decryption key d from the public information [n, e] is as follows:

Step 1

Look up the public information [n, e]

Step 2

Factor n into primes p and q such that $n = pq$. Note that for very large primes n, this may take a long time.