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

[SOUND].

Â Recall from our discussion of perfect secrecy,

Â that the notion of perfect secrecy has two inherent limitations.

Â First of all, the key in any perfectly secret encryption scheme,

Â must be as long as the message being encrypted.

Â Second, the key in any perfectly secret encryption scheme,

Â can only be used to encrypt a single message securely.

Â Both of these are really very significant drawbacks for

Â encryption schemes that we'd like to use in practice,

Â where what we'd like to do is share a single key, a short key, that we

Â can use to encrypt as many messages of as whatever length that we want.

Â Now we've seen how we can circumvent the first limitation by relaxing the notion of

Â perfect secrecy, and moving to a definition of computational secrecy.

Â And in particular the pseudo one time pad allows parties to

Â securely encrypt a very long message using a short key.

Â But if you think about it, the pseudo one time pad, still has the second limitation.

Â That is, the key in the pseudo one time pad encryption scheme,

Â can only be used securely to encrypt a single message.

Â And the reason for this is the same as for the case of the one time pad.

Â And if you go back to our earlier discussion,

Â where we showed attacks on the one time pad encryption scheme,

Â when the same key is used to encrypt multiple messages,

Â the same attacks apply to the pseudo one time pad encryption scheme as well.

Â So how can we circumvent the second limitation?

Â Well the first thing we need to do, is to develop an appropriate security definition

Â for the setting where multiple messages can be encrypted using the same key.

Â Remember that in general, cryptographic security definitions have two parts.

Â There's the security goal, describing what it is the parties are trying to achieve,

Â or equivalently, what they're trying to prevent the attacker from doing.

Â And the threat model,

Â describing the abilities that the attacker is assumed to have.

Â Our general, our general approach here is that we're going to keep the security goal

Â essentially the same as what we've seen before for

Â the notion of indistinguishable encryption.

Â But we're going to now strengthen the threat model.

Â So if we go back to a pictorial depiction of the single-message secrecy which

Â encompasses both perfect secrecy, as well as the notion of

Â indistinguishability that we've talked about.

Â What we have are two parties who share the key k in advance, and

Â an attacker represented here by the magnifying glass,

Â who's listening to all the communication between them.

Â And, for single-message secrecy at a high level, what we have is one of

Â the parties encrypting an unknown message m, generating a cipher text c,

Â and transmitting that ciphertext across the channel.

Â The attacker observes that ciphertext.

Â And, roughly speaking,

Â the scheme is secure if, given the ciphertext, the attacker can't figure out

Â any information about the underlying message m.

Â In the case of multiple message secrecy,

Â where again we have multiple messages being encrypted by the same key.

Â We have again the two parties who've shared their key in advance, but

Â now we can think of having multiple unknown messages and one through mt.

Â Each of which is encrypted, using the same key,

Â giving a ciphertext that's transmitted across the channel.

Â Now in this picture I've drawn it with all the ciphertexts going across

Â the channel at once.

Â But there's really no reason that has to be the case.

Â It could be that these are being sent sequentially over time.

Â But the point is that the attacker is observing all of them.

Â The attacker's observing, in this case,

Â t different ciphertexts corresponding to t different messages.

Â Intuitively, what we'd like, is for an encryption scheme to ensure that

Â the attacker gets no information at all about any of the messages collectively.

Â And this notion is not going to be satisfied by the pseudo one

Â time pad encryption scheme, even at an intuitive level.

Â Now in fact, we could define, formally, a notion of multiple-messa,

Â -message secrecy and then try to work with that definition.

Â Because of our time constraints we're not going to do that.

Â Instead, what we're going to do is jump directly to defining something stronger.

Â Namely, security against chosen-plaintext attacks.

Â Or what's called CPA-security.

Â Now it's not immediate that this notion of secrecy is

Â stronger than multiple message secrecy.

Â But in fact if you define things appropriately you can prove that

Â that's the case.

Â You'll just have to take my word for it.

Â One thing I want to point out is that CPA-security is nowadays, the minimal

