david evans cs.virginia/evans

44
David Evans http://www.cs.virginia.edu/ evans CS150: Computer Science University of Virginia Computer Science Class 36: Public Key Crypto

Upload: griffin-parrish

Post on 01-Jan-2016

12 views

Category:

Documents


1 download

DESCRIPTION

Class 36: Public Key Crypto. David Evans http://www.cs.virginia.edu/evans. CS150: Computer Science University of Virginia Computer Science. Eve. Login Process. Terminal. Login: alyssa Password: fido. Trusted Subsystem. login sends . Password Problems. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: David Evans cs.virginia/evans

David Evanshttp://www.cs.virginia.edu/evans

CS150: Computer ScienceUniversity of VirginiaComputer Science

Class 36:Public Key Crypto

Page 2: David Evans cs.virginia/evans

2CS150 Fall 2005: Lecture 36: Public Key Cryptography

Login: alyssaPassword: fido

Terminal

Trusted Subsystem

Eve

Login Process

login sends <“alyssa”, “fido”>

Page 3: David Evans cs.virginia/evans

3CS150 Fall 2005: Lecture 36: Public Key Cryptography

Password Problems

• Need to store the passwords– Dangerous to rely on database

being secure

• Need to transmit password from user to host– Dangerous to rely on Internet being

confidential

Lecture 31, Recap Now

Today

Page 4: David Evans cs.virginia/evans

4CS150 Fall 2005: Lecture 36: Public Key Cryptography

Hashed Passwords

UserID Password

alyssa f (“fido”)

ben f (“schemer”)

dave f (“Lx.Ly.x”)

Page 5: David Evans cs.virginia/evans

5CS150 Fall 2005: Lecture 36: Public Key Cryptography

Dictionary Attacks

• Try a list of common passwords– All 1-4 letter words– List of common (dog) names– Words from dictionary– Phone numbers, license plates– All of the above in reverse

• Simple dictionary attacks retrieve most user-selected passwords

• Precompute H(x) for all dictionary entries

Page 6: David Evans cs.virginia/evans

6CS150 Fall 2005: Lecture 36: Public Key Cryptography

(at least) 86% of users are dumb and dumber

Single ASCII character 0.5%

Two characters 2%

Three characters 14%

Four alphabetic letters 14%

Five same-case letters 21%

Six lowercase letters 18%

Words in dictionaries or names 15%

Other (possibly good passwords)

14%

(Morris/Thompson 79)

Page 7: David Evans cs.virginia/evans

7CS150 Fall 2005: Lecture 36: Public Key Cryptography

Salt of the Earth

UserID Salt Password

alyssa 1125

crypt (“Lx.Ly.x”, 1125)

ben 2437

crypt (“schemer”, 2437)

dave 932 crypt (“Lx.Ly.x”, 932)How much harder is the off-line dictionary attack?

In HooRides.net we use the user name as the salt.Is this better or worse?

Salt: 12 random bits

Page 8: David Evans cs.virginia/evans

8CS150 Fall 2005: Lecture 36: Public Key Cryptography

Sending Passwords

Encrypt

User Server

The InternetThe Internet

Page 9: David Evans cs.virginia/evans

9CS150 Fall 2005: Lecture 36: Public Key Cryptography

Encrypt DecryptPlaintext

Ciphertext

Plaintext

User ServerC = EncryptK (P)P = DecryptK (C)

K K

The InternetThe Internet

Page 10: David Evans cs.virginia/evans

10CS150 Fall 2005: Lecture 36: Public Key Cryptography

From http://www.codesandciphers.org.uk/lorenz/fish.htm

PS4: Lorenz Cipher

Page 11: David Evans cs.virginia/evans

11CS150 Fall 2005: Lecture 36: Public Key Cryptography

Modern Symmetric Ciphers A billion billion is a large number, but it's

not that large a number. Whitfield Diffie

• Same idea but:– Use digital logic instead of mechanical

rotors– Larger keys (random bits, not rotor

alignments)•PS4 = 53; Lorenz 512 < 109

•Modern 128 bits > 1037

– Encrypt blocks of letters at a time

Page 12: David Evans cs.virginia/evans

12CS150 Fall 2005: Lecture 36: Public Key Cryptography

Modern Ciphers

• AES (Rijndael) successor to DES selected 2001

• 128-bit keys, encrypt 128-bit blocks• Brute force attack (around 1030 times

harder than Lorenz)– Try 1 Trillion keys per second– Would take 10790283070806000000 years to

try all keys! – If that’s not enough, can use 256-bit key

• No known techniques that do better than brute force search

Page 13: David Evans cs.virginia/evans

