11
CSC 386 – Computer Security Scott Heggen

CSC 386 – Computer Security

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

Page 1: CSC 386 – Computer Security

CSC 386 – Computer Security

Scott Heggen

Page 2: CSC 386 – Computer Security

Agenda

• Exploring that locked box thing from Friday?

Page 3: CSC 386 – Computer Security

 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

Page 4: CSC 386 – Computer Security

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 • …

Page 5: CSC 386 – Computer Security

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!

Page 6: CSC 386 – Computer Security

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

Page 7: CSC 386 – Computer Security

RSA

Alice Bob

C

Eve

Public key (e): (7, 33)

Private key (d): (3, 33)

Page 8: CSC 386 – Computer Security

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

Page 9: CSC 386 – Computer Security

RSA

Alice Bob

C

Eve

Public key (e): (7, 33)

Private key (d): (3, 33)

Eve knows:C = 1, 29, 9e = (7, 33)

Page 10: CSC 386 – Computer Security

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)

Page 11: CSC 386 – Computer Security

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