Introduction
● RSA wasdeveloped by Ron Rivest, Adi Shamir, and Len Adleman at MIT in 1977.
● It is a public-key cryptographic algorithm.
● The RSA scheme is a block cipher in which the plaintext and ciphertext are integers between 0 and n -
1 for some n.
● A typical size for n is 1024 bits, or 309 decimal digits.
3.
Integer Factorization Problem
Securityof RSA algorithm is based upon the difficulty of Integer Factorization Problem.
It is a one-way trapdoor function.
● Computing product of two primes are easier. n = p ✖ q
● Computing decryption constant d, given {e, n, p, q} is easier.
● But computing d, given {e, n} is infeasible.
○ Because factoring n is difficult
4.
Algorithm Description
● Plaintextblock - M, Ciphertext block - C
● C = Me
mod n
M = Cd
mod n = (Me
)d
mod n = Med
mod n
● Both sender and receiver must know the value of n.
● Sender knows the value of e and only receiver knows the value of d.
● Public Key PU = {e, n}
Private Key PR = {d, n}
5.
Algorithm Description
For thisalgorithm 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 Me
mod n and Cd
mod n for all values of M < n.
3. It is infeasible to determine d given e and n.
RSA Algorithm
User B(Receiver):
1. Select p,q
2. Calculate n = p * q
3. Calculate ɸ(n) = (p - 1)(q - 1)
4. Select integer e,
5.Calculate
d d Public key
Private key
p and q both prime, p ≠ q
gcd (ɸ(n), e) = 1; 1 < e < ɸ(n)
d ≡ e-1
mod ɸ(n)
PU = {e, n}
PR = {d, n}
8.
RSA Algorithm
Encryption byUser A (Sender) with User B’s Public Key:
Plaintext:
Ciphertext:
M < n
C = Me
mod n
Decryption by User B (Receiver) with User B’s Private Key:
Ciphertext:
Plaintext:
C
M = Cd
mod n
9.
Encryption Example
Given: p=3,q=11, e=7, M=5
Encryption:
C = Me
mod n
n = p ✕ q = 3 ✕ 11 = 33
C = 57
mod 33
56
≡ 676 ≡ 16 mod 33
57
≡ 16.5 ≡ 80 ≡ 14 mod
33
C = 14
10.
Decryption Example
M =Cd
mod n
ɸ(n) = (p - 1)(q - 1) = 2.10 = 20
d ≡ e-1
mod ɸ(n) => d ≡ 7-
1
M = 143
mod 33
142
= 196 ≡ 31 mod 33
143
≡ 31.14 ≡ 434 ≡ 5 mod 33
mod 20 => d=3
M = 5
11.
Explain RSA algorithm,perform encryption
and decryption to the system with p=7,
q=11, e=17, M=8