Docsity

Lattice Based Cryptography, Lecture notes of Mathematics

Toggle sidebar
bg1
11
Lattice based cryptography
Lattice based public key encryption (and its cousins known as
knapsack and coding based encryption) have almost as long a his-
tory as discrete logarithm and factoring based schemes. Already in
1976, right after the Diffie-Hellman key exchange was discovered
(and before RSA), Ralph Merkle was working on building public key
encryption from the NP hard knapsack problem (see Diffieโ€™s recollec-
tion). This can be thought of as the task of solving a linear equation
of the form ๐ด๐‘ฅ = ๐‘ฆ(where ๐ดis a given matrix, ๐‘ฆis a given vector,
and the unknown are ๐‘ฅ) over the real numbers but with the addi-
tional constraint that ๐‘ฅmust be either 0or 1. His proposal evolved into
the Merkle-Hellman system proposed in 1978 (which was broken in
1984).
McEliece proposed in 1978 a system based on the difficulty of the
decoding problem for general linear codes. This is the task of solving
noisy linear equations where one is given ๐ดand ๐‘ฆsuch that ๐‘ฆ=๐ด๐‘ฅ+๐‘’
for a โ€œsmallโ€ error vector ๐‘’, and needs to recover ๐‘ฅ. Crucially, here
we work in a finite field, such as working modulo ๐‘žfor some prime
๐‘ž(that can even be 2) rather than over the reals or rationals. There
are special matrices ๐ดโˆ—for which we know how to solve this problem
efficiently: these are known as efficiently decodable error correcting
codes. McEliece suggested a scheme where the key generator lets ๐ดbe
a โ€œscrambledโ€ version of a special ๐ดโˆ—(based on the Goppa algebraic
geometric code). So, someone that knows the scrambling could solve
the problem, but (hopefully) someone that doesnโ€™t know it wouldnโ€™t.
McElieceโ€™s system has so far not been broken.
In a 1996 breakthrough, Ajtai showed a private key scheme based
on integer lattices that had a very curious property- its security could
be based on the assumption that certain problems were only hard in
the worst case, and moreover variants of these problems were known
to be NP hard. This re-ignited the hope that we could perhaps realize
the old dream of basing crypto on the mere assumption that ๐‘ƒ โ‰ NP.
Compiled on 11.17.2021 22:35
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Lattice Based Cryptography and more Lecture notes Mathematics in PDF only on Docsity!

Lattice based cryptography

Lattice based public key encryption (and its cousins known as knapsack and coding based encryption) have almost as long a his- tory as discrete logarithm and factoring based schemes. Already in 1976, right after the Diffie-Hellman key exchange was discovered (and before RSA), Ralph Merkle was working on building public key encryption from the NP hard knapsack problem (see Diffieโ€™s recollec- tion). This can be thought of as the task of solving a linear equation of the form ๐ด๐‘ฅ = ๐‘ฆ (where ๐ด is a given matrix, ๐‘ฆ is a given vector, and the unknown are ๐‘ฅ) over the real numbers but with the addi- tional constraint that ๐‘ฅ must be either 0 or 1. His proposal evolved into the Merkle-Hellman system proposed in 1978 (which was broken in 1984). McEliece proposed in 1978 a system based on the difficulty of the decoding problem for general linear codes. This is the task of solving noisy linear equations where one is given ๐ด and ๐‘ฆ such that ๐‘ฆ = ๐ด๐‘ฅ + ๐‘’ for a โ€œsmallโ€ error vector ๐‘’, and needs to recover ๐‘ฅ. Crucially, here we work in a finite field, such as working modulo ๐‘ž for some prime ๐‘ž (that can even be 2 ) rather than over the reals or rationals. There are special matrices ๐ดโˆ—^ for which we know how to solve this problem efficiently: these are known as efficiently decodable error correcting codes. McEliece suggested a scheme where the key generator lets ๐ด be a โ€œscrambledโ€ version of a special ๐ดโˆ—^ (based on the Goppa algebraic geometric code). So, someone that knows the scrambling could solve the problem, but (hopefully) someone that doesnโ€™t know it wouldnโ€™t. McElieceโ€™s system has so far not been broken. In a 1996 breakthrough, Ajtai showed a private key scheme based on integer lattices that had a very curious property- its security could be based on the assumption that certain problems were only hard in the worst case , and moreover variants of these problems were known to be NP hard. This re-ignited the hope that we could perhaps realize the old dream of basing crypto on the mere assumption that ๐‘ƒ โ‰  NP.

Compiled on 11.17.2021 22:

238 an intensive introduction to cryptography

Alas, we now understand that there are fundamental barriers to this approach. Nevertheless, Ajtaiโ€™s work attracted significant interest, and within a year both Ajtai and Dwork, as well as Goldreich, Goldwasser and Halevi came up with lattice based constructions for public key encryp- tion (the former based also on worst case assumptions). At about the same time, Hoffstein, Pipher, and Silverman came up with their NTRU public key system which is based on stronger assumptions but offers better performance, and they started a company around it together with Daniel Lieman. You may note that I havenโ€™t yet said what lattices are; we will do so later, but for now if you simply think of questions involving linear equations modulo some prime ๐‘ž, you will get enough of the intuition that you need. (The lattice viewpoint is more geometric, and weโ€™ll discuss it more below; it was first used to attack cryptosystems and in particular break the Merkle-Hellman knapsack scheme and many of its variants.) Lattice based cryptography has captured a lot of attention recently from both theory and practice. In the theory side, many cool new constructions are now based on lattice based cryptography, and chief among them fully homomorphic encryption, as well as indistinguisha- bility obfuscation (though the latterโ€™s securityโ€™s foundations are still far less solid). On the applied side, the steady advances in the technol- ogy of quantum computers have finally gotten practitioners worried about RSA, Diffie Hellman and Elliptic Curves. While current con- structions for quantum computers are nowhere near being able to, say, factor larger numbers that can be done classically (or even than can be done by hand), given that it takes many years to develop new standards and get them deployed, many believe the effort to transition away from these factoring/dlog based schemes should start today (or perhaps should have started several years ago). Based on this, the Na- tional Institute of Standards and Technology has started a process to identify โ€œpost quantumโ€ public key encryption scheme. All the finalist for public-key encryption are based on lattices/codes. Cryptography has the peculiar/unfortunate feature that if a ma- chine is built that can factor large integers in 20 years, it can still be used to break the communication we transmit today , provided this communication was recorded. So, if you have some data that you expect youโ€™d want still kept secret in 20 years (as many government and commercial entities do), you might have reasons to worry. Cur- rently lattice based cryptography is the only real โ€œgame in townโ€ for potentially quantum-resistant public key encryption schemes.

