Intro to Lattice-based cryptography

$\newcommand{\Z}{\mathbb{Z}} \newcommand{\R}{\mathbb{R}} \newcommand{\F}{\mathbb{F}}$The main reference is Mathematics of Public Key Cryptography by Steven Galbraith and J. Silverman's note for PCMI 2022.

Lattice

In a vector space $\mathbb{R}^n$, a lattice is a discrete subgroup which is equivalent to $\mathbb{Z}$-span of a basis. For example, $\mathbb{Z}$-span of $v_1 = (1,0)$ and $v_2 = (0,1)$,
$$L = \mathbb{Z} \langle v_1, v_2 \rangle = \{ (c_1, c_2) \mid c_1, c_2 \in \mathbb{Z} \}$$
is a lattice.

Like a vector space, a single lattice can have various bases. For example, $w_1 = (2, -1)$ and $w_2 = (-1, 1)$ spans the same $L$. To check a certain basis spans the lattice, we need to see basis basis-changing matrix. Since $\{v_1, v_2\}$ and $\{w_1, w_2\}$ are both $\mathbb{R}$-basis, we have an invertible matrix $A$ such that
$$\left( w_1 | w_2 \right) = A \left( v_1 | v_2 \right) $$
Then, two bases span the same lattice if and only if $A \in \mathrm{GL}_n(\mathbb{Z})$, that is, entries of $A$ are all integers and $\det A = \pm 1$. In our example, $A = \left( \begin{smallmatrix} 2 & -1 \\ -1& 1 \end{smallmatrix} \right)$ whose determinant is 1. For future applications, we will define the fundamental domain of a lattice with respect to a basis
$$F(L, v_1, \ldots, v_n) = \{c_1 v_1+ \cdots + c_n v_n \mid 0 \leq c_i < 1 \}$$

Hard Lattice Problems

Like a prime factorization in RSA, we will need a hard problem for cryptographic applications. For a given lattice $L$ and $z \in \mathbb{R}^n$, the closest vector problem (CVP) is to find a lattice point that is closest to the target point $z$. That is,
$$\mathrm{CVP}(L, z) = {\arg \min}_{v \in L} \| v-z\|$$

A generous version of CVP is the approximate closed vector problem ($\kappa$-CVP). This problem is to find a reasonably close vector to $z$. Formally, for $\kappa \geq 1$, the solution satisfies
$$\| \kappa\text{-CVP}(L, z) - z \| \leq \kappa \min_{v\in L} \| v - z \|$$
If $\kappa = 1$, $\kappa$-CVP is equivalent to CVP.

In RSA, we can solve the hard problem easily with a private key. The same thing happens for lattice problems. A private key will be a "good" basis (I will explain it precisely later). With a good basis, we can solve $\kappa$-CVP easily using Babai's rounding-off algorithm. The algorithm is simple. Given a lattice $L$ and a basis $\{v_1, \ldots, v_n\}$, the target point $z \in \mathbb{R}^n$ can be written as $z= c_1 v_1 + \cdots + c_n v_n$. Then, the output is $[c_1] v_1 + \cdots + [c_n] v_n$, where $[c_i]$ is the integer closest to $c_i$. We hope this vector is a solution to CVP, but it's not in general.

In the previous example, let the target point $z = (-0.2, -0.2)$. With basis $\{v_1, v_2\}$, $z = -0.2 v_1 -0.2 v_2$, so Babai's rounding-off algorithm outputs $(0,0)$, which is a correct answer to CVP. But, with basis $\{w_1, w_2\}$, $z = -0.4 w_1 - 0.6 w_2$, so the output is $-w_2 = (1, -1)$. Babai's rounding-off algorithm highly depends on the basis, one can see that the rounding-off algorithm with the first basis $\{v_1, v_2\}$ solves every CVP because $v_1$ and $v_2$ are orthogonal. So, the desired "good" property is "nearly orthogonal" which can be formalized by LLL-reduced condition. And, with an LLL-reduced basis, we can solve $\kappa$-CVP for some $\kappa$. I will explain this in another post. Let's just note that some efficient algorithm with a "good" basis can solve $\kappa$-CVP.

Goldreich-Goldwasser-Halevi Cryptosystem

GGH cryptosystem is based on the hardness of CVP. The private key is a "good" basis $B = \{ v_1, \ldots, v_n\}$. We can consider the lattice $L$ spanned by $B$ With private key, one can make a "bad" basis $B' =UB$ for some random integer matrix with determinant $\pm 1$. Then, $B'$ is also a basis of $L$, and it is a public key. With the public key $B'$ and a message $m \in \Z^n$, the ciphertext is $x = B'm+ e$ where $e \in \R^n$ is a random small vector. Note that the vector $B'm$ belongs to the lattice $L$. We want $e$ is small enough so that the closest lattice point of $x$ is $B'm$. With a knowledge of the good basis $B$, one can decrypt the ciphertext by solving CVP and multiply $B'^{-1}$.
One way to attack the GGH system is to obtain another good basis from public key $B'$ using LLL reduction. To prevent this, the size of the lattice should be large enough.

