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

417 ratings

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

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

Maryland Cybersecurity Center

[MUSIC]

Â Let's remember where things stand.

Â In the last lecture we showed how to construct a secure message

Â authentication code for short fixed length messages.

Â Based on any pseudo random function, AKA block cipher.

Â And what we'd like to do, is to make this more useful and

Â more practical, by extending those ideas.

Â To give a construction of a secure message authentication code that can

Â handle arbitrary length messages.

Â And in particular messages that are much longer than a single block length.

Â And in this lecture we'll explore one popular way of doing that.

Â Called CBC MAC.

Â The basic CBC MAC construction works in the following ways.

Â Given a message m1 to ml, where each mi represents a block of the message.

Â Whose length is equal to the block length of some underlying block cipher.

Â We compute the tag in the following way.

Â We first apply our block cipher, F sub k, to the initial block, m1.

Â Take that value and

Â use it as a chaining value, XOR it with the next message block, m2.

Â Pass that result through the block cipher, and so on until the final block.

Â The result of the final invocation of the block cipher,

Â is the tag T on the message m1 through ml.

Â Now, even though CBC-MAC looks very similar to CBC-Mode encryption,

Â there are a few differences that are crucial for the security of CBC-MAC.

Â The first thing to observe is that CBC-MAC is deterministic.

Â And in particular, there's no initialization vector.

Â Or another way to think about it is that it's what you would get if you

Â ran CBC mode encryption with the all zero IV.

Â And this is important for security.

Â There's no reason for

Â a MAC to be randomized, in contrast to the case of encryption.

Â And in fact, if you tried to modify CBC-MAC by including an IV,.

Â What you would get would be insecure.

Â Another difference is that in CBC-MAC, only the final value,

Â the output of the final invocation of the block cypher is output as the tag.

Â And, of course, this is

Â different from what we have in the case of CBC-mode encryption.

Â Where every output of this pseudo random function, every block.

Â Has to be output in order to enable decryption.

Â This means that when we verify the tag, when the receiver verifies the tag.

Â What they can do, is simply recompute the entire CBC-MAC and

Â check whether the result they get matches the tag that they've received.

Â And again if things are changed by outputting every block.

Â As the tag, then not only would that make the construction much less efficient.

Â All right, it would expand the length of the tag, but

Â it would again in fact make the construction insecure.

Â So both of these modifications relative to CBC mode encryption are in

Â fact essential for security of CBC MAC.

Â What can we say about the security of CBC MAC as we presented it?

Â Well it turns out that it's possible to prove the following result.

Â That if F is length preserving pseudorandom function.

Â Then for any fixed value l.

Â Were remember l represented the number of

Â blocks in the message that we were authenticating.

Â So for any fixed value l the basic CBC-MAC instruction is a secure MAC for

Â messages of length l times n.

Â So I'm assuming here that each block is n bits long.

Â And so an l block message has length ln bits.

Â Turns out that the proof here works by showing the CBC-MAC.

Â For a fixed length parameter, l is in fact a pseudorandom function.

Â And then very similar to what we saw in the last lecture,

Â we can use that to prove that CBC-MAC with a fixed length l is a secure MAC.

Â This issue of the fixed length parameter,

Â l is again something that is crucial for security.

Â And what I mean here by saying that we fix l.

Â Is that as part of the scheme, the sender and

Â receiver must agree on what length parameter they're going to use.

Â And the sender must agree to only authenticate messages

Â whose length is precisely l blocks.

Â And the receiver has to agree to only possibly accept messages if they're

Â exactly l blocks long.

Â and it will just,

Â it should just immediately reject if it ever gets a message whose length is

Â not equal to l blocks.

Â And once again, it turns out that if the sender and receiver aren't careful.

Â And either the sender will authenticate messages of different length or

Â the receiver will accept messages of different length.

Â Then basic CBC-MAC is not secure in that kind of a setting.

Â So what this means basically is that basic CBC-MAC can handle messages of arbitrary,

Â but fixed, length.

Â So we are doing better than the small, than, than,

Â the construction we saw last time.

Â Which could handle fixed length and short messages,

Â because now we are able to handle fixed length but much longer messages.

Â Now it turns out, further that there are ways to

Â modify CBC-MAC in order to handle messages of variable length.

Â So in practice this restriction to messages who's length is

Â exactly el blocks is not a reasonable one.

Â And we would like to obtain a construction that doesn't have that restriction and

Â there is various ways of doing that.

Â One of the simplest is to prepend the length of

Â the message before applying the CBC-MAC construction.

Â And this looks like the following.

Â So now to authenticate a message m1 through ml, where l can be anything.

Â What the sender will do is to encode the value l as a single block.

Â So represent l using m bits padding to the left if necessary with zeros.

Â And then just run the basic CBC-MAC construction on the encoded message,

Â as it were, l, m1, m2 up to ml.

Â And it turns out, as we said, that this will work and

Â this will give us a Q on MAC which can handle messages of any block length l.

Â So the sender can now authenticate.

Â Arbitrary length messages the receiver can safely accept.

Â Arbitrary length messages if it,

Â too prepends the length L, before applying CBC-MAC and checking the result.

Â Now, as I've described it here.

Â The extended var, variant of CBC-MAC assumes that

Â messages have length exactly a multiple of the block length.

Â This restriction can be waived also.

Â It's actually a little bit technical and

Â not cryptographically interesting and so I haven't shown that here.

Â But you should know that in fact,

Â CBC-MAC can be modified to handle really messages of any arbitrary length.

Â In the next lecture, we'll explore another approach for

Â constructing a secure MAC for variable length messages.

Â This one based on a new cryptographic primitive that we'll introduce there

Â called a hash function.

Â I'll see you next time

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