240 an intensive introduction to cryptography

(^2) Inner products can be defined more generally, and in particular over fields such as the complex numbers we would define the inner product as โˆ‘ ๐‘ข๐‘–๐‘ฃ๐‘– where for ๐‘Ž โˆˆ โ„‚, ๐‘Ž denotes the complex conjugate of ๐‘Ž. However, we stick to this simple case for this chapter.

  • The inner product (also known as โ€œdot productโ€) โŸจ๐‘ข, ๐‘ฃโŸฉ between two vectors of the same dimension ๐‘› is defined as โˆ‘ ๐‘ข๐‘–๐‘ฃ๐‘– (addition done in the field ๐”ฝ).^2
  • The matrix product AB of an ๐‘š ร— ๐‘˜ and a ๐‘˜ ร— ๐‘› matrix results in an ๐‘š ร— ๐‘› matrix. If we think of the rows of ๐ด as the vectors ๐ด 1 , โ€ฆ , ๐ด๐‘š โˆˆ ๐”ฝ๐‘˜^ and the columns of ๐ต as ๐ต 1 , โ€ฆ , ๐ต๐‘› โˆˆ ๐”ฝ๐‘˜, then the (๐‘–, ๐‘—)-th coordinate of AB is โŸจ๐ด๐‘–, ๐ต๐‘—โŸฉ. Matrix product is associative and satisfies the distributive law but is not commutative : there are pairs of square matrices ๐ด, ๐ต such that AB โ‰  BA.
  • The transpose of an ๐‘› ร— ๐‘š matrix ๐ด is the ๐‘š ร— ๐‘› matrix ๐ดโŠค^ such that (๐ดโŠค)๐‘–,๐‘— = ๐ด๐‘—,๐‘–.
  • The inverse of a square ๐‘› ร— ๐‘› matrix ๐ด is the matrix ๐ดโˆ’1^ such that AA โˆ’1^ = ๐ผ where ๐ผ is the ๐‘› ร— ๐‘› identity matrix such that ๐ผ๐‘–,๐‘— = 1 if ๐‘– = ๐‘— and ๐ผ๐‘–,๐‘— = 0 otherwise.
  • The rank of an ๐‘š ร— ๐‘› matrix ๐ด is the minimum number ๐‘Ÿ such that we can write ๐ด as โˆ‘๐‘Ÿ๐‘–=1 ๐‘ข๐‘–(๐‘ฃ๐‘–)โŠค^ where ๐‘ข๐‘– โˆˆ ๐”ฝ๐‘š^ and ๐‘ฃ๐‘– โˆˆ ๐”ฝ๐‘›. We can think of the ๐‘ข๐‘–โ€™s as the columns of an ๐‘š ร— ๐‘Ÿ matrix ๐‘ˆ and the ๐‘ฃ๐‘–โ€™s as the rows of an ๐‘Ÿ ร— ๐‘› matrix ๐‘‰ , and hence the rank of ๐ด is the minimum ๐‘Ÿ such that ๐ด = UV where ๐‘ˆ is ๐‘š ร— ๐‘Ÿ and ๐‘‰ is ๐‘Ÿ ร— ๐‘›. It can be shown that an ๐‘› ร— ๐‘› matrix is full rank if and only if it has an inverse.
  • Solving linear equations can be thought of as the task of given an ๐‘šร— ๐‘› matrix ๐ด and ๐‘š-dimensional vector ๐‘ฆ, finding the ๐‘›-dimensional vector ๐‘ฅ such that ๐ด๐‘ฅ = ๐‘ฆ. If the rank of ๐ด is at least ๐‘› (which in particular means that ๐‘š โ‰ฅ ๐‘›) then by dropping ๐‘š โˆ’ ๐‘› rows of ๐ด and coordinates of ๐‘ฆ we can obtain the equation ๐ดโ€ฒ๐‘ฅ = ๐‘ฆโ€ฒ^ where ๐ดโ€ฒ^ is an ๐‘› ร— ๐‘› matrix that has an inverse. In this case a solution (if it exists) will be equal to (๐ดโ€ฒ)โˆ’1๐‘ฆ. If for a set of equations we have ๐‘š > ๐‘› and we can find two such matrices ๐ดโ€ฒ, ๐ดโ€ณ^ such that (๐ดโ€ฒ)โˆ’1๐‘ฆ โ‰  (๐ดโ€ณ)โˆ’1๐‘ฆ then we say it is over determined and in such a case it has no solutions. If a set of equations has more variables ๐‘› than equations ๐‘š we say itโ€™s under-determined. In such a case it either has no solutions or the solutions form an affine subspace of dimension at least ๐‘› โˆ’ ๐‘š.
  • The gaussian elimination algorithm can be used to obtain, given a set of equations ๐ด๐‘ฅ = ๐‘ฆ a solution to ๐‘ฅ if such exists or a certification that no solution exists. It can be executed in time polynomial in the dimensions and the bit complexity of the numbers involved. This algorithm can also be used to obtain an inverse of a given matrix ๐ด, if such an inverse exists.

