IS364 L02 Unit3a
IS364 L02 Unit3a
IS 364: IT Security
Home / My courses / IS 364 / 30 April - 6 May / L/Unit 3: The RSA Algorithm
In this lecture, the RSA algorithm is presented in two parts. Firstly, an outline of the RSA is
presented to give you an idea of how it works relative to the other algorithms studied. Then, delve
more deeply into a detailed analysis of the steps involved.
Two keys, d and e, are used for decryption and encryption. They are actually interchangeable. The
plaintext block M is encrypted as Me mod n. Because the exponentiation is performed mod n,
factoring Pe to uncover the encrypted plaintext is difficult. However, the decrypting key d is carefully
chosen so that (Me)d mod n = P. Thus, the legitimate receiver who knows d simply computes (Me)d
mod n = M and recovers M without having to factor Me.
The encryption algorithm is based on the underlying problem of factoring large numbers. The
factorization problem is not known; the fastest known algorithm is exponential in time.
C = Me mod n
https://lms.udsm.ac.tz/mod/page/view.php?id=5416&forceview=1 1/3
5/8/2019 IS 364: L/Unit 3: The RSA Algorithm
Both sender and receiver must know the value of n. The sender knows the value of e, and only the
receiver knows the value of d. Thus, this is a public-key encryption algorithm with a public key of PU
= {e, n} and a private key of PU = {d, n}. For this algorithm to be satisfactory for public-key
encryption, the following requirements must be met:
1. It is possible to find values of e, d, n such that Med mod n = M for all M < n.
2. It is relatively easy to calculate mod Me mod n and Cd for all values of M < n.
For now, we focus on the first requirement and consider the other questions later. We need to find a
relationship of the form
Med mod n = M
The above relationship holds if e and d are multiplicative inverses modulo f(n), where f(n) is the
Euler totient function.
That is, e and d are multiplicative inverses mod f(n). Note that, according to the rules of modular
arithmetic, this is true only if d (and therefore e) is relatively prime to f(n). Equivalently, gcd(f(n),d) =
1. The RSA scheme with its ingredients can be stated as follows:
n = pq (public, calculated)
The private key consists of {d, n} and the public key consists of {e, n}. Suppose that user A has
published its public key and that user B wishes to send the message M to A. Then B calculates C =
Me mod n and transmits C. On receipt of this ciphertext, user A decrypts by calculating M = Cd mod
n.
Example:
2. Calculate n = pq = 17 x 11 = 187.
4. Select e such that e is relatively prime to f(n) = 160 and less than f(n) we choose e = 7.
5. Determine d such that de1 (mod 160) and d < 160. The correct value is d = 23, because 23 x 7 =
161 = 10 x 160 + 1; d can be calculated using the extended Euclid's algorithm.
https://lms.udsm.ac.tz/mod/page/view.php?id=5416&forceview=1 2/3
5/8/2019 IS 364: L/Unit 3: The RSA Algorithm
References
1. Stallings, William - Cryptography And Network Security 4Th Ed - Prentice Hall - (2005)
2. Security in Computing, Fourth Edition By Charles P. Pfleeger. Pfleeger Consulting Group, Shari
Lawrence Pfleeger - RAND Corporation.
https://lms.udsm.ac.tz/mod/page/view.php?id=5416&forceview=1 3/3