13CS150 Fall 2005: Lecture 36: Public Key Cryptography

Encrypt DecryptPlaintext

Ciphertext

Plaintext

User Server

K K

The InternetThe Internet

How do User and Server agree on K (without sending it over the Internet)?

Page 14: David Evans cs.virginia/evans

14CS150 Fall 2005: Lecture 36: Public Key Cryptography

Key Agreement Demo

(Animated version atend of slides.)

Page 15: David Evans cs.virginia/evans

15CS150 Fall 2005: Lecture 36: Public Key Cryptography

Asymmetric Cryptosystems

• Need a hard problem (like symmetric cryptosystems)

• With a trap door: if you know a secret, the hard problem becomes easy

Page 16: David Evans cs.virginia/evans

16CS150 Fall 2005: Lecture 36: Public Key Cryptography

One-Way Functions• Easy to compute, hard to invert• Trap-door one way function:

– D (E (M)) = M– E and D are easy to compute.– Revealing E doesn’t reveal an easy way

to compute D.– Hence, anyone who knows E can encrypt,

but only someone who knows D can decrypt

Page 17: David Evans cs.virginia/evans

17CS150 Fall 2005: Lecture 36: Public Key Cryptography

RSA [Rivest, Shamir, Adelman 78]

One-way function: multiplication is easy, factoring is hard

Trap-door: number theory (Euler and Fermat)

Page 18: David Evans cs.virginia/evans

18CS150 Fall 2005: Lecture 36: Public Key Cryptography

Security of RSA• n is public, but not p and q where n =

pq

• How much work is factoring n?

n ~200 digits – would take quintillions of years

Number Field Sieve (fastest known factoring algorithm) is:

O(e1.9223((ln (n))1/3 (ln (ln (n)))2/3)The movie Sneakers is about what happens if someone discovers a O(nk) factoring algorithm.

Page 19: David Evans cs.virginia/evans

19CS150 Fall 2005: Lecture 36: Public Key Cryptography

Asymmetric Cryptosystems

• Encryption and Decryption are done with different keys

• Keep one of the keys secret, reveal the other

EKRA (EKUA (M)) = MAlice’s Public Key: KUA

Alice’s Private Key: KRA

Only KRA can decrypta message encryptedusing KUA.

Page 20: David Evans cs.virginia/evans

20CS150 Fall 2005: Lecture 36: Public Key Cryptography

Public-Key Applications: Privacy

• Alice encrypts message to Bob using Bob’s Private Key

• Only Bob knows Bob’s Private Key

only Bob can decrypt message

Encrypt DecryptPlaintextCiphertext

Plaintext

Alice Bob

Bob’s Public Key Bob’s Private Key

Page 21: David Evans cs.virginia/evans

21CS150 Fall 2005: Lecture 36: Public Key Cryptography

Signatures

• Bob knows it was from Alice, since only Alice knows Alice’s Private Key

• Non-repudiation: Alice can’t deny signing message (except by claiming her key was stolen!)

• Integrity: Bob can’t change message (doesn’t know Alice’s Private Key)

Encrypt DecryptPlaintext

SignedMessage

Plaintext

AliceBob

Alice’s Private Key Alice’s Public Key

Page 22: David Evans cs.virginia/evans

22CS150 Fall 2005: Lecture 36: Public Key Cryptography

Encrypt DecryptPlaintext

Ciphertext

Plaintext

User Server

KUS KRS

The InternetThe Internet

Public Key Private Key

How does User know the public key to use?

Page 23: David Evans cs.virginia/evans

23CS150 Fall 2005: Lecture 36: Public Key Cryptography

Key Management

Page 24: David Evans cs.virginia/evans

24CS150 Fall 2005: Lecture 36: Public Key Cryptography

Approach 1: Meet Secretly

• User and Server Operator meet secretly and swap public keys– If you can do that, might as well agree

on a secret (symmetric key) instead– Doesn’t work for Internet transactions

Page 25: David Evans cs.virginia/evans

25CS150 Fall 2005: Lecture 36: Public Key Cryptography

Approach 2: Public Announcement

• Publish public keys in a public forum– Append to email messages– Post on web site– New York Time classifieds

• Easy for rogue to pretend to be someone else– Forge email, alter web site, lie to New

York Times

Page 26: David Evans cs.virginia/evans

26CS150 Fall 2005: Lecture 36: Public Key Cryptography

Approach 3: Public Directory

• Trusted authority maintains directory mapping names to public keys

• Entities register public keys with authority in some secure way

• Authority publishes directory– Print using watermarked paper, special

fonts, etc.– Allow secure electronic access

• Depends on secure distribution of directory’s key

Page 27: David Evans cs.virginia/evans

27CS150 Fall 2005: Lecture 36: Public Key Cryptography

Approach 4: Certificates

VeriSign

User Server

KUS

CS = EKRVeriSign[“Server”, KUS]

CS

Request

$$$$

EKUVeriSign (CS) = [“Server”, KUS] Knows KRS

Page 28: David Evans cs.virginia/evans

28CS150 Fall 2005: Lecture 36: Public Key Cryptography

SSL (Secure Sockets Layer)

Browser ServerHello

KRCA[Server Identity, KUS]

Check Certificate

using KUCA Pick random K

KUS[K]Find K using KRS

Secure channel using K

Note: This is slightly simplified from the actual SSL protocol. This versionis vulnerable to a person-in-the-middle attack!

Page 29: David Evans cs.virginia/evans

29CS150 Fall 2005: Lecture 36: Public Key Cryptography

Data encrypted using secret key exchanged using some public keyassociated with some certificate.

Page 30: David Evans cs.virginia/evans

30CS150 Fall 2005: Lecture 36: Public Key Cryptography

Page 31: David Evans cs.virginia/evans

31CS150 Fall 2005: Lecture 36: Public Key Cryptography

Page 32: David Evans cs.virginia/evans

32CS150 Fall 2005: Lecture 36: Public Key Cryptography

Page 33: David Evans cs.virginia/evans

33CS150 Fall 2005: Lecture 36: Public Key Cryptography

How do you make yourweb site password form

encrypt its input?

http:// https://

Page 34: David Evans cs.virginia/evans

34CS150 Fall 2005: Lecture 36: Public Key Cryptography

Exam 2: Requested TopicsTopic Average <=3 <=1

Biology (Monday’s class) 4.130435 13 4

Finding Aliens 4.347826 10 3

How Google Works 2.695652 17 11

Hardware 4.869565 9 2

Implementing Interpreter 7.217391 1 0

Software Security 6.434783 1 0

Languages & Complexity 7.565217 3 1

Testing 6.409091 2 0

Viruses and Worms 4.782609 8 0

Complex Language 5.681818 7 1

The 2 classes after Thanksgiving will be about Google

Manuvir Das’ talk today at 3:30 (Olsson 009) will include these topics (how Microsoft makes software more reliably)

Friday’s class will be on this (as well as on finding prime factors)

Page 35: David Evans cs.virginia/evans

35CS150 Fall 2005: Lecture 36: Public Key Cryptography

Charge

• Project Meetings today, tomorrow and Friday

• Exam 2: return now– Comments will be posted on web site

tonight

Page 36: David Evans cs.virginia/evans

36CS150 Fall 2005: Lecture 36: Public Key Cryptography

Animated version of Asymmetric Cryptography

Demo

Page 37: David Evans cs.virginia/evans

37CS150 Fall 2005: Lecture 36: Public Key Cryptography

Padlocked Boxes

Alice

Hi!

Page 38: David Evans cs.virginia/evans

38CS150 Fall 2005: Lecture 36: Public Key Cryptography

Padlocked Boxes

Alice Hi!

Alice’s Padlock

Alice’s Padlock Key

Page 39: David Evans cs.virginia/evans

39CS150 Fall 2005: Lecture 36: Public Key Cryptography

Padlocked Boxes

Alice

Alice’s Padlock Key

Shady Sammy’s

Slimy Shipping Service

Page 40: David Evans cs.virginia/evans

40CS150 Fall 2005: Lecture 36: Public Key Cryptography

Padlocked Boxes

Alice

Hi!

Bob

Bob’s Padlock

Bob’s Padlock KeyAlice’s Padlock Key

Page 41: David Evans cs.virginia/evans

41CS150 Fall 2005: Lecture 36: Public Key Cryptography

Padlocked Boxes

Alice

Hi!

Bob

Bob’s Padlock KeyAlice’s Padlock Key

Page 42: David Evans cs.virginia/evans

42CS150 Fall 2005: Lecture 36: Public Key Cryptography

Padlocked Boxes

Alice

Hi!

Bob

Bob’s Padlock KeyAlice’s Padlock Key

Page 43: David Evans cs.virginia/evans

43CS150 Fall 2005: Lecture 36: Public Key Cryptography

Padlocked Boxes

Alice

Hi!

Bob

Bob’s Padlock Key

Page 44: David Evans cs.virginia/evans

44CS150 Fall 2005: Lecture 36: Public Key Cryptography

Padlocked Boxes

Alice

Hi!

Bob

Bob’s Padlock Key

Hi!