lattice based cryptography 241

(^3) Despite the name, Gaussian elimination has been known to Chinese mathematicians since 150BC or so, and was popularized in the west through the 1670 notes of Isaac Newton, more than 100 years before Gauss was born.

R Remark 11.1 โ€” Keep track of dimensions!. Through- out this chapter, and while working in lattice based cryptography in general, it is crucial to keep track of the dimensions. Whenever you see a symbol such as ๐‘ฃ, ๐ด, ๐‘ฅ, ๐‘ฆ ask yourself:

  • Is it a scalar , a vector or a matrix?
  • If it is a vector or a matrix, what are its dimensions?
  • If itโ€™s a matrix, is it โ€œsquareโ€ (i.e., ๐‘š = ๐‘›), โ€œshort and fatโ€ (i.e., ๐‘š โ‰ช ๐‘›) or โ€œtall and skinnyโ€? (๐‘š โ‰ซ ๐‘›)?

11.1 A WORLD WITHOUT GAUSSIAN ELIMINATION

The general approach people use to get a public key encryption is to obtain a hard computational problem with some mathematical structure. Weโ€™ve seen this in the discrete logarithm problem, where the task is to invert the map ๐‘Ž โ†ฆ ๐‘”๐‘Ž^ (mod ๐‘), and the integer factoring problem, where the task is to invert the map ๐‘Ž, ๐‘ โ†ฆ ๐‘Ž โ‹… ๐‘. Perhaps the simplest structure to consider is the task of solving linear equations. Pretend that we didnโ€™t know of Gaussian elimination,^3 and that if we picked a โ€œgenericโ€ matrix ๐ด then the map ๐‘ฅ โ†ฆ ๐ด๐‘ฅ would be hard to invert. (Here and elsewhere, our default interpretation of a vector ๐‘ฅ is as a column vector, and hence if ๐‘ฅ is ๐‘› dimensional and ๐ด is ๐‘š ร— ๐‘› then ๐ด๐‘ฅ is ๐‘š dimensional. We use ๐‘ฅโŠค^ to denote the row vector obtained by transposing ๐‘ฅ.) Could we use that to get a public key encryption scheme? Here is a concrete approach. Let us fix some prime ๐‘ž (think of it as polynomial size, e.g., ๐‘ž is smaller than 1024 or so, though people can and sometimes do consider ๐‘ž of exponential size), and all computation below will be done modulo ๐‘ž. The secret key is a vector ๐‘ฅ โˆˆ โ„ค๐‘›๐‘ž , and the public key is (๐ด, ๐‘ฆ) where ๐ด is a random ๐‘š ร— ๐‘› matrix with entries in โ„ค๐‘ž and ๐‘ฆ = ๐ด๐‘ฅ. Under our assumption, it is hard to recover the secret key from the public key, but how do we use the public key to encrypt? The crucial observation is that even if we donโ€™t know how to solve linear equations, we can still combine several equations to get new ones. To keep things simple, letโ€™s consider the case of encrypting a single bit.

P If you have a CPA secure public key encryption scheme for single bit messages then you can extend

lattice based cryptography 243

(^4) Over โ„ค๐‘ž, we can think of ๐‘ž โˆ’ 1 also as the number โˆ’1, and so on. Thus if ๐‘Ž โˆˆ โ„ค๐‘ž, we define |๐‘Ž| to be the minimum of ๐‘Ž and ๐‘ž โˆ’ ๐‘Ž. This ensures the absolute value satisfies the natural property of |๐‘Ž| = | โˆ’ ๐‘Ž|.

P Please stop here and make sure that you see why this is a valid encryption (not in the sense that it is secure - itโ€™s not - but in the sense that decryption of an encryption of ๐‘ returns the bit ๐‘), and this descrip- tion corresponds to the previous one; as usual all calculations are done modulo ๐‘ž.

11.2 SECURITY IN THE REAL WORLD.

Like it or not (and cryptographers typically donโ€™t) Gaussian elimina- tion is possible in the real world and the scheme above is completely insecure. However, the Gaussian elimination algorithm is extremely brittle. Errors tend to be amplified when you combine equations. This is usually thought of as a bad thing, and numerical analysis is much about dealing with this issue. However, from the cryptographic point of view, these errors can be our saving grace and enable us to salvage the security of the ridiculous scheme above. To see why Gaussian elimination is brittle, let us recall how it works. Think of ๐‘š = ๐‘› for simplicity. Given equations ๐ด๐‘ฅ = ๐‘ฆ in the unknown variables ๐‘ฅ, the goal of Gaussian elimination is to trans- form them into the equations ๐ผ๐‘ฅ = ๐‘ฆโ€ฒ^ where ๐ผ is the identity matrix (and hence the solution is simply ๐‘ฅ = ๐‘ฆโ€ฒ). Recall how we do it: by rearranging and scaling, we can assume that the top left corner of ๐ด is equal to 1 , and then we add the first equation to the other equa- tions (scaled appropriately) to zero out the first entry in all the other rows of ๐ด (i.e., make the first column of ๐ด equal to (1, 0, โ€ฆ , 0)) and continue onwards to the second column and so on and so forth. Now, suppose that the equations were noisy , in the sense that we added to ๐‘ฆ a vector ๐‘’ โˆˆ โ„ค๐‘š๐‘ž such that |๐‘’๐‘–| < ๐›ฟ๐‘ž for every ๐‘–.^4 Even ignor- ing the effect of the scaling step, simply adding the first equation to the rest of the equations would typically tend to increase the relative error of equations 2, โ€ฆ , ๐‘š from โ‰ˆ ๐›ฟ to โ‰ˆ 2๐›ฟ. Now, when we repeat the process, we increase the error of equations 3, โ€ฆ , ๐‘š from โ‰ˆ 2๐›ฟ to โ‰ˆ 4๐›ฟ, and we see that by the time weโ€™re done dealing with about ๐‘›/ variables, the remaining equations have error level roughly 2 ๐‘›/2๐›ฟ. So, unless ๐›ฟ was truly tiny (and ๐‘ž truly big, in which case the difference between working in โ„ค๐‘ž and simply working with integers or rationals disappears), the resulting equations have the form ๐ผ๐‘ฅ = ๐‘ฆโ€ฒ^ + ๐‘’โ€ฒ^ where ๐‘’โ€ฒ^ is so big that we get no information on ๐‘ฅ. The Learning With Errors (LWE) conjecture is that this is inherent :

