Docsity

Cryptographic Protocols: Secure Channel and Key Agreement, Study notes of Computer Science

Partial preview of the text

Download Cryptographic Protocols: Secure Channel and Key Agreement and more Study notes Computer Science in PDF only on Docsity!

CRYPTOGRAPHIC PROTOCOLS

CIS 400/628 — Spring 2005

Introduction to Cryptography

This is based on Chapters 14 and 15 of “Practical Cryptography” by Niels Ferguson and Bruce Schneier

THE SECURE CHANNEL, I

A secure channel a secure connnection between two parties A basic tool in crypto protocols.

Roles Alice, Bob, Eve

Key Alice and Bob share a secret key K. Requirements I K is known only to Alice and Bob. I Every time the secure channel is initialized a new value is generated for K.

Messages A sequence of discrete messages. Assumption: I The transport layer is not reliable. E.g., TCP/IP is reliable against random events, but not an active and clever attacker. More...

THE SECURE CHANNEL OUTLINE

Message Numbering

I Why? I Number 1 through 232 − 1. After 232 − 1 messages, refresh the key.

Authentication

I Use a standard MAC: HMAC-SHA-256. I For message i: ai : = M AC(i‖(xi)‖xi‖mi) xi = context data for Bob.(xi) = the length in bytes of xi

Encryption

I Use AES in CTR mode. I Messages no larger than 16 · 232 bytes.

Frame Format i coded as a 32-bit integer, least significant byte first followed by the encrypted mi and ai.

PROTOCOLS

I A protocol is a scripted exchange of messages

in which various parties play particular roles.

I Designing and implementing these in real life is tricky.

I The cryptography is hard, but it is the easy part.

I Putting the pieces together in a way that preserves security

is really hard.

TRUST

I No trust =⇒ no transactions.

I Sources of trust

• Ethics

• Reputation

• Law

• Physical Threat

• M.A.D.

I Trust is hard to develop over the Internet

I Trust is a matter of degree

I Risk is the converse of trust

— Businesses think in terms of risks.

INCENTIVES

I Incentive structures and crypto protocols interact

• The protocols depend on incentive structures.

E.g., They cannot stop a merchant from cheating a cus-

tomer, but if the protocol gives the costumer a proof of

purchase...

• The protocols change incentive structures.

? They make certain things impossible.

(E.g., certain types of forgery)

? They make new things possible.

(E.g., online banking, and hence, online break-ins to

steal money.)

LAYERS OF PROTOCOLS

the high level description

protocol execution states

message encoding and parsing

protocol and message ids

the transport layer

The Transport layer

I E.g., TCP/IP

I Should be able to send arbitrary sized messages

I A secure channel makes everything easier, but we don’t

always have one.

LAYERS OF PROTOCOLS, II

Protocol and Message IDs

I A message needs to contain:

  • what protocol it belongs to and
  • what part of the protocol it is. I These are not secure. I They help detect and protect against accidental errors.

Message Encoding and Parsing

I The encoding has to be flexible enough to handle variable length messages. I Fixed length fields are simple, but they seldom survive version changes.

Protocol Execution States

I Event-driven. A state-machine is a good idea.

PROTOCOL PLUMBING: REPLAYS AND RETRIES

A replay attack Eve records a message and later sends that message again.

A retry Alice didn’t get an acknowledgement from Bob about the last mes- sages, so she sends it again.

How is Bob to securely handle repeated messages? Upon receiving a message:

I If it is the one expected, do the normal things. I If it is a message “from the future” (e.g., expecting #8, receiving #23), ignore it. I If it is a message “from the past”:

  • If it is identical to one previous received, then send the identical reply.
  • If it has the same message ID as a previous one, but has different contents, treat as a protocol error.
  • If it is a really old message, the safe thing is to ignore it.

A DH+ PROTOCOL

Goal Alice and Bob want to agree on a secret session key for a secure channel.

Assumption We assume A&B can authenticate messages to one another. A&B may have a shared secret key for authentication.

Question: If they already share a secret key, why bother with another?

Answer:

I Compartmentalization, just like in spy networks. I If the session key is compromised, the long-term key is safe. I If the long-term key is compromised and Eve hasn’t recorded yester- day’s key negociation, then yesterday’s exchanges are safe.

PROBLEMS WITH THE FIRST TRY

I Using constants for (p, q, g) is a bad idea.

I It can be done with fewer messages.

I Using k in the authentication messages is a bad idea.

Use one secret for one purpose only.

E.g., If the authentication method is weak,

a few bits of k could leak.

I The authentication messages are too similar.

E.g., If AuthX (·) is based on a symmetric cyrptosystem,

then AuthA(k) = AuthB(k).

Why should Alice beleive the message is really from Bob?

I We have to be sure that k isn’t used until the authentications

check out.

NOTES

Protocols last forever

I So they need to be designed to be future proof. I E.g., that is why having (p, q, g) is a bad idea. I A protocol switch/rollback is a point of attack.

Authentication conventions

I At any point in the protocol, the authentication data consists of all data exchanged so far. E.g., In try 1, Alice’s authentication data we consist of: X and Y and Bob’s would be X, Y , and AuthA(... ). I This is reasonably cheap and stops lots of attacks. I Henceforth: AuthA = Alice’s authentication message at this point of the protocol. AuthB = Bob’s authentication message at this point of the protocol.

A THIRD TRY

Alice Chooses s : = min size of p and NA

ran ∈ { 0 ,... , 2256 − 1 }. Sends s, NA to Bob. NA is a nonce.

Bob Chooses (p, q, g) and x

ran ∈ Z∗ q. Computes X = gx. Sends (p, q, g), X, AuthB to Alice.

Alice Checks (p, q, g), X, AuthB. Chooses y

ran ∈ Z∗ q. Computes Y = gy. Sends Y, AuthA to Bob. Computes k = Xy.

Bob Checks Y, AuthA and computes k = Y x.

PROBLEMS

I k is of variable size. I k has algebraic structure.

FOURTH TRY

Alice Chooses s : = min size of p and NA

ran ∈ { 0 ,... , 2256 − 1 }. Sends s, NA to Bob. NA is a nonce.

Bob Chooses (p, q, g) and x

ran ∈ Z∗ q. Computes X = gx. Sends (p, q, g), X, AuthB to Alice.

Alice Checks (p, q, g), X, AuthB. Chooses y

ran ∈ Z∗ q. Computes Y = gy. Sends Y, AuthA to Bob. Computes k = SHAd-256(Xy).

Bob Checks Y, AuthA. Computes k = SHAd-256(Y x). See page 270 of F&S for the long form.