Presentation is loading. Please wait.

Presentation is loading. Please wait.

RSA Encryption William Lu. RSA Background  Basic technique first discovered in 1973 by Clifford Cocks of CESG (part of British GCHQ)  Invented in 1977.

Similar presentations


Presentation on theme: "RSA Encryption William Lu. RSA Background  Basic technique first discovered in 1973 by Clifford Cocks of CESG (part of British GCHQ)  Invented in 1977."— Presentation transcript:

1 RSA Encryption William Lu

2 RSA Background  Basic technique first discovered in 1973 by Clifford Cocks of CESG (part of British GCHQ)  Invented in 1977 by Ron Rivest, Adi Shamir and Len Adleman

3 RSA Uses  Public key encryption  Digital signatures

4 RSA Algorithm  Generate two large random primes, p and q, of approximately the same size –e.g. for 1024 bit encryption, p and q should be about 512 bits each  Compute n = pq and φ = (p-1)(q-1)  Choose e where 1<e<φ such that gcd(e,φ) = 1  Compute d where 1<d<φ such that ed = 1 mod φ

5 RSA Algorithm  Public key = (e,n)  Private key = (d,n)

6 Generate Primes  Get a pseudo random number  Use Fermat’s Little Theorem to test for prime –For prime n and any a, a n mod n = a –For composite n and any a, a n mod n ≠ a –BUT –If a n mod n = a, n could be a composite

7 Generate Primes  Does Fermat’s Little Theorem guarantee primes? –NO!  What is it for? –With enough rounds, n is probably prime –Much faster then testing with all primes < n

8 Generate Exponents e and d  For public exponent, e, pick any prime –Common choices are 3, 17 and 65537 (2 16 + 1)  For secret exponent, d, compute the modular inverse of e mod φ –Use Extended Euclidean Algorithm

9 Extended Euclidean Algorithm  To find inverse of e mod n: –Find quotient and remainder of n/e at each step –Also carry an auxiliary number u i = u i-2 – u i-1 q i-2 mod n –Initialize u 0 = 0 and u 1 = 1 –For each step use the previous e as the current n and the previous remainder as the current e –Repeat until e = 0 and the auxiliary number is the inverse of e mod n

10 Extended Euclidean Algorithm nequotientremainderauxiliary 7251420 52211 212058 1029 Inverse of 5 mod 72

11 Encryption/Decryption  To encrypt message m –Public key = (e,n) –c = m e mod n  To decrypt cipher c –Private key = (d,n) –m = c d mod n

12 Encryption/Decryption  Public key = (5,91)  Private key = (29,91)  To encrypt message 17 –c = 17 5 mod 91 –c = 75  To decrypt cipher 75 –m = 75 29 mod 91 –m = 17

13 Signature  To sign message m –Private key = (d,n) –[m] = m d mod n  To verify signature –Public key = (e,n) –{m} = m e mod n

14 References  RSA Algorithm –DI Management Services  Fermat’s Little Theorem –Mathworld  Extended Euclidean Algorithm –Wolfgang Stöcher at Profactor Research –Bill Cherowitzo’s references at the University of Colorado at Denver Ph. D (1983) in mathematics at Columbia University


Download ppt "RSA Encryption William Lu. RSA Background  Basic technique first discovered in 1973 by Clifford Cocks of CESG (part of British GCHQ)  Invented in 1977."

Similar presentations


Ads by Google