Top Banner
Hashing Sandy Kutin CSPP 532 7/10/01
27

Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Hashing

Sandy KutinCSPP 5327/10/01

Page 2: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Cryptographic Protocols

What is a cryptographic protocol?Example: Alice sends Bob a message M

1. Alice generates a secret key K 2. Alice computes C1 = Ep

B(K)

3. Alice computes C2 = EsK(M)

4. Alice sends Bob C1, C2

5. Bob computes K = Dpb(C1)

6. Bob computes M = DsK(C2)

Ep, Dp public-key; Es, Ds symmetric. Why?

Page 3: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

A sample protocol

1. Alice generates K

2. Alice: C1 = EpB(K)

3. Alice: C2 = EsK(M)

4. Alice sends Bob C1,C2

5. Bob: K = Dpb(C1)

6. Bob: M = DsK(C2)

Alice:

Bob:

K Ep C1

B

M Es C2

K

C1 Dp K

b

C2 Ds M

K

Page 4: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Cryptographic Primitives

How do we pick K? (pseudo-random number generator)

What are Ep, Dp? (e.g., RSA)

What are Es, Ds? (e.g., DES or AES, ECB or CBC mode)

Alice:

Bob:

K Ep C1

B

M Es C2

K

C1 Dp K

b

C2 Ds M

K

Page 5: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Implementation

Where does Alice store K?

How does Alice acquire Bob’s B?

How is the message sent?

Where does Bob store K, b, M?

Alice:

Bob:

K Ep C1

B

M Es C2

K

C1 Dp K

b

C2 Ds M

K

Page 6: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Overall Plan

Before the break: mathAfter the break:

Primitives Protocols Implementation issues Specific products

Page 7: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Old School: Authentic

Confidentiality: Eve can’t recover M

Authentication: only Alice, Bob know K, so Bob knows Alice sent M

Someone could tamper with order; solve this with time stamps and sequencing info

Alice:

Bob:

M Es C

K

C Ds M

K

Alice and Bob sharea secret key K

Page 8: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

New Wave: Not Authentic

Confidentiality: Eve can’t recover M

No authentication: how does Bob know who sent the message?

Same problems of tampering with order

Alice:

Bob:

K Ep C1

B

M Es C2

K

C1 Dp K

b

C2 Ds M

K

Page 9: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Solution #1: E(D(M))

Alice “signs” message with her private key

Bob “decrypts” S with Alice’s public key

Only Alice could have signed M

Communication is authenticated

Too slow

Alice:

Bob:

K Ep C1

B

M Dp S

a

S Ep M

A

C2 Ds

K

S Es C2

K

Page 10: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Solution #2: D(E(M))

Alice signs encrypted message

Bob recovers MOnly Alice could have

sent the messageCommunication is

authenticatedToo slowBetter? Worse?

Alice:

Bob:

K Ep C1

B

M Es C2

K

C2 Ds M

K

S Ep

A

C2 Dp S

a

Page 11: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Repudiation

Authentication: can Bob prove to himself that Alice sent the message?

Non-repudiation: can Bob prove, in court, that Alice sent the message?

In military applications, not really relevantIn e-commerce: essential“Digital signature”

Page 12: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

DES, I rebuke thee

Classical Crypto: Bob wants to prove M came from Alice

Bob would have to reveal K

Even that isn’t good enough; Bob could’ve encrypted M himself

No defense against repudiation

Alice:

Bob:

M Es C

K

C Ds M

K

Alice and Bob sharea secret key K

Page 13: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Repudiation: E(D(M))

Bob can produce M and S in court

Anyone can verify that M = Ep

A(S)

Only Alice could have created S

Hence, Alice must have sent M

Success!

Alice:

Bob:

K Ep C1

B

M Dp S

a

S Ep M

A

C2 Ds

K

S Es C2

K

Page 14: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Repudiation: D(E(M))

Bob can produce M, C2, and S in court

Judge can verify that Alice signed C2

To prove connection between C2 and M, Bob must reveal K

Even that might not be good enough

Lesson: design matters

Alice:

Bob:

K Ep C1

B

M Es C2

K

C2 Ds M

K

S Ep

A

C2 Dp S

a

Page 15: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

A general protocol

E(D(M)) defends against repudiationIt’s too slow to be usefulAnother problem: Bob always needs to convert S

to M. Maybe he doesn’t always want to authenticate.

Solution: Alice appends “signature” to M, encrypts, sends to Bob.

