diffie-hellman key exchange

Post on 22-Feb-2016

189 Views

Category:

Documents

5 Downloads

Preview:

Click to see full reader

DESCRIPTION

Diffie-Hellman Key Exchange. CSIS 5857: Encoding and Encryption. Diffie-Hellman Key Exchange. Common goal of public key encryption: Securely agree upon a symmetric key Bob generates symmetric key K S Encrypts with Alice’s public key K A PU and sends to Alice - PowerPoint PPT Presentation

TRANSCRIPT

Diffie-Hellman Key Exchange

CSCI 5857: Encoding and Encryption

Outline

• Key exchange without public/private keys• Public and private components of Diffie-Hellman• Secure information exchange in Diffie-Hellman• Underlying mathematics• Man-in-the-middle attack• Station-to-station key exchange

Diffie-Hellman Key Exchange

• Common goal of public key encryption:Securely agree upon a symmetric key– Bob generates symmetric key KS

– Encrypts with Alice’s public key KAPU and sends to Alice

– Alice decrypts with her private key KAPR

– Then use KS to exchange information (using AES, 3DES, etc.)

• Problem: What if neither Alice or Bob have a public key?

• Diffie-Hellman key exchange (1976 – precedes RSA)– Allows two people to securely generate a symmetric key

without a preexisting public key– Based on modular logarithms

Secure Key Generation• Alice, Bob exchange data to securely generate a value

– Data transmitted doesn’t allow others to find that value• That value used as symmetric key to send further

information

generator

PE DPEsymmetric (P, kS)

generator

Public info Public infoPrivate info Private info

Public and Private Information• Public information (known to Alice, Bob, and everyone):

– p: large prime number (at least 1024 bits)– g: Primitive root “generator” (g < p)

• Private information– x: random number created (and only known) by Alice – y: random number created (and only known) by Bob– x and y used to generate shared key k

5

Knows p, gGenerates x

Knows p, gGenerates y

Key Generation

• Alice computes R1 = gx mod p• Bob computes R2 = gy mod p• Alice sends R1 to Bob• Bob sends R2 to Alice

6

Security of Key Generation

• Darth cannot derive x from R1 or y from R2

• Would have to solve modular logarithm problem– x = logg (R1 mod p)– y = logg (R2 mod p)

7

Key Computation

• Alice computes k = R2 x

mod p • Bob computes k = R1

y mod p

• Alice, Bob now have shared key k – Nobody else can compute without knowing x or y– No secret information transmitted!

8

Diffie-Hellman Mathematics

• Alice’s POV: k = R2 x

mod p = (gy mod p)x mod p = gyx mod p

• Bob’s POV: k = R1 y

mod p = (gx mod p)y mod p = gxy mod p

• gyx mod p = gxy mod p = k 9

Diffie-Hellman Example

10

Public key: g = 7, p = 23

Chooses x = 3R1 = 73 mod 23 = 21

Chooses y = 6R2 = 76 mod 23 = 4

214

K = 43 mod 23 = 18 K = 216 mod 23 = 18

Man-in-the-Middle Attack• Most serious weakness in Diffie-Hellman• Assumes Darth has ability to:

– Intercept messages between Alice and Bob– Masquerade as Alice or Bob to send messages to

the other

11

“I am Alice”“I am Bob”

Man-in-the-Middle Attack• Darth generates own random value z• Computes own R3

= gz mod p from public values of p, g

• Goal: Trick Alice and Bob into using keys he has created from z

12

Man-in-the-Middle Attack

13

• Darth intercepts R1 sent by Alice and R2 sent by Bob

• Computes kAlice = R1

z mod p

• Computes kBob = R2 z mod p

R1 R2

x z R3 kAlice kBob

y

Man-in-the-Middle Attack

• Darth sends R3 to Alice posing as Bob• Darth sends R3 to Bob posing as Alice

• Alice computes kAlice = R3 x

mod p• Bob computes kBob = R3

y mod p

14

R3 R3

kAlice kBobkAlicekBob

Man-in-the-Middle Attack• Darth can read messages sent by Alice and Bob!• Example: Message sent from Alice to Bob

– Alice encrypts with kAlice believing it is secure– Darth intercepts and decrypts with kAlice – Re-encrypts with kBob and sends to Bob (posing as Alice

15

C = E(P, kAlice) C = E(P, kBob)

P = D(C, kAlice)

Station-to-Station Key Agreement• Participants in Diffie-Hellman must authenticate their

identities– Only solution to Man-in-the-Middle attack

• Authentication usually based on certificates– Signed by trusted authorities– Contain public keys for participants

16

Station-to-Station Key Agreement

17

top related