244 an intensive introduction to cryptography

(^6) One can think of ๐‘’ as chosen by simply letting every coordinate be chosen at random in {โˆ’๐›ฟ๐‘ž, โˆ’๐›ฟ๐‘ž + 1, โ€ฆ , +๐›ฟ๐‘ž}. For technical reasons, we sometimes consider other distributions and in particular the discrete Gaussian distribution which is obtained by letting every coordinate of ๐‘’ be an independent Gaussian random variable with standard deviation ๐›ฟ๐‘ž, conditioned on it being an integer. (A closely related distribution is obtained by picking such a Gaussian random variable and then rounding it to the nearest integer.) (^6) People sometimes also consider variants where both ๐‘(๐‘›) and ๐‘ž(๐‘›) can be as large as exponential.

Conjecture (Learning with Errors, Regev 2005): Let ๐‘ž = ๐‘ž(๐‘›) and ๐›ฟ = ๐›ฟ(๐‘›) be some functions. The Learning with Error (LWE) conjecture with respect to ๐‘ž, ๐›ฟ,denoted as LWE ๐‘ž,๐›ฟ, is the following conjecture: for every polynomial ๐‘š(๐‘›) and polynomial-time adversary ๐‘…,

Pr[๐‘…(๐ด, ๐ด๐‘ฅ + ๐‘’) = ๐‘ฅ] < ๐‘›๐‘’๐‘”๐‘™(๐‘›) where for ๐‘ž = ๐‘ž(๐‘›) and ๐›ฟ = ๐›ฟ(๐‘›), this probability is taken over ๐ด a random ๐‘š ร— ๐‘› matrix over โ„ค๐‘ž, ๐‘ฅ a random vector in โ„ค๐‘›๐‘ž , and ๐‘’ a random โ€œnoise vectorโ€ in โ„ค๐‘š๐‘ž where |๐‘’๐‘–| < ๐›ฟ๐‘ž for every ๐‘– โˆˆ [๐‘š]. 5 The LWE conjecture (without any parameters) is that there is some absolute constant ๐‘ such that for every polynomial ๐‘(๐‘›) there, if ๐‘ž(๐‘›) > ๐‘(๐‘›)๐‘^ then LWE holds with respect to ๐‘ž(๐‘›) and ๐›ฟ(๐‘›) = 1/๐‘(๐‘›). 6

It is important to note the order of quantifiers in the learning with error conjecture. If we want to handle a noise of low enough mag- nitude (say ๐›ฟ(๐‘›) = 1/๐‘›^2 ) then we need to choose the modulos ๐‘ž to be large enough (for example it is believed that ๐‘ž > ๐‘›^4 will be good enough for this case) and then the adversary can choose ๐‘š(๐‘›) to be as big a polynomial as they like, and of course run in time which is an ar- bitrary polynomial in ๐‘›. Therefore we can think of such an adversary ๐‘… as getting access to a โ€œmagic boxโ€ that they can use ๐‘š = ๐‘๐‘œ๐‘™๐‘ฆ(๐‘›) number of times to get โ€œnoisy equations on ๐‘ฅโ€ of the form (๐‘Ž๐‘–, ๐‘ฆ๐‘–) with ๐‘Ž๐‘– โˆˆ โ„ค๐‘›๐‘ž , ๐‘ฆ๐‘– โˆˆ โ„ค๐‘ž where ๐‘ฆ๐‘– = โŸจ๐‘Ž๐‘–, ๐‘ฅโŸฉ + ๐‘’๐‘–.

P The LWE conjecture posits that no efficient algorithm can recover ๐‘ฅ given ๐ด and ๐ด๐‘ฅ + ๐‘’. But you might wonder whether itโ€™s possible to do this is inefficiently. The answer is yes. Intuitively the reason is that if we have more equations than unknown (i.e., if ๐‘š > ๐‘›) then these equations contain enough information to determine the unknown variables even if they are noisy. It can be shown that if ๐‘š is sufficiently large (๐‘š > 10๐‘› will do) then with high probability over ๐ด, ๐‘ฅ, ๐‘’, given ๐ด and ๐‘ฆ = ๐‘ฅ + ๐‘’, if we enumerate over all ๐‘ฅ ฬƒโˆˆ โ„ค๐‘›๐‘ž and output the string minimizing |๐ดฬƒ๐‘ฅ โˆ’ ๐‘ฆ| (where we define |๐‘ฃ| = โˆ‘ |๐‘ฃ๐‘–| for a vector ๐‘ฃ), then ๐‘ฅฬƒ will equal ๐‘ฅ. It is a good exercise to work out the details, but a hint is this can be proven by showing that for every ๐‘ฅฬƒ โ‰  ๐‘ฅ, with high probability over ๐ด, |๐ดฬƒ๐‘ฅ โˆ’ ๐ด๐‘ฅ| > ๐›ฟ๐‘ž๐‘š. The latter fact holds because ๐‘ฃ = ๐ด(๐‘ฅ โˆ’ฬƒ ๐‘ฅ) is a random vector in โ„ค๐‘š๐‘ž , and the probability that |๐‘ฃ| < ๐›ฟ๐‘ž๐‘š is