Should be something Alice can do, others can verify. E.g.: Dp

a(M)

Page 16: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Digital Signature Schemes

s(M) is a digital signature if only Alice can compute it, anyone else can verify it

Used for communicationAlso, data integrity: compute signature every

night, see if it matchesDp

a(M) would work, but it’s too slow, and too big

Solution: Dpa(H(M)), where H is a hash function

Page 17: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Hash functions

What makes H a hash function? Takes any size input Produces fixed-size output H(M) is easy to compute Given h, it is hard to solve H(M) = h for M Given N, it is hard to solve H(M) = H(N) for M

(weak collision resistance) It is hard to find M, N such that H(M) = H(N)

(strong collision resistance)

Page 18: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Hashing: Non-repudiation

Say Bob takes Alice to court; he produces M and S = Dp

a(H(M))

Judge checks that EpA(S) = H(M), confirms

that Alice sent (someone) a message hashing to H(M)

Alice says: “Bob must have found a message M to match something I signed”

Weak collision resistance: She’s lying

Page 19: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Strong Collision Resistance

Why require solving H(M) = H(N) to be hard?Say Alice can find M, N so H(M) = H(N)She sends Bob M, signs itWhen Bob takes Alice to court, she claims

“No, I didn’t sign M, I signed N”Repudiation would be possibleSolution: strong collision resistance

Page 20: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Hashing: Secretary Attack

Related problem: Secretary constructs messages M, N where H(M) = H(N)

M is the annual report, N says “Give my secretary a raise”

Alice computes S = Dpa(H(M)), tells

secretary to send out M and SSecretary substitutes N insteadNeed strong collision resistance

Page 21: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

How many bits of security?

Let H be a secure hash with n-bit outputSolving “H(M) = h” for M should take 2n triesGiven N, “H(M) = H(N)” should be the same:

just try 2n possible values of MWhat about finding M, N with H(M) = H(N)?If we just pick pairs at random, it’s 2n

But, we can get it down to 2n/2

e.g., for a 128-bit hash; only 264

Page 22: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Happy Birthday

How do we do this? “Birthday Attack”Make a list of 2n/2 possible M’s (e.g., vary

spacing), sort by value of HTry roughly 2n/2 possible N’s, look for H(N)Given Mi, Nj, chance H(Mi) = H(Nj) is 1/2n

2n/2 Mi’s, 2n/2 Nj’s, so 2n/2 2n/2 = 2n pairs

So, odds are good there’s one pairIf there is a pair, finding it is fast

Page 23: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

They say it’s your birthday

Why is this called the “birthday attack”?Among 23 people, chances of two with the

same birthday are > 50%Why? (23 22)/2 = 253 pairs of peopleEach has probability roughly 1/365There’s a good chance some pair matchesOther factors only increase the odds“Birthday Paradox”

Page 24: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Hash, Paper, Scissors

An example of the power of a secure hashAlice, Bob want to play rock, paper, scissors

Alice constructs M indicating her choicee.g., “23419382 Good Old Rock”

Alice sends Bob H(M) Bob makes his choice, sends it to Alice Alice reveals M. She has to tell the truth.

“Bit commitment scheme”Applications to auctions, voting

Page 25: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

How do we hash?

Most hashes are built using a one-way compression function: m+n bits to n bits

Divide message into k blocks of m bitshi = ƒ(Mi, hi-1) (h0 is a fixed initial value)

Output is H(M) = hk

ƒ ƒ ƒ ƒIV

M1 M2

h1

M3

h2

Mk

hk-1

H(M)

hk

Page 26: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

Hashing out the details

Pad message length to be a multiple of mInclude message length within MNeed to pick a one-way function ƒ(Not like public-key; no trapdoor needed)

ƒ ƒ ƒ ƒIV

M1 M1

h1

M2

h2

Mk

hk-1

H(M)

hk

Page 27: Hashing Sandy Kutin CSPP 532 7/10/01. Cryptographic Protocols zWhat is a cryptographic protocol? zExample: Alice sends Bob a message M y1. Alice generates.

A MoDESt Proposal

One idea: use encryption (e.g., DES)h0 = IV

hi = ƒ(Mi, hi-1) = EMi(hi-1)

Problem 1: slowProblem 2: export restrictions

ƒ ƒ ƒ ƒIV

M1 M1

h1

M2

h2

Mk

hk-1

H(M)

hk