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.

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

Maryland Cybersecurity Center

[SOUND] Up to now, in our discussion of number theory,

Â we've only considered number theoretic problems that are easy, i.e.,.

Â that can be solved in polynomial time.

Â But what's interesting to cryptographers is

Â that there are some problems that are conjectured to be hard, that is,

Â are conjectured to not be solvable in polynomial time.

Â And maybe the most basic and

Â the most well-known of these is the problem of factoring.

Â And we know of course that multiplying two numbers is easy.

Â We already talked about this in a previous lecture.

Â However, breaking a product into it's constituent factors appears to be hard.

Â That is, if we're given two integers x and

Â y, it's easy to compute their product x times y.

Â However, given the product, given the result x times y,

Â it appears to be difficult to find x and y.

Â Just as a way of comparison,

Â imagine if I gave you the problem of multiplying these two integers.

Â You could easily do that or you could find a program to do it for you,

Â or write a program yourself.

Â However, if I ask you instead to find the factors of this large number, well,

Â there's no immediate way to do that.

Â Of course in this particular case, the number is small enough that you could

Â find something find a program that would allow you to factor it.

Â But the point is that it's a much harder problem than multiplication is.

Â Of course we have to be a little bit careful.

Â It's not hard to factor all numbers.

Â If we pick a random number, for example.

Â Well, half the time that number will be even, and

Â it's easy to factor even numbers, right?

Â One of the factors of any even number is two, and we can easily divide by two and

Â find another factor.

Â So we can find two integers whose product is the number we're given.

Â And similarly, if we pick a random number,

Â then one third of the time the random number will be divisible by three, and

Â that gives us yet another way to factor a random number.

Â So what we mean actually is something a little bit different from factoring

Â random numbers.

Â And in fact the hardest numbers to factor seem to

Â be those that are the product of two equal length primes.

Â So we're interested in the problem of factoring numbers of a specific form.

Â That is, numbers that are the product of two large primes, and

Â in particular two equal length primes.

Â Now it turns out that the factoring problem, no matter how popular and

Â widespread it is, is not directly useful for much of cryptography.

Â And for that reason we're not going to spend time formalizing it.

Â What we're going to do instead is to introduce a problem that has had

Â more applications to cryptography, which is related to but

Â not identical to factoring, and this is the RSA problem.

Â So let me describe a little bit about the setting before we

Â formally define the problem.

Â For the rest of this lecture, we're going to only consider numbers and or

Â rather the, when we talk about an integer N, we're going to

Â only mean an integer N which is the product of two primes, P and Q.

Â Where P and Q are distinct and odd.

Â And their also going, going to in practice, be the same length.

Â But that won't really affect anything we say here.

Â So recall that Zn star is the set of

Â invertible elements under multiplication module n and this gives a group.

Â We said last that the order of Zn star is exactly phi

Â of N which is equal to p minus 1 times q minus 1.

Â And the first thing to note is that for somebody who knows the factors of N,

Â the group order that is phi of N is easy to compute.

Â We just take p minus 1 and multiply it by q minus 1.

Â However, if we just give somebody N, but do not give them the factors p and

Â q, it turns out that phi of N is hard to compute from N alone.

Â And in fact you can show that computing phi of N given N

Â is equivalent to factoring N.

Â So what we have here is a situation where if we publish N then somebody who knows

Â the, the factorization of N can compute the group order,

Â or the order of the of the group Zn star.

Â But somebody who does not know the factorization of N can still

Â perform operations in the group Zn star.

Â They can still multiply elements and reduce the modulo N.

Â However, they are not able to compute the order of the group they're working in.

Â And that's a very interesting asymmetry that we'll show how to

Â exploit in a moment.

Â Remember, at the end of last lecture, we gave a result that said in

Â particular that if g is a finite group of order m, then for

Â any integer e the function by which we raise elements of that group to the eth

Â power is the permutation, if the gcd of e and m is equal one.

Â In our setting, we have a group Z, n star of order phi of N.

