Proof of the RSA Public Key Cryptosystem
📂Number TheoryProof of the RSA Public Key Cryptosystem
Buildup
Let’s call them Alice, Bob, and Eve from left to right. Alice and Bob are the parties exchanging messages, and Eve is a passive attacker interested in the message. The orange box represents information only known by Alice, the sky blue box is information only known by Bob, and the black box represents information that is public (also known by Eve).
Alice has a message m∈N she needs to receive from Bob.
Algorithm
Key Setup: Alice selects and publishes a large prime number’s product N=pq which satisfies gcd(e,(p−1)(q−1))=1 and e.

Encryption: Bob computes c≡me(modN) and makes it public.

Decryption: Alice finds d that satisfies de≡1(mod(p−1)(q−1)) and calculates x≡cd≡m(modN) to obtain x=m. Eve realistically cannot know d, therefore she cannot know m.

Description
The RSA Public Key Cryptosystem was developed by Ronald Rivest, Adi Shamir, and Leonard Adleman and is abbreviated as RSA, named after the first letters of their last names. The three were awarded the Turing Award in 2002 for this achievement.
It is based not only on the difficulty of the discrete logarithm problem like the ElGamal Public Key Cryptosystem but also on the difficulty of the prime factorization problem, making it worthwhile to find large primes just for its robustness. Moreover, it is a system that is fun to study because it’s not just theoretical or outdated but is actually used worldwide today. A potentially fatal attack method is the Shor’s Algorithm, based on quantum computers, but the commercialization of quantum computers is far off, so it will remain active for the foreseeable future.
Proof
Decryption
Alice knows the prime factorization N=pq of N, so she can find e that satisfies gcd(e,(p−1)(q−1))=1.
Extended Euclidean Theorem: For two integers a,b, there always exists an integer solution to aX+bY=gcd(a,b).
For two integers e, (p−1)(q−1),
eX+(p−1)(q−1)Y=1
there exists an integer solution {X=dY=−k, which means
de=1+k(p−1)(q−1)
In other words, d, i.e., the inverse of e in the ring Z(p−1)(q−1), and since Alice knows p, q, she can easily find d. [ NOTE: The existence of a multiplicative inverse in a ring is not at all trivial, which highlights the necessity of condition gcd(e,(p−1)(q−1))=1. ]
Euler’s Totient Theorem:
gcd(a,m)=1⟹aϕ(m)≡1(modm)
Since gcd(e,(p−1)(q−1))=1, the inverse of e, d, is found as follows:
d=e−1=eϕ((p−1)(q−1))−1
It simply involves exponentiation of e, so it can be easily and quickly calculated using the exponentiation by squaring method. Let’s consider the case where gcd(c,pq)=1 is satisfied and the case where it is not.
Case 1. gcd(c,pq)=1
It reduces to a problem of finding a modular square root of congruence equations.
Multiplicative property of the Totient function:
gcd(p,q)=1⟹ϕ(pq)=ϕ(p)ϕ(q)
ϕ(p)=p−1 and ϕ(q)=q−1 so
ϕ(pq)=ϕ(p)ϕ(q)=(p−1)(q−1)
Euler’s Totient Theorem:
gcd(c,N)=1⟹cϕ(N)≡1(modN)
c(p−1)(q−1)=cϕ(pq) so
(cd)e≡cde≡c1+k(p−1)(q−1)≡c⋅(c(p−1)(q−1))k≡c⋅1k≡c(modpq)
Case 2. gcd(c,pq)=1
C≡c(p−1)(q−1)(modpq)
If c is a multiple of pq then xe≡0, therefore x=0 is necessary and meaningless. Hence, assume that c is a multiple of either p or q, but it doesn’t matter which one, so let’s assume it’s a multiple of q. Then, for some n0∈Z and p not a multiple of some K∈Z,
C==c(p−1)(q−1)+(pq)⋅n0[qK](p−1)(q−1)+p⋅qn0
there exists qn0 satisfying the above equation, so
c(p−1)(q−1)≡[(qK)q−1]p−1(modp)
Part 1. (cd)e≡c(modp)
Fermat’s Little Theorem: For a prime p and an integer a relatively prime to p, ap−1≡1(modp)
Since K is not a multiple of p, [(qK)q−1] is relatively prime to p,
(cd)e≡cde≡c1+k(p−1)(q−1)≡c⋅[(qK)k(q−1)]p−1≡c⋅1(modp)
Part 2. (cd)e≡c(modq)
(cd)e≡cde≡[qK]de≡0≡qK≡c(modq)
Part 3. (cd)e≡c(modpq)
Multiplication of Modulos: If gcd(m1,m2)=1 then {a≡b(modm1)a=b(modm2)⟹a≡b(modm1m2)
From Part 1, 2, {(cd)e≡c(modp)(cd)e≡c(modq) is obtained, so we get:
(cd)e≡c(modpq)
Therefore, x=cd exists as a solution to xe≡c(modpq) under any circumstances. Also, another solution u, if it exists, can easily be shown to always appear as u≡cd(modpq).
■
Encryption
Eve knows e, but to find the inverse d, she must solve the prime factorization problem N=pq. Since this is very difficult, Bob can securely transmit the message m to Alice.
■
See Also
Security Algorithms Utilizing the Difficulty of Prime Factorization Problem
Attack Algorithms on the Prime Factorization Problem