Uploaded by Uyab Ndon

FermatEuler RSA

advertisement
FIT5163 #LN05 APPLICATION OF FERMAT’S & EULER’S THEOREMS TO RSA 1. Fermat’s Theorem
a. If n is a prime number and a is a positive integer and a and n are
relatively prime, then
a n −1 = 1(mod n) €
Equation 1
b. An alternative form of Fermat’s theorem is also useful:
If n is a prime number and a is a positive integer, then
Equation 2
a n = a(mod n) This is also known as Fermat’s little theorem.
€
2. Euler’s Theorem:
a. Euler’s theorem states that for every a and n that are relatively prime,
with Φ(n), the Euler’s Toient of n, then :
aφ (n ) ≡ 1(mod n) €
Equation 3
b. As is the case for Fermat’s theorem, an alternative form of the theorem
is also useful:
aφ (n )÷1 ≡ a(mod n) Equation 4
Again similar to Equation 2 of Fermat’s little theorem, Equation 3
requires a to be relatively prime to n, this form in Equation 4 does not.
€
3. Application to RSA :
a. If p, q are prime numbers, the Euler’s Totient, φ (n), φ (n) = ( p −1)(q −1)
where n=p.q €
Equation 5
€
b. If e and d are multiplicative inverses modulo φ (n),
Equation 6
ed mod φ (n) ≡ 1 €
€
Page 1 of 3 FIT5163 #LN05 Another way to state this is:
Equation 7
ed = kφ (n) +1 €
c. Given primes p and q with n = pq and a message block M< n, e and d
are chosen to be multiplicative inverse modulo φ (n), as per in
Equation 6 and 7, we can say that,
M ed mod n = M kφ (n )+1 mod n
= M k( p −1)(q −1)+1 mod n
Equation 8
€
First we shall show that:
€
M k( p −1)(q −1)+1 mod p = M mod p
Case 1: M and p are not relatively prime; that is p divides M. In this
case, M mod p = 0 and there fore,
€
€
€
Equation 9
M k( p −1)(q −1)+1 mod p = 0
Equation 10
Thus
M k( p −1)(q −1)+1 mod p = M mod p;
Equation 11
Case 2: M and p are relatively prime, by Euler’s Theorem, Equation 3
above, M φ ( p ) mod p = 1;
€
We proceed as follows:
€ M k( p −1)(q −1)+1 mod p = [(M)M ( p −1)k(q −1) ]mod p
= [(M)(M ( p −1) ) k(q −1) ]mod p
= [(M)(M φ ( p ) ) k(q −1) ]mod p
= (M mod p) × [(M φ ( p ) )mod p]k(q −1)
Equation 12
= (M mod p) × (1) k(q −1) (byEuler' sTheorem)
= M mod p
We now observe that
€
[M k( p −1)(q −1)+1 − M]mod p = [M k( p −1)(q −1)+1 mod p] − [M mod p] = 0
Equation 13
€
Page 2 of 3 FIT5163 #LN05 Thus p divides [M k( p −1)(q −1)+1 − M] . By the same reasoning we can
show that q divides [M k( p −1)(q −1)+1 − M] . Because p and q are distinct
primes, there must exist an integer r that satisfies
−1)(q −1)+1
− M] = ( pq)r = nr
[M k( p €
€
Equation 14
There fore, n divides [M k( p −1)(q −1)+1 − M] , and so,
€
M kφ (n )+1 mod n = M k( p −1)(q −1)+1 mod n = M
€ M < n.
for any message
€
Page 3 of 3 Equation 15
Download