Â Whether that order is known or not, it's not relevant here, it has order phi of N.

Â If we therefore fix an integer e whose greatest common

Â divisor with phi of N is equal to one, then the previous results tells us that

Â raising to the eth power is a permutation in this group.

Â So raising to the eth power permeates the elements of zn star.

Â Furthermore we said that if d is equal to e inverse mod n.

Â Then fd, that is,

Â raising things to the dth power, is the inverse of the function fe.

Â That is, raising to the dth power undoes, as it were,

Â the operation of raising to the eth power.

Â So let's think about what this means.

Â So we again have our group Zn star of order phi of N.

Â If we fix e with gcd of e phi of N equal to 1,

Â then raising to the e-th power is a permutation on Z n star.

Â And if ed is equal to 1 mod inve of N, that is d is equal to e inverse mod inve

Â of N, then raising the the d-th power is the inverse of raising the the e-th power.

Â To the e raised to the dth power will give you back x, and

Â similarly x to the d raised to the eth power will also give you back x.

Â Another way to say this is that, the element x to the d, taken modulo N here,

Â but that's implied, because we're working in the group Z n star.

Â The element x to the d is the eth root of x modulo N.

Â So why is it an eth root?

Â Well it's an eth root because if we take x to the d and

Â raise it to the eth power we get x.

Â So it's certainly an eth root.

Â Moreover it's a unique eth root, it's the unique eth root because of

Â the fact that raising to the eth power is a permutation.

Â So again, this means that the element, or, or

Â the result X to the D is the E-th root of X, where we'd work modular N.

Â So if p and q are known, right?

Â If the factorization of the modulus N is known,

Â then we've seen already that phi of N can be computed.

Â This implies that d equals e inverse mod phi can then be computed.

Â We didn't talk specifically about this however it turns out you can compute

Â inverses modulo any know modulo, so phi (N) is known we can compute the inverse

Â of e modulo phi(N) and that means that it's possible to compute.

Â E-th roots modulo N.

Â Again, for any element X,

Â if I want to compute it's e-th root, I just compute x to the d mod N.

Â On the other hand, if p and

Â q are not known, then computing phi of N is as hard as factoring N.

Â And since we don't have phi of N,

Â we certainly can't easily compute e inverse modular phi of N.

Â It's hard to imagine computing an inverse when we don't even know what modulus we're

Â working with respect to.

Â And in fact you can prove this.

Â You can show that computing e inverse mod phi of N, computing some element d,

Â such that d times e is equal to 1 mod phi of N, is also as hard as factoring N.

Â And this is very useful for public key cryptography.

Â Right, and it seems to be that if we don't have d,

Â then there's no other way to compute the e-th root of elements modulo N.

Â Now we unfortunately cannot show that that's equivalent to factoring N, and

Â we therefore are going to state this as an independence assumption called

Â the RSA assumption.

Â So the RSA assumption informally.

Â Says exactly that given a modulus N and some energy e,

Â relatively prime to phi of N, it's hard to compute e-th root's modulo N.

Â Or more specifically it's hard to compute the e-th root of

Â some uniform element y chosen uniformly as Zn star.

Â Now, if we wanted to find this assumption formally,

Â we need to be a little bit more careful and specify how N and e are generated.

Â So let's, abstractly for now, let GenRSA be some algorithm that on input

Â 1 to the n, right, where little n, if you remember from back previously

Â security parameter is going to output three elements, N, e and d.

Â where N is equal to pq, and p and q are two n-bit primes.

Â And furthermore, with e times d equal to 1 mod phi of N.

Â So we have such an algorithm.

Â Well, we can then define an experiment RSA inverse relative to

Â that GenRSA and relative to any algorithm a.

Â The experiment is defined in the following way.

Â What we do is we run GenRSA on the given value of

Â the security parameter to generate our modulus N and our integers e and d.

Â We then choose a uniform element, y, in Zn star.

Â And we give to our algorithm A, N, e and this value y.

Â And we're essentially asking A to compute an eth root of y modulo N.