Â notion of security that an encryption scheme used in practice should satisfy.

Â We defined the notion of indistinguishability,

Â which translates to security for encryption of a single message.

Â But that was really for, only for pedagogical purposes.

Â That notion is really too weak for schemes used in practice today.

Â So let's look intuitively, or informally, at the notion of CPA-security.

Â What exactly do we mean by security against chosen-plaintext attacks?

Â Well here we imagine again our two parties who have shared a key, k, in advance.

Â And an attacker listening in to all the communication between them.

Â Now however, we're going to allow the attacker to, as it were,

Â specify a message, m1.

Â And thereby request that one of those parties encrypt that message,

Â using their shared key to generate a ciphertext c1,

Â that's then sent across the channel and obtained by the attacker.

Â The attacker can do this repeatedly.

Â So it can request encryption of a second message, m2.

Â Again, causing the sender to encrypt that message using the key,

Â generate a ciphertext, and send that ciphertext across the channel.

Â The attacker can repeatedly do this, and we're going to allow the attacker to

Â do this as often as it likes, with whatever messages it likes.

Â At some later point in time, we imagine that there's then an unknown message m,

Â that one of the parties encrypts.

Â And again, sends the resulting ciphertext across the channel,

Â which is observed by the attacker.

Â And what we'd like, again, is that this encryption scheme will

Â guarantee that the attacker doesn't learn anything about this unknown message m,

Â from the additional ciphertext c that is observed.

Â You can ask whether this kind of a threat model is really too strong.

Â In the picture we're giving the attacker the ability to request encryptions of

Â any messages of his choice as may times as it likes.

Â I would argue that this threat model is not to strong.

Â And it's, and it represents a realistic threat that we need to be concerned about.

Â In practice there can be many ways that an attacker can influence what the honest

Â parties encrypt.

Â It's not clear how best to model this, but

Â by defining a strong notion of security against chosen-plaintext attacks,

Â we automatically encompass any such influence on the part of the attacker.

Â Moreover there can be cases where an attacker has significant control over

Â what is encrypted.

Â Really approximating or, or

Â approaching with the power that we give it in the notion of CPA -security.

Â And so again, this threat model is not unrealistic, and

Â it does represent concerns that do arise in practice.

Â I actually want to give a specific example of this,

Â which is also a nice story and a good motivator for the notion of CPA-security.

Â This is a classical example going back to World War II, involving the Americans and

Â the Japanese.

Â In one particular setting, we have here the US forces at Midway island,

Â as well as the American flag representing a US base.

Â And we have a ship supposed to represent the Japanese Pacific fleet,

Â that's communicating back with Japanese forces back in Japan.

Â At one point in time, the Americans intercepted a communication

Â between the Japanese, sig, signifying that there was going to

Â be an impending attack on a place referred to by the code name AF.

Â You can view AF here as a ciphertext corresponding to

Â the encryption of some unknown location that the Japanese were about to attack.

Â Now for various reasons the Americans had reason to believe that AF corresponded to

Â Midway Island, but they weren't sure.

Â So they came up with a very clever mechanism for

Â determining whether their guess was correct.

Â What they did was they had the forces at Midway Island

Â broadcast a message asking for help and requesting fresh water.

Â They then listened in to the Japanese communication, and

Â shortly afterward observed the message going back to

Â the Japanese indicating that AF is now short of water.

Â This corresponds exactly to a chosen-plaintext attack.

Â Right? The Americans were able to

Â influence the Japanese to encrypt something related to Midway Island.

Â They were then able to observe the ciphertext AF.

Â And from that,

Â conclude that AF very likely corresponded, indeed, to Midway Island.

Â It turned out that the American guess was correct.

Â They were able to deploy forces to Midway Island and

Â defeat the Japanese in that battle.

Â This really did represent a turning point in the war.

Â And interestingly, if the Japanese had been using a CPA-secure encryption scheme,

Â perhaps history might have been different.

Â Let's now define formally the notion of CPA-security.

Â As usual, we're going to fix an encryption scheme pi.

