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 3

Private-Key Encryption

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

Maryland Cybersecurity Center

[MUSIC]

Â In all the previous definitions of security that we've talked about for

Â private key encryption, we've been implicitly or

Â explicitly assuming only a passive, eavesdropping attacker.

Â In pictures, what this means is that we have an attacker who can

Â eavesdrop on the communication channel, between the sender and the receiver.

Â Looking at the cypher texts that are being sent from one party to the other.

Â And our definitions of security then require that it be infeasible for

Â the attacker who's observing those cypher texts.

Â To figure out any information, about the messages that were being communicated.

Â We can ask, however, what about if we consider stronger attack models?

Â For example, an attacker who can be active and

Â actively sending communication on a communication channel, or

Â interfering with the communication on the communication channel.

Â So, if we look at the first case of an adversary interfering with

Â the communication channel we get a picture something like this.

Â So here, we again have our two party's who have shared a key cane of events and

Â who wish to communicate.

Â And we have the fender taking their message, encrypting it

Â getting a cypher text and then sending to the receiver across the channel.

Â Now however,

Â we do not assume that the cypher text can reach the receiver unchanged.

Â In fact, there might be an attacker who is able to modify the cypher text as it's

Â being transmitted from the sender to the receiver.

Â And what such an attacker can do,

Â is to take the cypher text transmitted by the sender.

Â Modify it to give a different ciphertext, c prime, and

Â forward that modified ciphertext to the receiver.

Â The receiver of course has no way of knowing whether what they receive is what

Â was sent by the sender or what was sent by anybody else.

Â And so they're going to take that ciphertext,

Â the modified ciphertext, c prime, and decrypt it.

Â In general, this will give some modified cipherte modified plaintext, m prime,

Â that the receiver will then decide what to do with next.

Â What are the concerns in this setting?

Â Well, one concern is that the encryption scheme might be malleable.

Â Okay this is a technical term that has a formal definition, but

Â that I'm only going to define informally here.

Â An encryption scheme is malleable if, roughly speaking, it's possible for

Â an attacker to modify a cypher text like on the previous slide, and

Â importantly thereby cause a predictable change to the plain text.

Â Of course, for

Â any encryption scheme an attacker can always modify a ciphertext that's sent.

Â But in general that might result in just garbage or

Â some unpredictable effect in the plaintext.

Â But a scheme is malleable if it's possible to modify a ciphertext in a particular way

Â and, thereby, cause some predictable modification in the underlying plaintext.

Â We'll show an example in a minute, but first I just want to highlight that

Â malleability can be really dangerous, anytime you're concerned about

Â the possibility of an attacker interfering with your communication.

Â So, think about the case of encrypted email.

Â If I encrypt an email to somebody else,

Â that says, say I'm willing to pay you a $100 for something that you've advertised.

Â Well if an attacker can modify that and change my $100 agreement to

Â buy to something saying that I'm willing to pay $1,000,

Â well that can have very damaging consequences for me.

Â And similarly, in any kind of setting where you have encrypted transactions,

Â say with your bank.

Â If I want to withdraw or transfer $100 from my account to someone else's account,

Â if would be really bad if an attacker could modify my encrypted

Â transactions with my bank, but thereby call the bank to receive

Â a message telling it to transfer $1000 or $10,000 to somebody else's account.

Â So, these kinds of attacks can be very damaging.

Â If you think about it a little bit, you'll notice that all the schemes, all

Â the private key encryption schemes we've discussed so far are, in fact, malleable.

Â For example, the one-time pad is trivially malleable.

Â Here we'll have the, the picture from the previous slide, but

Â now with a specific case of encryption using the one-time pad.

Â So, say we have our sender now, taking their key, k,

Â and encrypting their message, which I've now written as a sequence of bytes.

Â M1 through sorry, bits m1 through mn.

Â So, that means that the sender will take this message m1 through mn, and

Â XOR it with their key, which is also going to be n bits long.

Â And obtain some end bit site for tech c.

Â C is also represented here in terms of bits and we can imagine as

Â before an attacker who modifies this site for attacks in some way.

Â For example, say the attacker just flips the final bit of

Â the cypher text to give a modified cypher text.

Â That contains the first n1 bits of that cipher text identical to the original one.

Â And the final bit slipped.

Â Well what effect is this going to have on the message that receiver obtains when

Â they decrypt?

Â Well when the receiver decrypts,

Â they're going to take the cipher text they received.

Â Which is going to be the modified cypher text with the final bit flipped.

Â They're going to record that with their key carry, and what you'll see is

Â the first and minus 1 bits of the message that they recover will be the same

Â as the original message, as those of the original message sent by the sender, but

Â the final bit of the message they recover is going to be flipped.

