Motivation
RSA is a public-key cryptosystem that differs from Elgamal in that it does not rely on the difficulty of the discrete logarithm problem, but rather factorization.
Modular Exponentation
RSA works by raising the message to a power mod p. We first want to inspect whether raising a message to an exponent over Fp will create an injective or a surjective endomorphism.
We now check in F11 exponent values of 5 and 7:
152535455565758595105≡≡≡≡≡≡≡≡≡≡110111101010110172737475767778797107≡≡≡≡≡≡≡≡≡≡17953862410
Using 7, we see that we get an injection from a↣a7, which also happens to be a bijection; i.e. raising a base a by 7 permutes the residues modulo 11.
We then notice that φ(11)=10 and that (5,φ(11))=1; therefore, any exponent coprime to the totient will produce a unique mapping.
Sps. a,m∈N and that (a,m)=1.
Then, if k,k∈Zφ(m) such that kk≡1(modφ(m)), then akk≡ma.
Using Euler's theorem and the fact that there exists some ℓ such that kk=1+ℓφ(m), we get that
akk≡(aφ(m))ℓ⋅a≡a(modm).
Let (k,φ(m))=1, and (a,m)=1. Then, the mapping a↣ak permutes the residues modulo m (excluding 0).
As a result, aik≡majk⟺ai≡maj.
ai≡aikk≡(aik)k≡(ajk)k≡aj(modm).
The RSA Algorithm
RSA
Setup:
- Alice chooses two distinct large primes p,q and let m=pq.
- Alice can easily compute φ(m)=(p−1)(q−1).
- Then, Alice chooses a random k∈(0…φ(m)) satisfying (k,φ(m))=1.
- Finally, Alice makes the numbers m,k available publicly.
Encryption:
If Bob wants to send a message a to Alice, he uses Alice's public key values and sends to Alice:
ak(modm).
Decryption:
Alice can decrypt Bob's message by computing k via Euclidean algorithm that satisfies Lemma 13.1. Alice then decrypts the message by computing
(ak)k≡a(modm).
As mentioned in the Totient function discussion, the Carmichael function shows up in lieu of Euler's totient function in modern formulations of the RSA algorithm.
It can be shown that ∀n,λ(n)∣φ(n), meaning that the RSA algorithm works regardless of choice of totient functions.
The RSA algorithm generates equivalent keys with either Carmichael or Euler functions, ceteris paribus.
It's favorable to use the Carmichael function due to the fact that it generates a number that is a divsor of the Euler's totient.
As λ(n) is a divisor of φ(n), it is sometimes less than φ(n), thus using the Carmichael function reduces the amount of computations in RSA.