246 an intensive introduction to cryptography

Our algorithm ๐‘† gets as input the pair (๐ด, ๐‘ฆ) where ๐‘ฆ = ๐ด๐‘ฅ + ๐‘’ and we need to decide whether ๐‘ฅ 1 = ๐‘Ž. Now consider the instance (๐ด + (๐‘Ÿโ€–0๐‘šโ€– โ‹ฏ โ€–0๐‘š), ๐‘ฆ+๐‘Ž๐‘Ÿ), where ๐‘Ÿ is a random vector in โ„ค๐‘š๐‘ž and the matrix (๐‘Ÿโ€–0๐‘šโ€– โ‹ฏ โ€–0๐‘š) is simply the matrix with first column equal to ๐‘Ÿ and all other columns equal to 0. If ๐ด is random then ๐ด + (๐‘Ÿโ€–0๐‘šโ€– โ‹ฏ โ€–0๐‘š) is random as well. Now note that ๐ด๐‘ฅ + (๐‘Ÿโ€–0๐‘š^ โ‹ฏ โ€–0๐‘š)๐‘ฅ = ๐ด๐‘ฅ + ๐‘ฅ 1 ๐‘Ÿ and hence if ๐‘ฅ 1 = ๐‘Ž then we still have an input of the same form (๐ดโ€ฒ, ๐ดโ€ฒ๐‘ฅ + ๐‘’). In contrast, we claim that if if ๐‘ฅ 1 โ‰  ๐‘Ž then the distribution (๐ดโ€ฒ, ๐‘ฆโ€ฒ) where ๐ดโ€ฒ^ = ๐ด + (๐‘Ÿโ€–0๐‘šโ€– โ‹ฏ โ€–0๐‘š) and ๐‘ฆโ€ฒ^ = ๐ด๐‘ฅ + ๐‘’ + ๐‘Ž๐‘Ÿ is identical to the uniform distribution over a random uniformly chosen matrix ๐ดโ€ฒ and a random and independent uniformly chosen vector ๐‘ฆโ€ฒ. Indeed, we can write this distribution as (๐ดโ€ฒ, ๐‘ฆโ€ฒ) where ๐ดโ€ฒ^ is chosen uniformly at random, and ๐‘ฆโ€ฒ^ = ๐ดโ€ฒ๐‘ฅ + ๐‘’ + (๐‘Ž โˆ’ ๐‘ฅ 1 )๐‘Ÿ where ๐‘Ÿ is a random and in- dependent vector. (Can you see why?) Since ๐‘Ž โˆ’ ๐‘ฅ 1 โ‰  0, this amounts to adding a random and independent vector ๐‘Ÿ to ๐‘ฆโ€ฒ, which means that the distribution (๐ดโ€ฒ, ๐‘ฆโ€ฒ) is uniform and independent. Hence if we send the input (๐ดโ€ฒ, ๐‘ฆโ€ฒ) to our the decision algorithm ๐ท, then we would get 1 with probability ๐‘ + ๐œ– if ๐‘ฅ 1 = ๐‘Ž and an output of 1 with probability ๐‘ otherwise. Now the crucial observation is that if our decision algorithm ๐ท requires ๐‘š equations to succeed with bias ๐œ–, we can use 100๐‘š๐‘›/๐œ–^2 equations (which is still polynomial) to invoke it 100๐‘›/๐œ–^2 times. This allows us to distinguish with probability 1 โˆ’ 2โˆ’๐‘›^ between the case that ๐ท outputs 1 with probability ๐‘ + ๐œ– and the case that it outputs 1 with probability ๐‘ (this follows from the Chernoff bound; can you see why?). Hence by using polynomially more samples than the decision algorithm ๐ท, we get a search algorithm ๐‘† that can actually recover ๐‘ฅ. โ– 

11.4 AN LWE BASED ENCRYPTION SCHEME

We can now show the secure variant of our original encryption scheme:

LWE-based encryption LWE-ENC:

  • Parameters: Let ๐›ฟ(๐‘›) = 1/๐‘›^4 and let ๐‘ž = ๐‘๐‘œ๐‘™๐‘ฆ(๐‘›) be a prime such that LWE holds w.r.t. ๐‘ž, ๐›ฟ. We let ๐‘š = ๐‘›^2 log ๐‘ž.
  • Key generation: Pick ๐‘ฅ โˆˆ โ„ค๐‘›๐‘ž. The private key is ๐‘ฅ and the public key is (๐ด, ๐‘ฆ) with ๐‘ฆ = ๐ด๐‘ฅ + ๐‘’ with ๐‘’ a ๐›ฟ-noise vector and ๐ด a random ๐‘š ร— ๐‘› matrix.
  • Encrypt: To encrypt ๐‘ โˆˆ {0, 1} given the key (๐ด, ๐‘ฆ), pick ๐‘ค โˆˆ {0, 1}๐‘š^ and output

lattice based cryptography 247

(^7) In fact, due to the fact that the signs of the error vectorโ€™s entries are different, we expect the errors to have significant cancellations and hence we would expect โˆš |โŸจ๐‘ค, ๐‘’โŸฉ| to only be roughly of magnitude ๐‘š๐›ฟ๐‘ž, but this is not crucial for our discussions.

๐‘คโŠค๐ด, โŸจ๐‘ค, ๐‘ฆโŸฉ + ๐‘โŒŠ๐‘ž/2โŒ‹ (all computations are done in โ„ค๐‘ž).

  • Decrypt: To decrypt (๐‘Ž, ๐œŽ), output 0 iff |โŸจ๐‘Ž, ๐‘ฅโŸฉ โˆ’ ๐œŽ| < ๐‘ž/10.