Â As compared to the bit that defender intended.

Â So, this has the effect of flipping the final bit of a plaintext.

Â So, in summary this means that by flipping the last bit of a ciphertext,

Â an attacker is able to predictably flip the final bit of the plaintext.

Â And this is not limited to the final bit.

Â The attacker can actually flip any bit in the cipher text, and

Â flipping the ith bit of the cipher text will flip the ith bit of plain text.

Â And nothing limits the attacker to flipping only a single bit.

Â If the attacker flips any number of bits of the cipher text, it

Â will have the effect of flipping exactly those bits in the underlying plain text.

Â This means if the attacker,

Â if he knows anything at all about the original plain text.

Â Can cause very predictable and

Â possibly damaging effects on their recovery plane text.

Â Now, this is very interesting, because it implies that even perfect secrecy,

Â which was the strongest or, or which at least was a very strong notion of

Â security that we discussed that does not rely on any computational assumptions.

Â If not sufficient to imply non-malleability.

Â That is schemes can be perfectly secret like the one-time pad, but

Â still be very malleable.

Â And the attack that we've demonstrated on the previous slide,

Â is not only limited to the one-time pad.

Â In fact a very similar sort of an attack, and sometimes even other kinds of attacks,

Â are applicable on all of the other encryption schemes we've seen so far.

Â I'll leave that as an exercise for you, but it is indeed the case that

Â every scheme we've seen so far is vulnerable to a similar attack.

Â So, coming back to our original discussion, right, we walked about

Â the fact that we might have an active attacker who can inject or modify messages

Â being sent across the communication channel shared by the sender and receiver.

Â Well, let's now consider the second case, that of the attacker who

Â is impersonating the sender and injecting communication on the channel.

Â This is actually, you can view as a special case of the previous attack,

Â where the attacker modified something being sent across the channel.

Â The real difference here is just that this attack can happen without the attacker,

Â without the sender sending anything at all.

Â The attacker can just choose to send messages on its own,

Â to the receiver claiming that they're from defender.

Â It doesn't have to wait for the sender to do anything.

Â So, here the picture might look something like this.

Â Here we have a sender and

Â receiver communicating over a channel, and an attacker eavesdropping and

Â observing some cipher text that the sender has already transmitted to the receiver.

Â But now, rather than just restricting the attacker to remaining passive,

Â we're going to allow the attacker to additionally inject cipher texts on

Â the communication channel, between the sender and receiver.

Â So, the send, what the attacker might be able to do for

Â example is to send a cypher text c prime to the receiver and

Â the way it's drawn here, it looks like it's coming from another direction.

Â But, this is just the limitation of our picture and in reality,

Â the receiver has no way of telling whether the cypher text that it

Â receives is coming from the legitimate sender that it intends to speak with, or

Â from some other party in the network.

Â So, any way, the attacker may be able to send a cypher text to the receiver,

Â cause the receiver, then, to decrypt that using the key that

Â they've shared with the sender, with the honest sender.

Â Recover some plain text message end prime, and then, at least in principle,

Â the attacker might be able to learn either m prime or some information about m prime.

Â This picture should actually remind you of the picture we had in

Â the context of chosen plain text attacks.

Â So, in that setting we had the attacker as if it were interacting with the sender.

Â Injecting messages or

Â influencing the sender to encrypt certain messages of the attacker's choice.

Â And then the attacker was able to reserve the results in cypher texts.

Â Here we're just looking at the other side of the diagram.

Â And assuming that the attacker might be able to eject cypher texts,

Â to the receiver and thereby cause the receiver to decrypt those cypher texts and

Â give some information back to the attacker.

Â And this class of attacks, where the attacker sends cypher texts to

Â the receiver for decryption are called chosen-cipertext attacks.

Â And in chosen-ciphertext attacks, as I just mentioned,

Â are meant to model settings in which the attacker can potentially influence

Â what gets decrypted by the receiver, and then observe the effects.

Â And just as in the case of chosen plain text attacks.

Â Where it's not clear how to precisely model what an attacker might be

Â able to do in some real world situations.

Â What we'll do is we'll just give the attacker as much power as we

Â can in our formal definition.

Â So, that is, we're going to consider a definition that allows the attacker to

Â submit any cypher text of his choice with one restriction.

Â To the receiver, and then learn the entire corresponding plaintext.

Â Now again, this is a very strong definition.

Â This is going to result in a very strong definition that we'll see in a moment.

Â And the point is that this definition is going to

Â capture any kind of more limited chosen-ciphertext attack in practice.

Â That it, it'll also capture weaker attacks.

Â Where the attacker is limited in what ciphertext it can give to the receiver and

Â caused to be decrypted, and it's also going to capture weaker attacks where