Â Fix a particular adversary A.

Â And then define a randomized experiment based on pi and A.

Â The experiment that I'm calling here PrivCPA is parameterized by our

Â security parameter n, and proceeds in the following way.

Â In the first step,

Â we run the key generation algorithm of the encryption scheme to obtain a key k.

Â We then allow the attacker to interact with what we're going to

Â call an encryption oracle.

Â This encryption oracle allows the attacker to submit messages of his choice.

Â And to get back encryptions of those messages,

Â using the key k chosen in the first step.

Â The attacker can interact with the oracle as many times as it likes.

Â And then at some point it outputs a pair of messages, m0 and m1,

Â of the same length.

Â In the next step of the experiment we choose a uniform bit b.

Â And we encrypt the message mb,

Â using again the same key that we chose in the first step.

Â This generates a ciphertext c, which is given to the attacker.

Â We allow the attacker to then continue to interact with

Â the encryption oracle as many times as it likes.

Â Finally A outputs a bit b prime which can be viewed as representing its

Â guess as to which of the two messages was the one that was encrypted.

Â We'll say that A succeeds if its guess is correct, and

Â the experiment evaluates to 1 in that case.

Â We can now define what it means for an encryption scheme, pi, to be CPA-secure.

Â We'll say that pi is CPA-secure if for

Â all efficient, i.e probablistic polynomial time attackers A,

Â there's some negligible function epsilon, such that the probability with which

Â A succeeds in the previous experiment, is at most one-half plus epsilon.

Â As before, the attacker can trivially succeed with probability half just

Â by guessing.

Â But we require that the attacker cannot do any better than this.

Â Or at least, not substantially better.

Â The definition is all well and

Â good, but you might be worried that the definition is impossible to achieve.

Â And in fact, we can give a sort of impossibility proof for that statement.

Â Consider the following attacker A.

Â This attacker will choose two messages, m0 and 1.

Â And then request encryption of m0, and requist, and

Â request encryption of m1 via its encryption oracle.

Â In doing so, it obtains a ciphertext c0 responding to encryption of m0.

Â And a ciphertext c1 corresponding to encryption of m1.

Â It then outputs m0 and

Â m1 as its two challenge messages, and gets back a challenge ciphertext c.

Â It then simply compares whether c is equal to c0 or c1.

Â If c is equal to c0, then A guesses is that m0 was encrypted, and outputs 0.

Â And if c is equal to c1, then A guesses that m1 was encrypted in outputs 1.

Â And it look like, this allows A to succeed with probability 1.

Â This seems to show that for any encryption scheme, there's an attack in the sense of

Â a chosen-plaintext attack, that violates our definition, because it succeeds with

Â probability the attacker here succeeds with probability more than one half.

Â So is the definition impossible to achieve?

Â Well in fact, if you look carefully, at this attacker you'll see that

Â this attack only works if encryption is deterministic.

Â That is, if we assume that the encryption of m0 using a key k

Â always gives the same result c0.

Â And encryption of m1 using k always gives the same result c1.

Â But in fact, if encryption is randomized,

Â then it can be the case that when I encrypt m0 multiple times,

Â even using the same key, I get different ciphertext each time.

Â So in fact the impossibility result, or this attacker, only shows that

Â CPA-security is impossible to achieve for deterministic encryption schemes.

Â The moral here is that if we want to ho,

Â a hope to achieve CPA-security, we need to use randomized encryption.

Â This is actually a very important point,

Â and I stress that the issue is not an artifact of the definition, or

Â an indication that the definition is too strong.

Â In reality, it really is a problem,

Â if an attacker can tell when the same message is encrypted twice.

Â So is we want to define a meaningful notion of security,

Â even in the case where multiple messages can be encrypted,

Â then we really do need a randomized encryption scheme which also

Â hides information about whether the same thing is being encrypted multiple times.

Â In the next lecture, we'll study pseudorandom functions,

Â a primitive that we're going to rely on for constructing CPA-secure encryption.

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