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

348 ratings

University of Maryland, College Park

348 ratings

Course 3 of 5 in the Specialization Cybersecurity

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

From the lesson

Week 1

Introduction to Classical Cryptography

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

Maryland Cybersecurity Center

[SOUND].

Â Welcome back.

Â Recall from the first lecture that historically speaking,

Â cryptography was exclusively concerned with ensuring secrecy of

Â the communication between two parties.

Â This put us squarely in the context of encryption.

Â Which is where we'll begin our study of cryptography.

Â In addition, classical cryptography always assumed that

Â the two communicating parties shared some secret information.

Â What we'll a key, an event for their communication.

Â This put us in the setting of what's known as private-key cryptography.

Â This setting is also variously known as the secret-key, shared-key or

Â symmetric-key settings for reasons that should become clear.

Â But I'll try to consistently use the terminology private-key cryptography.

Â So in the setting of private-key encryption, we have two users.

Â Often called Alice and Bob.

Â Who shares some secret information, a key in advance.

Â When Bob has a message or a plain text that he wants to send to Alice,

Â he will encrypt that message using the shared-key.

Â This generates a ciphertext that he sends to

Â Alice over a public communication channel.

Â Alice can then decrypt that ciphertext using the shared-key to

Â recover the original message.

Â Informally, the security guarantee we want is that

Â no eavesdropper who can observe the ciphertext sent

Â across the channel can figure out anything about the underlying message.

Â On the previous slide, we had two distinct users separated in space.

Â Private-key cryptography is also commonly used for ensuring secrecy for

Â a single user communicating with themselves as it were over time.

Â Here, Bob holds a message that he wants to store safely on his laptop.

Â As before, Bob can encrypt the message to obtain a ciphertext and

Â now store that ciphertext on his laptop.

Â At some later point in time, when Bob wants to recover the message,

Â he can read the ciphertext from the hard drive.

Â And then decrypt it using his key to recover the original message.

Â Here if an attacker steals a laptop or is otherwise able to compromise it, that

Â attacker should still be unable to learn anything about the underlying message.

Â I now want to define an encryption scheme more rigorously.

Â Formally speaking, an encryption scheme is defined by specifying a message space M of

Â allowable messages.

Â Along with three algorithms, a key-generation algorithm,

Â an encryption algorithm and a decryption algorithm.

Â The key-generation algorithm is a randomized algorithm that chooses a key k.

Â The encryption algorithm takes two inputs.

Â A key k and a message m in the message space.

Â It outputs a ciphertext c.

Â Finally, the decryption algorithm takes as input a key k and a ciphertext c.

Â It outputs a message m or possible some error.

Â I want to highlight here some notation I'll be using throughout the course.

Â I use a left arrow to denote assignment to the output of

Â an algorithm that might be randomized.

Â Meaning that the output of the algorithm may be different,

Â even when run twice on the same set of inputs.

Â I use a colon equals to denote an assignment to

Â the output of a deterministic algorithm.

Â So in this case, this means that we're allowing encryption to

Â possibly be randomized, whereas we're assuming that decryption is deterministic.

Â I use a single equal sign to denote mathematical equality

Â in contrast to assignment.

Â Any encryption scheme is required to satisfy the following basic

Â correctness requirement.

Â For any m message m in a message base and

Â any key k output by the key generation algorithm.

Â If we encrypt m using k to obtain some ciphertext and then decrypt that

Â cypher text using the same key, we should get back the same message we started with.

Â I want to illustrate all of this using a simple example of a historical encryption

Â scheme called the shift cipher.

Â Consider encrypting regular English text.

Â We will identify English letters with the numbers from 0 to 25.

Â So a will be associated with 0, b with 1 and so on.

Â The key k will be an integer in the range from 0 to 25.

Â To encrypt a message m using the key k,

Â we seem to shift every letter of the plaintext by k positions.

Â Wrapping around at the end of the alphabet.

Â So for example, if we encrypt the plain text,

Â hello world using the key t, which, which corresponds to two.