Â the attacker doesn't learn the entire decryption of the ciphertext that it

Â gives to the receiver, but only learns some partial information

Â about the decryption of the ciphertext he gives to the receiver.

Â But again her definition is going to be quite strong and

Â subsume all of those attacks.

Â The other think I want to mention is that when we

Â talk about chosen-ciphertext attacks, we're implicitly continuing to allow

Â the attacker to carry out chosen plain text attacks.

Â So, chosen ciphertext attacks are there for

Â a strictly strong then chosen plain text attacks because we

Â give the attacker all the power that it had for a chosen plain text attack.

Â And in addition, give it the ability to carry out chosen-cypher text attacks.

Â The formal definition is as follows.

Â So, as usual, we're going to fix some encryption scheme pi, and some attacker a.

Â And then we can define, based on those,

Â a randomized experiment that I'm calling here PrivCCA.

Â As usual, this experiment is parametrized by our security parameter N.

Â And the experiment goes as follows,

Â first we run the key generation algorithm to obtain a key K.

Â Then we allow our attacker to interact both with an encryption oracle

Â as a CPA security, but additionally to also interact with a decryption oracle.

Â And this decryption oracle is keyed with the same key that was generated in

Â the first step and that is being used in the encryption oracle as well.

Â So, the attacker can interact arbitrarily as many times as it likes with both of

Â these oracles.

Â And then at some point, as is usual for these kinds of definitions.

Â The attacker outputs two messages of zero, and then one of the same length.

Â A uniform bit b is chosen and we then encrypt the message and

Â b using our encryption scheme and again the key k generated in the first step.

Â This gives us our challenge type for text c.

Â We then allow A to continue to interact, with both the encryption oracle and

Â the decryption oracle, with one restriction.

Â And that restriction is that we don't allow the attacker to

Â request decryption of the challenge ciphertext c from the decryption oracle.

Â If we did, if we had, had allowed the attacker to do that then there's no

Â possibility of having any scheme satisfy this notion of security.

Â Now it may look a little bit weird that we sort of artificially restrict

Â the attacker from doing that, but in fact this results in a meaningful definition.

Â But as I said earlier captures any kind of chosen-cypher text attack.

Â That an attacker can actually carry out in the real world.

Â So finally, the attacker outputs its guess, b prime, as to what was encrypted.

Â And we'll say as usual that A succeeds if its guess is correct.

Â And the experiment will evaluate to one in that case.

Â And we'll say that pi, the encryption scheme,

Â is secure against chosen-ciphertext attacks or CCA secure.

Â And for probabilistic polynomial time attackers A there's some

Â negligible function epsilon such that the probability with which A succeeds in

Â the experiment on the previous slide is at most one half plus epsilon n.

Â This is the exact same format of the definitions we've seen before.

Â The only difference is that we've modified the experiment.

Â We've made the experiment stronger by giving the attacker more power.

Â Now, it turns out that there's a relationship between the definition of

Â CCA-security and the notion of malleability.

Â And it may be easiest to see by flipping things around a little bit.

Â So, I claim that if the scheme is malleable, then it cannot be CCA-secure.

Â And this is really just intuition.

Â I haven't formally defined what malleable means, so this is not any kind of a proof.

Â This is just an intuitive sketch as to why this claim is believable.

Â So let's say we have a scheme that's malleable.

Â Well, then that means that we can take a ciphertext, and

Â we can modify it, causing a predictable effect on the underlying plaintext.

Â So, now I'll show how we can use that to succeed in the CCA experiment.

Â What we'll do is we'll be,

Â we'll get as part of the experiment a challenge ciphertext c.

Â We'll then modify that to get our modified ciphertext c prime.

Â This modified ciphertext c prime is modified in such a way that when we,

Â that when it's decrypted the resulting plaintext has some

Â predictable relationship with the plaintext.

Â Underlying the original cypher text, C prime.

Â So, if we submit this modified cypher text C prime to our decryption oracle and

Â get back the result, then based on the predictable relationship that it should

Â satisfy, that should tell us information, or that will tell us information about

Â the original message M that was encrypted to give the challenge cypher text.

Â And so, we can then use that to break CCA-security of the scheme.

Â The contrapositive of this is that if a scheme is CCA-secure,

Â that it must also rule out all such malleability attacks.

Â And so, if a scheme is CCA-secure,

Â then it also does imply that the scheme is non-malleable.

Â In the next lecture what we're going to explore is a real world

Â example of chosen-ciphertext attacks called padding Oracle attacks.

Â These kind of attacks are very clever and what I want to get by to get through to

Â you is by showing them it is that chosen-ciphertext attacks can come up in

Â the real-world even very benign situations.

Â And that's going to help motivate why we care about CCA-security in

Â the first place.

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