P The scheme LWEENC is also described in Fig. 11. with slightly different notation. I highly recommend you stop and verify you understand why the two descriptions are equivalent.

Figure 11.2 : In the encryption scheme LWEENC, the public key is a matrix ๐ดโ€ฒ^ = (๐ด|๐‘ฆ), where ๐‘ฆ = ๐ด๐‘  + ๐‘’ and ๐‘  is the secret key. To encrypt a bit ๐‘ we choose a random ๐‘ค โ†๐‘… {0, 1}๐‘š, and output ๐‘คโŠค๐ดโ€ฒ^ + (0, โ€ฆ , 0, ๐‘โŒŠ ๐‘ž 2 โŒ‹). We decrypt ๐‘ โˆˆ โ„ค๐‘›+1๐‘ž to zero with key ๐‘  iff |โŸจ๐‘, (๐‘ , โˆ’1)โŸฉ| โ‰ค ๐‘ž/10 where the inner product is done modulo ๐‘ž.

Unlike our typical schemes, here it is not immediately clear that this encryption is valid, in the sense that the decrypting an encryption of ๐‘ returns the value ๐‘. But this is the case:

Lemma 11.3 With high probability, the decryption of the encryption of ๐‘ equals ๐‘.

Proof. โŸจ๐‘คโŠค๐ด, ๐‘ฅโŸฉ = โŸจ๐‘ค, ๐ด๐‘ฅโŸฉ. Hence, if ๐‘ฆ = ๐ด๐‘ฅ + ๐‘’ then โŸจ๐‘ค, ๐‘ฆโŸฉ = โŸจ๐‘คโŠค๐ด, ๐‘ฅโŸฉ + โŸจ๐‘ค, ๐‘’โŸฉ. But since every coordinate of ๐‘ค is either 0 or 1 , |โŸจ๐‘ค, ๐‘’โŸฉ| < ๐›ฟ๐‘š๐‘ž < ๐‘ž/10 for our choice of parameters.^7 So, we get that if ๐‘Ž = ๐‘คโŠค๐ด and ๐œŽ = โŸจ๐‘ค, ๐‘ฆโŸฉ + ๐‘โŒŠ๐‘ž/2โŒ‹ then ๐œŽ โˆ’ โŸจ๐‘Ž, ๐‘ฅโŸฉ = โŸจ๐‘ค, ๐‘’โŸฉ + ๐‘โŒŠ๐‘ž/2โŒ‹ which will be smaller than ๐‘ž/10 iff ๐‘ = 0. โ– 

We now prove security of the LWE based encryption:

Theorem 11.4 โ€” CPA security of LWEENC. If the LWE conjecture is true then LWEENC is CPA secure. For a public key encryption scheme with messages that are just bits, CPA security means that an encryption of 0 is indistinguishable from

lattice based cryptography 249

CLAIM : Suppose that ๐‘š > 100๐‘› log ๐‘ž. If ๐ดโ€ฒ^ is a random ๐‘š ร— ๐‘› + 1 matrix over โ„ค๐‘ž, then with probability at least 1 โˆ’ 2โˆ’๐‘›^ over the choice of ๐ดโ€ฒ, the distribution ๐‘๐ดโ€ฒ over โ„ค๐‘›+1๐‘ž which is obtained by choosing ๐‘ค at random in {0, 1}๐‘š^ and outputting ๐‘คโŠค๐ดโ€ฒ^ has at most 2 โˆ’๐‘›^ statistical distance from the uniform distribution over โ„ค๐‘›+1๐‘ž. Note that the randomness used for the distribution ๐‘๐ดโ€ฒ is only obtained by the choice of ๐‘ค, and not by the choice of ๐ดโ€ฒ^ that is fixed. (This passes a basic โ€œsanity checkโ€ since ๐‘ค has ๐‘š random bits, while the uniform distribution over โ„ค๐‘›๐‘ž requires ๐‘› log ๐‘ž โ‰ช ๐‘š random bits, and hence ๐‘๐ดโ€ฒ at least has a โ€œfighting chanceโ€ in being statisti- cally close to it.) Another way to state the same claim is that the pair (๐ดโ€ฒ, ๐‘คโŠค๐ดโ€ฒ) is statistically indistinguishable from the uniform distribu- tion (๐ดโ€ฒ, ๐‘ง) where ๐‘ง is a vector chosen independently at random from โ„ค๐‘›+1๐‘ž. The claim completes the proof of the lemma, since letting ๐ดโ€ฒ^ be the matrix (๐ด|๐‘ฆ) and ๐‘ง = (๐‘Ž, ๐œŽ), we see that the distribution ๐ทโ€ฒ, as the form (๐ดโ€ฒ, ๐‘ง) where ๐ดโ€ฒ^ is a uniformly random ๐‘š ร— (๐‘› + 1) matrix and ๐‘ง is sampled from ๐‘๐ดโ€ฒ (i.e., ๐‘ง = ๐‘คโŠค๐ดโ€ฒ^ where ๐‘ค is uniformly chosen in {0, 1}๐‘š). Hence this means that the statistical distance of ๐ทโ€ฒ^ from ๐ท (where all elements are uniform) is ๐‘‚(2โˆ’๐‘›). (Please make sure you understand this reasoning!) Proof of claim: The proof of this claim relies on the leftover hash lemma. First, the basic idea of the proof: For every ๐‘š ร— (๐‘› + 1) matrix ๐ดโ€ฒ over โ„ค๐‘ž, define โ„Ž๐ดโ€ฒ โˆถ โ„ค๐‘š๐‘ž โ†’ โ„ค๐‘›+1๐‘ž to be the map โ„Ž๐ดโ€ฒ (๐‘ค) = ๐‘คโŠค๐ดโ€ฒ. This collection can be shown to be a โ€œgoodโ€ hash function collection in some specific technical sense, which in particular implies that for every distribution ๐ท with much more than ๐‘› log ๐‘ž bits of min-entropy, with all but negligible probability over the choice of ๐ดโ€ฒ, โ„Ž๐ดโ€ฒ (๐ท) is sta- tistically indistinguishable from the uniform distribution. Now when we choose ๐‘ค at random in {0, 1}๐‘š, it is coming from a distribution with ๐‘š bits of entropy. If ๐‘š โ‰ซ (๐‘› + 1) log ๐‘ž, then because the output of this function is so much smaller than ๐‘š, we expect it to be completely uniform, and this is whatโ€™s shown by the leftover hash lemma. Now weโ€™ll formalize this blueprint. First we need the leftover hash lemma.