Â So A will output some x, and the experiment evaluates to one or

Â A is successful if it indeed outputs an e That is,

Â if it outputs a value x for which x to the e is equal to y modulo N.

Â And we'll say the RSA problem is hard relative to GenRSA.

Â So relative to this way of generating the modulus N and the integer e.

Â If it holds that for all probabilistic polynomial time algorithms A.

Â The probability with which A can succeed in the previous experiment.

Â That is the probability with which A can compute and

Â eth route of a uniform element of VN star is negligible.

Â Now in practice we have to fix some way of implementing GenRSA, but

Â there's a very natural way to do that.

Â And the natural way to do that is to first gen for,

Â generate uniform n-bit primes, p and q, and then multiply them.

Â We won't go into the details of how you can generate these n-bit primes, but

Â it turns out that this can be done.

Â It's a problem that's been studied quite a bit.

Â And we do have mechanisms for doing that.

Â They're not trivial, and they're very interesting.

Â But we won't have time to go into them here.

Â But if you grant me that we can do that,

Â then the rest of the algorithm is straightforward.

Â We generate our, our uniform n bit primes p and q, we multiply to get the modulus N,

Â and then we're free to choose e arbitrarily so

Â long as the gcd of e and phi of N is equal to 1.

Â Once we've done that we can compute the inverse of modulus phi of N,

Â we said earlier that this can be done efficiently.

Â And then we simply output an e and d.

Â Now, it's a little bit

Â interesting that we didn't pin down exactly how e can be chosen.

Â And it turns out that the way e is

Â chosen does not really seem to effect hardness of the RSA problem.

Â Or what I should say more carefully is that several different ways of

Â choosing e seem to give equivalent hardness when it comes to the RSA problem.

Â In practice, it's very common to set e, e equal to 3.

Â Or e equal to two to the 16 plus 1.

Â And the reason for that is to allow efficient exponentiation.

Â So think about e equals 3 in particular e equals 3 is a small number.

Â And therefore raising to the eth power is very efficient, can be done very quickly.

Â Similarly, e equals 2 the 16 plus 1 if you think about the way

Â that's written in binary.

Â 2 the 16 plus one will be an integer with exactly two ones and the rest zeros.

Â And if you think about also the way we defined our exponentiation algorithm,

Â this will also lead to an efficient way an efficient algorithm for

Â raising things to the eth power.

Â So if you do things this way,

Â you just have to be a little bit careful to choose p and q in such a way that phi

Â of N will be relatively prime to one of these values of e.

Â Now, if factoring moduli output by GenRSA is easy, that is,

Â if given some modulus N output by GenRSA.

Â I could easily factor it.

Â Then the RSA problem cannot possibly be hard relative to GenRSA.

Â And the reason for that is that if we can factor the modulus N, we get p and q.

Â We can then compute phi of N, we can then compute d as e inverse mod phi of N, and

Â we can then take eth roots like anybody else.

Â So what this means is that if factoring is easy then the RSA problem is easy.

Â And so factoring being hard is a necessary condition for

Â the RSA problem to possibly be hard.

Â On the other hand, as I mentioned a few minutes ago.

Â Hardness of the RSA problem is not known to be implied by the hardness of

Â the factoring problem.

Â So we don't know that hardness of factoring implies hardness of RSA.

Â And it's possible though we believe it to be unlikely,

Â that factoring is hard but RSA, but the RSA problem is easy.

Â Now, as far as we know, and as far as our current algorithms lead us to believe,

Â the RSA problem is equally as hard as factoring.

Â the, the algorithms we know for

Â solving RSA all work by first factoring the modulus N.

Â So even though it's true that mathematically speaking and formally

Â speaking the factoring, hardness of factoring does not imply hardness of RSA.

Â As far as cryptographic assumptions go, it's as reasonable to assume that the RSA

Â problem is hard, as it is currently to assume that factoring is hard.

Â In the next lecture, we'll introduce another class of

Â cryptographic assumptions that are based on cyclic groups.

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