Maths IA Poster: The RSA Encryption
Maths IA Poster: The RSA Encryption
Maths IA Poster: The RSA Encryption
Evan Luo
1. Introduction
1.1. Symmetric Encryption
In the modern world, we use Internet in our daily life. We use Internet to transfer message to others,
shopping online, etc. These things all require an important process: Encryption. Without encryption,
hackers can see the message you sent to your friends and even steal your money stored in the banks.
The traditional encryption method is to set a secret between two sides (the side here can be an orga-
nization, a person or a service) and use this secret to encrypt the data. Anyone who have this secret
can decrypt the data. This is called Symmetric Cryptography. However, this method has a defect:
the process of transferring the secret between two sides has to be secured, or else the encryption is
not safe.
For example, Alice want to send her credit card password to Bob on email secretly. First, she has to
send a secret to Bob through email, but this means that if someone intercepts this email, the encryption
will loss effectiveness.
1
Figure 2: Unsafe Symmetric Encryption.
If Alice wants to make the encryption effective, she has to transfer the secret offline or makes sure that
no one except Bob can get this secret. But this is pretty hard and not convenient.
Therefore, cryptographers create a new way of encryption: Asymmetric Encryption. And the rep-
resentative algorithm of this way is RSA.
2
Figure 3: The Asymmetric Encryption Process.
This is the key process of asymmetric encryption. Now we are going to talk about the RSA algorithm.
2. RSA Algorithm
2.1. Background Information
RSA is one of the oldest and the most widely used asymmetric encryption algorithm. The acronym
“RSA” comes from the surnames of Ron Rivest, Adi Shamir and Leonard Adleman, who publicly de-
scribed the algorithm in 1977. The security of RSA is based on the complexity of factoring the product
of two large prime numbers. The problem is called the Factoring Problem.
3
𝜑(𝑁 ) = 𝜑(𝑝)𝜑(𝑞) = (𝑝 − 1)(𝑞 − 1) (2)
Now the Equation 3 satisfies the form of extended euclidean algorithm. The problem has been changed
to solve 𝑑 and −𝑘 using the extended euclidean algorithm. The detailed process of the algorithm is too
complex, so here we don’t explain it.
Step 4: Destory Any History of 𝒑 and 𝒒 and Construct Public And Private Keys
The final step is to destory any history (logs of calculating the keys, etc.), and construct public and
private keys. The public key will be like (𝑁 , 𝑒) and the private key will be like (𝑁 , 𝑑).
2.2.2. Encryption
To encrypt a message, first we need to convert the message into a integer 𝑚, where
𝑚 < 𝑁 , gcd(𝑚, 𝑁 ) = 1. Then we use the formula below to encrypt the message:
𝑚𝑒 ≡ 𝑐 (mod 𝑁 ) (5)
2.2.3. Decryption
We use the 𝑑 to decrypt a message:
𝑐𝑑 ≡ 𝑚 (mod 𝑁 ) (6)
2.2.4. Proof
But why the encryp and decrypt equation is like that? We need to prove it.
According to Equation 5, we can get:
4
𝑐 = 𝑚𝑒 − 𝑘𝑛 (7)
By Replace 𝑐 in Equation 6, we get:
This is because if we we use the binomial theorem to expand (𝑚𝑒 − 𝑘𝑁 )𝑑 , it will be like this:
𝑑
𝑑
∑( )𝑚𝑒𝑘 (𝑘𝑁 )𝑑−𝑘 (10)
𝑘=0
𝑘
It is obvious that every term except the first term all contains 𝑘𝑁 , which means that they are all di-
visible by 𝑁 .
Now the problem is converted to proving Equation 9. But we have to make another conversion.
We can write Equation 3 in the form below:
𝑒𝑑 = ℎ𝜑(𝑁 ) + 1 (11)
Now the problem is to prove Equation 12. We have two kinds of situations.
𝑚𝜑(𝑁) ≡ 1 (mod 𝑁 )
⇒ 𝑚ℎ𝜑(𝑁) ≡ 1ℎ (mod 𝑁 )
⇒ 𝑚ℎ𝜑(𝑁) ≡ 1 (mod 𝑁 ) (13)
ℎ𝜑(𝑁)
⇒𝑚 ⋅ 𝑚 ≡ 1 ⋅ 𝑚 (mod 𝑁 )
⇒ 𝑚ℎ𝜑(𝑁)+1 ≡ 𝑚 (mod 𝑁 )
5
𝑚𝜑(𝑞) ≡ 1 (mod 𝑞)
⇒ 𝑚ℎ𝜑(𝑞) ≡ 1 (mod 𝑞)
𝜑(𝑝)
⇒ (𝑚ℎ𝜑(𝑞) ) ≡ 1 (mod 𝑞) (14)
⇒ 𝑚ℎ𝜑(𝑁) ≡ 1 (mod 𝑞)
⇒ 𝑚ℎ𝜑(𝑁)+1 ≡ 𝑚 (mod 𝑞)
(𝑘𝑝)𝑒𝑑 = 𝑡′ 𝑝𝑞 + 𝑘𝑝 (17)
Divide 𝑝 from both sides, we can see that the LHS is divisible by 𝑝. Therefore, the RHS 𝑡 𝑝𝑞 + 𝑝 is an
integer.
𝑡
Because 𝑝 and 𝑞 are coprime, 𝑝
has to be an integer, which means that 𝑡 ∣ 𝑝. Hence, we have:
𝑡 = 𝑡′ 𝑝 (18)
(𝑘𝑝)𝑒𝑑 = 𝑡′ 𝑝𝑞 + 𝑘𝑝 (19)
𝑚𝑒𝑑 = 𝑡′ 𝑁 + 𝑚
⇒ 𝑚𝑒𝑑 ≡ 𝑚 (mod 𝑁 ) (20)
𝑑
⇒ 𝑐 ≡ 𝑚 (mod 𝑁 )