Â Then we simply shift each letter of the plain text forward by two positions.

Â For example, h becomes j, et cetera.

Â Decryption will simply reverse the process by shifting backward.

Â Before defining the scheme more formally, I want to introduce some notation for

Â modular arithmetic that we'll see again later on in the course.

Â You're all probably used to the, the notation x equals x prime mod N.

Â Which means that x and x prime have the same remainder when divided by n.

Â Or equivalently, that n divides x minus x prime.

Â In contrast to this, I use the notation bracket x mod N

Â to denote the remainder of x when divided by N.

Â That is the unique value x prime in the range of 0 to N minus 1.

Â Such that x is equal to x prime mod N.

Â Just to illustrate,

Â we have 25 is equal to 35 mod 10 because they both have the same remainder.

Â But 25 is not equal to bracket 35 mod N, because bracket 35 mod N is equal to 5.

Â Now we can define the shift cipher formally.

Â The message space M will the set of all strings over

Â the lowercase English alphabet.

Â Note that we do not handle uppercase letters.

Â Nor do we handle any non-alphabetic characters like numbers,

Â spaces or punctuation.

Â Our key generation algorithm will choose a uniform key in the range from 0 to 25.

Â This means that each value between 0 and 25 is chosen with equal probability.

Â Now to encrypt a message consisting of the characters m1 through mt, using the key k.

Â We output the ciphertext, c1 through ct.

Â Where each character ci is computed as mi plus k mod 26.

Â As we have said, decryption just reverses this process.

Â So that the decryption of a ciphertext consisting of character c1 through ct

Â using the key k is done, by simply outputting the message consisting of

Â the characters m1 through mt.

Â Where each mi is the c1 minus k mod 26.

Â I leave it to you to convince yourselves that correctness holds.

Â Is the shift cipher secure?

Â It should be pretty clear that it's not.

Â Note that there are only 26 possible keys.

Â So given a ciphertext,

Â an attacker can simply try decrypting that ciphertext using every possible key.

Â At a minimum, this will narrow down the plaintext to one of only 26 possibilities.

Â More likely though,

Â only one of those possibilities will make sense as normal English text.

Â And that will immediately let the attacker identify that

Â possibility as the true message.

Â For example, imagine you've intercepted the ciphertext displayed here.

Â If you tried decrypting using every possible value of the key.

Â You'll get a list containing 25 strings of gibberish plus one that says, hello world.

Â That tells you exactly what message was encrypted to give the ciphertext.

Â Something implicit in the attack I just described is that the attacker is

Â assumed to know the encryption scheme the communicating parties are using.

Â This is known as Kerckhoffs's principle,

Â which states that the encryption scheme being used is not to be considered secret.

Â But instead, the only secret information is the key shared by the parties.

Â This implies that the key must be chosen randomly.

Â If not, then the attacker knows it.

Â And furthermore, that this key must be kept secret by the parties

Â sharing that key.

Â Sometimes, people argue that Kerckhoff's principle doesn't make sense.

Â And that it might give better security to also keep the encryption scheme

Â itself secret.

Â There are several arguments against this line of thinking.

Â First, it is much easier to maintain secrecy of a short key,

Â rather than a more complex algorithm.

Â Similarly, it's easier to change the key shared by two parties than to

Â change the algorithms they're using.

Â Perhaps most importantly,

Â allowing the details of the encryption scheme to be public.

Â Means that we can develop standardized encryption schemes that anyone can use.

Â This makes it much easier for encryption schemes to be deployed and adopted.

Â And also ensures that these schemes receive public scrutiny.

Â Thereby increasing our confidence in their security.

Â The key space of an encryption scheme is just the set of all possible keys that

Â can be output by the key generation algorithm.

Â An important take away point from our analysis of the shift cipher is that in

Â order to be secure, an encryption scheme must at a minimum have a key

Â space large enough to prevent a brute force exhaustive search attack.

Â Like the one we just described.

Â As we will see however, having a large key space does not necessarily guarantee that

Â an encryption scheme is secure.

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