This course will introduce you to the foundations of modern cryptography, with an eye toward practical applications.

Loading...

From the course by University of Maryland, College Park

Cryptography

415 ratings

This course will introduce you to the foundations of modern cryptography, with an eye toward practical applications.

From the lesson

Week 4

Message Authentication Codes

- Jonathan KatzProfessor, University of Maryland, and Director, Maryland Cybersecurity Center

Maryland Cybersecurity Center

[NOISE].

Â In the last lecture we talked about authenticated encryption.

Â Which provides a way for

Â two parties to communicate with both secrecy and integrity.

Â Now, let's consider two parties who again wish to communicate securely,

Â that is with secrecy and integrity.

Â But now they want to do so in the context of a communication session.

Â Whereby a communication session, I simply mean a period of

Â time over which the two parties are willing to maintain state.

Â Now, of course the natural thing here, is to use authenticated encryption.

Â So, in this picture I've shown two parties sharing a key k in advance, and

Â using an authenticated encryption scheme to communicate.

Â So, in this and

Â the next few slides, by Enc, I mean an authenticated encryption scheme.

Â In this picture we have Bob sending messages m1 and m2 to Alice.

Â And then Alice replying with a message m3.

Â And because the parties are using authenticated encryption.

Â We know that if the attacker injects any ciphertext different

Â from the ones it's seen already.

Â That will be detected as invalid by one of the parties.

Â And if the attacker modifies any of the cyphertexts being sent by either party,

Â that too will be detected as being invalid by the other side.

Â Does this mean that using authenticated encryption in this way

Â gives us the notion of security that we want during the context of their session?

Â In fact, I claim that there are several attacks that can still be carried out.

Â An easy one is a replay attack.

Â So, imagine that Bob sends the message m1 to Alice,

Â and then tries to send a message, m2.

Â But the attacker can somehow prevent that message from reaching Alice.

Â Dropping it in the network that day.

Â And instead, the attacker simply replays the first ciphertext to Alice.

Â Well, Bob intended to send m1 followed by m2.

Â But Alice will receive m1 followed by m1.

Â And a priori, Alice doesn't know whether Bob intended to send m1 twice or not.

Â So, this causes a mismatch between the view of Alice and Bob in their session.

Â Again, Bob thinks he sent m1 m2, or Bob intended to send m1 m2.

Â Whereas Alice receives m1 m1,

Â and doesn't have any idea a priori that anything went wrong.

Â Other attacks are possible as well.

Â For example here I've shown what I'll call a re-ordering attack.

Â So, in this setting Bob sends m1 followed by m2.

Â But the adversary who might have control over scheduling in

Â the network delivers m2.

Â Or the encryption of m2 before delivering the encryption of m1.

Â So, again this will cause a mismatch in the parties respective views of this

Â communication session.

Â Bob has intended to send m1m2, but Alice has received m2m1.

Â And again, there's no way for Alice to tell here that anything has gone wrong.

Â Finally I want to point out what may be a more insidious sort of an attack,

Â which I'll call a reflection attack.

Â So, here Bob sends m1 to Alice, and then tries to send m2.

Â Whether or not m2 reaches Alice, we can imagine that the attacker here

Â simply redirects the encryption of m2 that Bob just sent.

Â And forwards it to Bob as if it's coming from Alice.

Â Now from Bob's point of view, he'll decrypt, not get any error and

Â believe that Alice has intended to send him the message m2.

Â So this, again, will introduce a mismatch between the views of Alice and Bob.

Â Bob, intended to send m1m2.

Â Alice in this picture, didn't send anything, but

Â Bob thinks he's received a message m2 from Alice.

Â So, all of these examples, show how even using authenticated encryption alone,

Â is not enough to get the security.

Â The integrity guarantees that we might want in a secure session.

Â It turns out that these attacks and

Â others can be prevented very simply using what are, what are called counters.

Â And by incorporating the identities of the parties.

Â And these, as I said, are rather simple but do need to be incorporated.

Â If the parties want to achieve the notion of integrity across their

Â communication session.

Â Let me show how these are done.

Â So, what the parties will do is simply incorporate both a counter and

Â their identity, in any message that they want to transmit.

Â Before applying the authenticated encryption scheme.

Â So, here we see how Bob, when sending the message m1.

Â Includes both a counter value 1, because this is the first message that Bob is

Â sending to Alice along with his identity, Bob.

Â And then when he sends the second message, he'll include the counter value

Â 2 along with his identity, at the other end of course.

Â Alice, upon decrypting,

Â will check that the sender field corresponds with the intended other party.

Â In this case that would be Bob, and

Â also verifies that the sequence number matches what she expects.

Â So, the first sequence number should be one, and any subsequent point of time,

Â point in time, upon decrypting some cypher text.

Â She should observe a counter number that's one more than the last counter value

Â she received.

Â In the final message, Alice sends m3, and she will include the counter value 1,

Â because this is her first message, along with her identity Alice.

Â And Bob will perform similar chats, checks at his end.

Â It turns out that a notion of secure sessions can be defined.

Â We won't do that here, and one can prove that this construction.

Â That is, using authenticated encryption and incorporating counters and

Â identities, realizes this notion of secure sessions.

Â It's clear that it provides secrecy, at least against the passive eavesdropper.

Â But the argument for integrity is a bit more complicated, and

Â relies exactly on the fact that the parties are willing and

Â able to maintain state throughout the course of this session.

Â This completes our treatment of the private-key settings.

Â Congratulations on making it this far.

Â Of course, this doesn't mean you should forget everything we've covered so far.

Â And in particular, the primitives we've discussed in the context of

Â private key cryptography will be used even in the public key setting.

Â Just to recap the things we've discussed so far, we've seen

Â appropriate primitives for ensuring secrecy in the private key setting.

Â Namely private-key encryption schemes, as well as the appropriate primitive for

Â achieving integrity in the private-key setting.

Â That is, message authentication codes.

Â We've also talked about authenticated encryption.

Â And how to appropriately design an authenticated encryption scheme.

Â That allows parties to achieve both secrecy and integrity for

Â their communication.

Â Along the way,

Â we've often discussed the notion of collision resistant hash functions.

Â And discussed how they can be used for message authentication.

Â Next week, we'll start moving on to the public-key setting.

Â And in particular, we'll begin with a discussion of number theory.

Â And cryptographic hardness assumptions, that can be based on number theory.

Â I hope to see you all there.

Â Coursera provides universal access to the worldâ€™s best education,
partnering with top universities and organizations to offer courses online.