160 likes | 321 Views
B. A. C. E. D. # Symmetric Keys = n*(n-1)/2. # Public/Private Keys = 2 n. RSA. Chose two random large prime numbers p & q (of equal length is best) Compute their product n = pq Randomly choose an encryption key e : e and ( (p-1)(q-1)) are relatively prime (gcd=1)
E N D
B A C E D # Symmetric Keys = n*(n-1)/2 # Public/Private Keys = 2n
RSA • Chose two random large prime numbers p & q (of equal length is best) • Compute their product n = pq • Randomly choose an encryption key e :e and ((p-1)(q-1)) are relatively prime (gcd=1) • Calculate the decryption key d :ed = 1 mod ((p-1)(q-1)) ord = e-1 mod ((p-1)(q-1))
RSA encryption Split up the message into blocks less than n ci = mie mod n Decryption is similar di = cid mod n
RSA Example (Schneier) p:=47; q:=71; n:=p*q; (3337) phi=(p-1)(q-1); (3220) Choose e : gcd(e,phi)=1;e:=79; We want ed:= 1 mod phi Solving for d:= e-1 mod phi or d:=79-1 mod 3220 = 1019 e n are the public key, and d is the private key
RSA Example (cont) • Encrypt m=6882326879666683 • Break it up into blocks688 232 687 966 668 003 m1 m2 m3 m4 m5 m6 • Encrypt:68879 mod 3337 = 1570 = c1 • Decrypt:15701019 mod 3337 = 688 = m1
Maple code for RSA example • p:=47; q:=71; n:=p*q; • phi:=(p-1)*(q-1); • e:=79; • gcd(e,phi); • d:=e^(-1) mod phi; • 688^e mod n; • 1570^d mod n;