Lemma 11.6 Fix ๐œ– > 0. Let โ„‹ be a universal hash family with functions โ„Ž โˆถ ๐’ฒ โ†’ ๐’ฑ. Let ๐‘Š be a random variable with output in ๐’ฒ with ๐ปโˆž(๐‘Š ) โ‰ฅ log |๐’ฑ| + 2 log(1/๐œ–) โˆ’ 2. Then (๐ป(๐‘Š ), ๐ป) where ๐ป follows a uniform distribution over โ„‹ has statistical difference less than ๐œ– from (๐‘‰ , ๐ป) where ๐‘‰ is uniform over ๐’ฑ.

250 an intensive introduction to cryptography

(^8) This is based on notes from Daniel Wichsโ€™s class

To explain what a universal hash family is, a family โ„‹ of functions โ„Ž โˆถ ๐’ฒ โ†’ ๐’ฑ is a universal hash family if Prโ„Žโ†๐‘…โ„‹[โ„Ž(๐‘ฅ) = โ„Ž(๐‘ฅโ€ฒ)] โ‰ค (^) |๐’ฑ|^1 for all ๐‘ฅ โ‰  ๐‘ฅโ€ฒ. First, letโ€™s see why Lemma 11.6 implies the claim. Consider the hash family โ„‹ = {โ„Ž๐ดโ€ฒ }, where โ„Ž๐ดโ€ฒ โˆถ โ„ค๐‘š๐‘ž โ†’ โ„ค๐‘›+1๐‘ž is defined by โ„Ž๐ดโ€ฒ (๐‘ค) = ๐‘คโŠค๐ดโ€ฒ. For this hash family, the probability over ๐ดโ€ฒ^ of ๐‘ค โ‰  ๐‘คโ€ฒ colliding is Pr๐ดโ€ฒ [๐‘คโŠค๐ดโ€ฒ^ = ๐‘คโ€ฒโŠค๐ดโ€ฒ] = Pr๐ดโ€ฒ [(๐‘ค โˆ’ ๐‘คโ€ฒ)โŠค๐ดโ€ฒ^ = 0]. Since ๐ดโ€ฒ^ is random, this is 1/(๐‘ž๐‘›+1). So โ„‹ is a universal hash family. The min entropy of ๐‘ค โ†๐‘… {0, 1}๐‘š^ is the same as the entropy (be- cause it is uniform) which is ๐‘š. The output of the hash family is in โ„ค๐‘›+1๐‘ž , and log |โ„ค๐‘›+1๐‘ž | = (๐‘› + 1) log ๐‘ž. Since ๐‘š โ‰ฅ (๐‘› + 1) log ๐‘ž + 20๐‘› โˆ’ 2 by assumption, Lemma 11.6 implies that (๐‘คโŠค๐ดโ€ฒ, ๐ดโ€ฒ) is 2 โˆ’10๐‘›^ close in terms of statistical distance to (๐‘ง, ๐ดโ€ฒ) where ๐‘ง is chosen uniformly in โ„ค๐‘›+1๐‘ž. Now, weโ€™ll show this implies that for probability โ‰ฅ 1 โˆ’ 2โˆ’๐‘›^ over the selection of ๐ดโ€ฒ, the statistical distance between ๐‘คโŠค๐ดโ€ฒ^ and ๐‘ง is less than 2 โˆ’๐‘›. If not, the distance between (๐‘คโŠค๐ดโ€ฒ, ๐ดโ€ฒ) and (๐‘ง, ๐ดโ€ฒ) would be at least 2 โˆ’๐‘›^ โ‹… 2โˆ’๐‘›^ > 2โˆ’10๐‘›. Proof of Lemma 11.6:^8 Let ๐‘ be the random variable (๐ป(๐‘Š ), ๐ป), where the probability is over ๐ป and ๐‘Š. Let ๐‘โ€ฒ^ be an independent copy of ๐‘. Step 1: Pr[๐‘ = ๐‘โ€ฒ] โ‰ค (^) |โ„‹|โ‹…|๐’ฑ|^1 (1 + 4๐œ–^2 ). Indeed,

Pr[๐‘ = ๐‘โ€ฒ] = Pr[(๐ป(๐‘Š ), ๐ป) = (๐ปโ€ฒ(๐‘Š โ€ฒ), ๐ปโ€ฒ)] = Pr[๐ป = ๐ปโ€ฒ] โ‹… Pr[๐ป(๐‘Š ) = ๐ป(๐‘Š โ€ฒ)]

=

|โ„‹| (Pr[๐‘Š = ๐‘Š^

โ€ฒ] + Pr[๐ป(๐‘Š ) = ๐ป(๐‘Š โ€ฒ) โˆง ๐‘Š โ‰  ๐‘Š โ€ฒ])

