Upload
kai-hunt
View
14
Download
0
Embed Size (px)
DESCRIPTION
CSC 386 – Computer Security. Scott Heggen. Agenda. Exploring that locked box thing from Friday?. Rivest , Shamar, and Adleman (RSA). A public key encryption method Based on the fact that computers have trouble factoring large prime numbers - PowerPoint PPT Presentation
Citation preview
CSC 386 – Computer Security
Scott Heggen
Agenda
• Exploring that locked box thing from Friday?
Rivest, Shamar, and Adleman (RSA)
• A public key encryption method• Based on the fact that computers have trouble factoring large prime
numbers• Used extensively in many systems and protocols, such as SSH
RSA
• Step 1:• Convert your text to numerical values.• Usually this step is inherent, as everything is already represented as a number
• For this example, we will simplify things by assuming• A = 1• B = 2• C = 3 • …
RSA
• Step 2:• Generate a pair of keys:
• Pick 2 very large random numbers• p = 3• q = 11
• Compute the product:• n = 3 x 11 = 33
• φ(n) = (p-1) × (q-1) = 2 × 10 = 20• Select a number less than φ(n), and relatively prime (few factors)
• e = 7
With very large values of p and q, n is extremely difficult for a computer to
reverse!
Public key!
RSA
• Compute the matching private key d, as the inverse of e mod φ(n):• d = inv of e mod φ(n) = inv(7) mod 20 = 3
• 7 x 1 mod 20 = 7• 7 x 2 mod 20 = 14• 7 x 3 mod 20 = 1
• Public key (e): (7, 33)• Private key (d): (3, 33)
p = 3q = 11
φ(n) = 20n = 33
e = 7
In other words:
7 x ? mod 20 = 1
RSA
Alice Bob
C
Eve
Public key (e): (7, 33)
Private key (d): (3, 33)
RSA
• Step 3 (Alice)• Encrypt your message using the public key (e)
• C = mkey mod n
• For A:• CA = 17 mod 33 = 1
• For B:• CB = 27 mod 33 = 29
• For C:• Cc = 37 mod 33 = 9
p = 3q = 11
φ(n) = 20n = 33
e = 7d = 3
m = “abc” = 123
C = 1, 29, 9
RSA
Alice Bob
C
Eve
Public key (e): (7, 33)
Private key (d): (3, 33)
Eve knows:C = 1, 29, 9e = (7, 33)
RSA
• Step 4 (Bob)• Decrypt the cipher using the private key (d)
• m = Ckey mod n
• For A:• mA = 13 mod 33 = 1
• For B:• mB = 293 mod 33 = 2
• For A:• mC = 93 mod 33 = 3
p = 3q = 11n = 33
φ(n) = 20e = 7d = 3C = 1, 29, 9
Eve knows:C = 1, 29, 9e = (7, 33)
Next Class
• Quiz on RSA
• Be able to encrypt a message given a public key
• Be able to decrypt a message given a private key