The problem with GGH is the length of the keys. To prevent known attacks on GGH, we need large $n > 2000$. But, the size of public/private keys of GGH is $O(n^2)$, which is really large even compared to secure 4096 bits RSA.

NTRU Cryptosystem

We first define a binary operation convolution on $\Z^n$. For $(a_i), (b_i) \in Z^n$, define
$$(a_i) \odot (b_i) = (c_i), \ \ \ \ c_i = \sum_{j+k \equiv i \text{ mod } n} a_j b_k.$$
Note that this convolution is the same as the multiplication in $\Z[X]/(X^n-1)$, by interpreting $(a_i)$ as $a_0+a_1x+ \cdots + a_{n-1} x^{n-1}$. Similarly, we can define convolution $\odot_p$ on $(\Z/p\Z)^n$ for any integer $p$.

The public/private keys of NTRU are generated like this. First, choose a prime $n$ and two integers $p << q$. Then choose small $f,g \in \Z^n$ and find $f_p, f_q \in \Z^n$ such that
$$\bar{f} \odot_p \bar{f_p} = (1,0,0, \ldots 0),\ \ \ \  \bar{f} \odot_q \bar{f_q} = (1,0,0, \ldots 0).$$
Here, $\bar{f}$ is a projection from $\mathbb{Z}^n$ to $(\mathbb{Z}/p\mathbb{Z})^n$ or $(\mathbb{Z}/q\mathbb{Z})^n$ (which is certain in context). The public key is $h = \bar{g} \odot_q \bar{f_q}$ and the private key is $f$. For a small message $m \in (\Z/p\Z)^n$, the ciphertext is
$$c = p \cdot \bar{r} \odot_q h + m \text{ mod } q$$
where $r$ is a small random vector.
To recover the ciphertext $c$, first compute
$$a = c \odot_q \bar{f} = (p \cdot \bar{r} \odot_q g \odot_q f_q + m) \odot_q \bar{f} = p \cdot \bar{r} \odot_q g + m \odot_q \bar{f} \text{ mod } q$$
The equation above is in $(\Z/q\Z)^n$. But, since $f, g, r, m$ are small and $p << q$,
$$a = p \cdot \bar{r} \odot_q g + m \odot_q \bar{f} \in \Z^n$$
Now, multiplying $f_p$ to obtain
$$a \odot_p \bar{f_p} = p \cdot \bar{r} \odot_q g \odot_p \bar{f_p} + m \odot_q \bar{f} \odot_p \bar{f_p} = m \text{ mod } p$$

We want to interpret this cryptosystem as a lattice problem. We first convert the convolution relation into a lattice membership problem. Let $h = (h_0, \ldots, h_{n-1}) \in \Z^n$ and

$$B_h = \left( \begin{array}{c|c} I_n  & 0 \\ \hline {\begin{matrix} h_0 & h_1 & \dots & h_{n-1} \\ h_{n-1} & h_0 & \dots & h_{n-2} \\ \vdots & \vdots & \ddots & \vdots \\ h_1 & h_2 & \dots & h_0 \end{matrix}}  & q I_n \end{array} \right)$$

Let $L_h$ be the lattice spanned by $B_h$. Suppose $a, b \in \Z^n$ satisfies

$$\bar{a} \odot_q \bar{h} = \bar{b} \text{ mod } q.$$

This implies we have $u \in \Z^n$ such that

$$q \cdot u = b - a \odot h$$

Then, $B_h \binom{a}{u} = \binom{a}{b} \in L_h$. One can also show that $\binom{a}{b} \in L_h$ if and only if $\bar{a} \odot_q \bar{h} = \bar{b}$.

In the NTRU cryptosystem, the ciphertext is

$$c = p \cdot \bar{r} \odot_q h + m \text{ mod } q$$

This equation is equivalent to

$$(0 | c) = (0 | p \cdot \bar{r} \odot_q h + m) = (r | r \odot ph) + (-r, m)$$

Since $r, m$ is small and $(r| r \odot ph) \in L_{ph}$, recovering $m$ is equivalent to solve CVP for $(0|c)$. In other words, NTRU is based on a lattice problem for special type lattice $B_{ph}$. The circular property of the basis reduces the length of keys into $O(n \log n)$.

댓글