(^1

๐œ–^2 โ‹… 4 + 1

(1 + 4๐œ–^2 ).

Step 2: The statistical difference between (๐ป(๐‘Š ), ๐ป) and (๐‘‰ , ๐ป) is less than ๐œ–. Denote the statistical difference by ฮ”((๐ป(๐‘Š ), ๐ป), (๐‘‰ , ๐ป)), then

โ„Ž,๐‘ค

โˆฃPr[๐‘ = (โ„Ž(๐‘ค), ๐‘ค)] โˆ’

252 an intensive introduction to cryptography

integer vector. There can be many different bases for the same lattice, and some of them are easier to work with than others (see Fig. 11.3).

Figure 11.3 : A lattice is a discrete subspace ๐ฟ โІ โ„๐‘›^ that is closed under integer combinations. A basis for the lattice is a minimal set ๐‘ 1 , โ€ฆ , ๐‘๐‘š (typically ๐‘š = ๐‘›) such that every ๐‘ข โˆˆ ๐ฟ is an integer combination of ๐‘ 1 , โ€ฆ , ๐‘๐‘š. The same lattice can have different bases. In this figure the lattice is a set of points in โ„^2 , and the black vectors ๐‘ฃ 1 , ๐‘ฃ 2 and the ref vectors ๐‘ข 1 , ๐‘ข 2 are two alternative bases for it. Generally we consider the basis ๐‘ข 1 , ๐‘ข 2 โ€œbetterโ€ since the vectors are shorter and it is less โ€œskewedโ€.

Some classical computational questions on lattices are:

  • Shortest vector problem: Given a basis ๐ต for ๐ฟ, find the nonzero vec- tor ๐‘ฃ with smallest norm in ๐ฟ.
  • Closest vector problem: Given a basis ๐ต for ๐ฟ and a vector ๐‘ข that is not in ๐ฟ, find the closest vector to ๐‘ข in ๐ฟ.
  • Bounded distance decoding: Given a basis ๐ต for ๐ฟ and a vector ๐‘ข of the form ๐‘ข = ๐‘ฃ + ๐‘’ where ๐‘ฃ is in ๐ฟ, and ๐‘’ is a particularly short โ€œer- rorโ€ vector (so in particular no other vector in the lattice is within distance โ€–๐‘’โ€– to ๐‘ข), recover ๐‘ฃ. Note that this is a special case of the closest vector problem.

In particular, if ๐‘‰ is a linear subspace of โ„ค๐‘›๐‘ž , we can think of it also as a lattice ๐‘‰ ฬ‚of โ„๐‘›^ where we simply say that that a vector ๐‘ขฬ‚ is in ๐‘‰ ฬ‚if all of ๐‘ขฬ‚โ€™s coordinates are integers and if we let ๐‘ข๐‘– =ฬ‚ ๐‘ข๐‘– (mod ๐‘ž) then ๐‘ข โˆˆ ๐‘‰. The learning with error task of recovering ๐‘ฅ from ๐ด๐‘ฅ + ๐‘’ can then be thought of as an instance of the bounded distance decoding problem for ๐‘‰ ฬ‚. A natural algorithm to try to solve the closest vector and bounded distance decoding problems is that to take the vector ๐‘ข, express it in the basis ๐ต by computing ๐‘ค = ๐ตโˆ’1๐‘ข, and then round all the coordinates of ๐‘ค to obtain an integer vector ๐‘คฬƒ and let ๐‘ฃ = ๐ตฬƒ๐‘ค be a vector in the lattice. If we have an extremely good basis ๐ฟ for the lattice then ๐‘ฃ may indeed be the closest vector in the lattice, but in other more โ€œskewedโ€ bases it can be extremely far from it.

lattice based cryptography 253

11.6 RING BASED LATTICES

One of the biggest issues with lattice based cryptosystem is the key size. In particular, the scheme above uses an ๐‘š ร— ๐‘› matrix where each entry takes log ๐‘ž bits to describe. (It also encrypts a single bit using a whole vector, but more efficient โ€œmulti-bitโ€ variants are known.) Schemes using ideal lattices are an attempt to get more practical vari- ants. These have very similar structure except that the matrix ๐ด cho- sen is not completely random but rather can be described by a single vector. One common variant is the following: we fix some polynomial ๐‘ over โ„ค๐‘ž with degree ๐‘› and then treat vectors in โ„ค๐‘›๐‘ž as the coefficients of ๐‘› โˆ’ 1 degree polynomials and always work modulo this polynomial ๐‘(). (By this I mean that for every polynomial ๐‘ก of degree at least ๐‘› we write ๐‘ก as ๐‘๐‘  + ๐‘Ÿ where ๐‘ is the polynomial above, ๐‘  is some poly- nomial and ๐‘Ÿ is the โ€œremainderโ€ polynomial of degree < ๐‘›; then ๐‘ก (mod ๐‘) = ๐‘Ÿ.) Now for every fixed polynomial ๐‘ก, the operation ๐ด๐‘ก which is defined as ๐‘  โ†ฆ ๐‘ก๐‘  (mod ๐‘) is a linear operation mapping polynomials of degree at most ๐‘› โˆ’ 1 to polynomials of degree at most ๐‘› โˆ’ 1, or put another way, it is a linear map over โ„ค๐‘›๐‘ž. However, the map ๐ด๐‘‘ can be described using the ๐‘› coefficients of ๐‘ก as opposed to the ๐‘›^2 description of a matrix. It also turns out that by using the Fast Fourier Transform we can evaluate this operation in roughly ๐‘› steps as opposed to ๐‘›^2. The ideal lattice based cryptosystem use matrices of this form to save on key size and computation time. It is still unclear if this structure can be used for attacks; recent papers attacking principal ideal lattices have shown that one needs to be careful about this. One ideal-lattice based system is the โ€œNew Hopeโ€ cryptosystem (see also paper) that has been experimented with by Google. People have also made highly optimized general (non ideal) lattice based constructions, see in particular the โ€œFrodoโ€ system (paper here, can you guess whatโ€™s behind the name?). Both New Hope and Frodo have been submitted to the NIST competition to select a โ€œpost quantumโ€ public key encryption standard.