Escolar Documentos
Profissional Documentos
Cultura Documentos
and RSA
RSA
by Rivest, Shamir & Adleman of MIT in 1977
best known & widely used public-key scheme
based on exponentiation in a finite (Galois) field
) operations (hard)
note (N)=(p-1)(q-1)
RSA Use
to encrypt a message M the sender:
where gcd(a,N)=1
in RSA have:
N=p.q
(N)=(p-1)(q-1)
RSA
Uses Modular
Arithmetic Extensively
Modulo 7 Example
...
-21 -20 -19 -18 -17 -16 -15
-14 -13 -12 -11 -10 -9 -8
-7 -6 -5 -4 -3 -2 -1
0
1
2
3
4
5
6
7
8
9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 32 33 34
...
Modular Arithmetic
can do modular arithmetic with any group of
integers:
Zn = {0, 1, , n-1}
eg GCD(60,24) = 12
A=a, B=b
while B>0
R = A mod B
A = B, B = R
return A
Example GCD(1970,1066)
1970 = 1 x 1066 + 904
gcd(1066, 904)
1066 = 1 x 904 + 162 gcd(904, 162)
904 = 5 x 162 + 94
gcd(162, 94)
162 = 1 x 94 + 68
gcd(94, 68)
94 = 1 x 68 + 26
gcd(68, 26)
68 = 2 x 26 + 16
gcd(26, 16)
26 = 1 x 16 + 10
gcd(16, 10)
16 = 1 x 10 + 6
gcd(10, 6)
10 = 1 x 6 + 4
gcd(6, 4)
6 = 1 x 4 + 2
gcd(4, 2)
4 = 2 x 2 + 0
gcd(2, 0)
RSA Example
1.
2.
Compute n = pq =1711=187
3.
Compute (n)=(p1)(q-1)=1610=160
4.
5.
6.
7.
Exponentiation
can use the Square and Multiply Algorithm
a fast, efficient algorithm for exponentiation
concept is based on repeatedly squaring base
and multiplying in the ones that are needed to
887mod187
= (884mod187 X 882mod187 X
881mod187)mod187
881mod187=88
882mod187=7744mod 187=77
884mod187=59,969,536mod187=132
887mod187=(88X77X132)mod187=894,432mod1
87=11
19
RSA Crptography
Multiplicative Inverses
Theorem. A number e has a multiplicative
unique.
Further, there is an efficient algorithm to test
RSA Crptography
20
21
ap-1 = 1 (mod p )
RSA Crptography
Eulers theorem
22
aPhi(n) = 1
(mod n)
RSA Crptography
23
RSA Crptography
Select p,q
p and q both prime
Calculate n = p x q
Calculate (n) ( p 1)(q 1)
gcd( (n), e) 1; 1 e (n)
Select integer e
1
d e mod (n)
Calculate d
Public Key
KU = {e,n}
Private key
KR = {d,n}
24
modulus N=p.q
Plaintext: Divya
Encrypted Text:
JN1P1i3uIdMApN6SuLMHHEm0eYs3hG/7w/rknanz
xFQ+2KSTYagEwisIEZmCXGlylpFzGO4lvrYOMbL
wX6E3AXTOG4Elhx8VDnp54at0TmKTxvbEBzBr7
ToDmngBOFWEOdaGkHfdYQBlZ4w6L8KjRWj59Ie
M8b2M7xD0JOVmX00=
Example
Choose 11 and 13
Calculate n = 11*13 = 143
Let e = 7.
(mod
153) =47
The plaintext is 47103 (mod
143) =5
RSA
Crpto
Is RSA secure?
The security of the RSA cryptosystem depends on
the difficulty of factoring n.
It is currently difficult to obtain the private key d from
the public key (n, e). However if one could factor n
into p and q, then one could obtain the private key d.
Thus the security of the RSA system is based on the
assumption that factoring is difficult.
The discovery of an easy method of factoring would
"break" RSA .
RSA Crptography
29
30
Factoring n
Computing Phi(n)
Compute d given e and n
Still need to know n or Phi(n)
Computing e-th roots modulo n
(C= Me (mod n); then M= C1/e (mod n))
It is computationally intractable
RSA Crptography
9.6 108
200
3.3 1012
38 days
300
1.3 1015
41 years
400
1.7 1017
5313
years
500
1.1 1019
3.5 105
years
1024
1.3 1026
4.2 1012
years
RSA Crptography
16 minutes
31
RSA Security
three approaches to attacking RSA:
brute force key search (infeasible given size of
numbers)
mathematical attacks (based on difficulty of
computing (N), by factoring modulus N)
timing attacks (on running of decryption)
Timing Attacks
developed in mid-1990s
exploit timing variations in operations
Exercises
EX-1
Perform encryption ad decryption using RSA:
P=3; Q=11, E=7, M=5
P=5, Q=11, E=3; M=9
P=7, Q=11, E=17, M=8
EX-2
In a RSA system public key to the user is e=31,
n=3599, what is the private key used by the
user?
Summary
have considered:
principles of public-key cryptography
RSA algorithm, implementation, security