Difference between revisions of "GSW - Bootstrapping"

From certFHE Community KB
Jump to navigation Jump to search
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
Gentry's [[bootstrapping]] theorem allows for converting a “somewhat homomorphic” encryption scheme (which supports only a bounded number of homomorphic operations) into a fully
+
Gentry's bootstrapping theorem <ref name = G10> C. Gentry. Computing arbitrary functions of encrypted data. In "Communications of the ACM", 2010.</ref> allows for converting a “somewhat homomorphic” encryption scheme (which supports only a bounded number of homomorphic operations) into a fully
 
homomorphic encryption one (which has no such bound). The bounded nature of all known somewhat homomorphic schemes cannot be avoided due to “error” terms in their ciphertexts, which are necessary for security. The error grows as a result of performing homomorphic operations, and if it grows too large, the ciphertext will no longer decrypt correctly.
 
homomorphic encryption one (which has no such bound). The bounded nature of all known somewhat homomorphic schemes cannot be avoided due to “error” terms in their ciphertexts, which are necessary for security. The error grows as a result of performing homomorphic operations, and if it grows too large, the ciphertext will no longer decrypt correctly.
  
Line 6: Line 6:
  
 
Here we present an efficient bootstrapping method for a variant of the [[GSW]] scheme, as presented in the paper of Alperin-Sheriff and Peikert <ref name = "ASP"> J. Alperin-Sheriff and C. Peikert. Faster Bootstrapping with Polynomial Error. In CRYPTO 2014 (Springer). https://eprint.iacr.org/2014/094</ref>.
 
Here we present an efficient bootstrapping method for a variant of the [[GSW]] scheme, as presented in the paper of Alperin-Sheriff and Peikert <ref name = "ASP"> J. Alperin-Sheriff and C. Peikert. Faster Bootstrapping with Polynomial Error. In CRYPTO 2014 (Springer). https://eprint.iacr.org/2014/094</ref>.
 +
 +
Recall that in [[GSW]], a ciphertext is a square binary matrix <math>C</math>, a secret key is a "structured" mod <math> q </math> vector <math> s </math>, and <math>s </math> is an "approximate mod <math> q</math> eigenvector" of <math>C</math>, in the sense that <math>s^t C \approx \mu \cdot s^t </math>, where <math> \mu \in \mathbb Z </math> is the message.
 +
 +
In this new variant, a ciphertext is a rectangular mod <math>q </math> matrix <math>C</math>, a secret key is some (unstructured, short) integer vector <math>s \in \mathbb Z^n </math> and <math>s^t C \approx \mu \cdot s^t G</math> (mod <math> q </math>), i.e. <math>s </math> amd <math>G^ts </math> are corresponding left- and right- "approximate singular vectors" of <math> C</math>.         
  
 
== A "simpler" variant of the GSW cryptosystem ==
 
== A "simpler" variant of the GSW cryptosystem ==
Line 66: Line 70:
 
<center><math>  C \leftarrow C_1 \boxdot \left( C_2 \boxdot(\dots C_k \boxdot G ) \dots) \right) </math> </center>
 
<center><math>  C \leftarrow C_1 \boxdot \left( C_2 \boxdot(\dots C_k \boxdot G ) \dots) \right) </math> </center>
 
has an error vector whose entries are mutually independent and subgaussian with parameter <math> O(||e||) </math>, where <math>e^t = (e_1^t, \dots, e_k^t) \in \mathbb Z^{knl} </math> is the concatenation of the individual error vectors.
 
has an error vector whose entries are mutually independent and subgaussian with parameter <math> O(||e||) </math>, where <math>e^t = (e_1^t, \dots, e_k^t) \in \mathbb Z^{knl} </math> is the concatenation of the individual error vectors.
 +
 +
 +
== Homomorphic encryption for Symmetric Groups ==
 +
 +
We describe HEPerm a homomorphic encryption scheme for symmetric groups. Let <math> \mathcal C </math> be the ciphertext space for the GSW scheme. The main procedures of HEPerm are as follows:
 +
 +
* HEPerm.Enc(<math>sk, \pi \in S_r </math>): let <math> P = (p_{i,j}) \in \{0,1 \}^{r \times r} </math> be the permutation matrix associated with <math> \pi \in S_r </math>. Output the following ciphertext space
 +
<center><math> C = (c_{i,j}) \in \mathcal C^{r \times r},</math>, where <math> c_{i,j} \leftarrow GSW.Enc(sk,p_{i,j}). </math>  </center>
 +
 +
This is an entry-wise encryption of <math>P</math>. Decryption is obvious. A ciphertext <math> C \in \mathcal C^{r \times r} </math> is said to be "designed" to encrypt a permutation <math>pi \in S_r</math>, if its <math>C</math>-entries are designed to encrypt the corresponding entries of <math>P_{\pi} </math>.
 +
 +
<math>J \in \mathcal C^{r \times r}</math> will denote the encryption of the identity permutation, where each entry is encrypted with zero noise.
 +
 +
* <b>Homomorphic composition:</b> <math>C^{\pi} \circ C^{\sigma} </math> will be computed in the obvious way. Namely, the entries of the output <math>C^{\pi} \circ C^{\sigma} = (c_{i,j}) \in \mathcal C^{r \times r} </math> where
 +
<center><math>c_{i,j} \leftarrow \sum\limits_{l \in [r]} (c_{i,l}^{\pi} \boxdot c_{l,j}^{\sigma}) \in \mathcal C.</math> </center>
 +
 +
Like the multiplication <math> \boxdot </math> for ciphertexts in the GSW, the composition <math> \circ </math> is right associative.
 +
 +
* <b>Homomorphic equality test </b> Eq?(<math>C^{\pi}=(c_{i,j}^{\pi}, \sigma \in S_r) </math>): Given a ciphertext encrypting some permutation <math>\pi \in S_r </math> and a permutation <math> \sigma \in S_r </math> (in the clear), output a ciphertext <math>c \in \mathcal C </math> encrypting <math>1 </math> if <math> \pi = \sigma </math> and <math>0 </math> otherwise, i.e. output
 +
<center><math>  c \leftarrow \prod\limits_{i \in [r]} c_{\sigma(i), i}^{\pi} \boxdot g</math> , </center>
 +
where <math>g \in \mathcal C </math> is the fixed zero-error encryption of <math>1</math>.
 +
 +
Remark the for the two operations above, the GSW ciphertext(s) that appear in the output are always designed to encrypt <math>\{0,1 \} </math> messages.
 +
 +
To analyse the noise resulting in these operations, let is recall that the GSW scheme is parameterized by <math>n,q </math>. Denote the space of error vectors by <math> \mathcal E = \mathbb Z^m </math>, where <math> m = n \lceil \log_2(q)  \rceil </math>. The Euclidean norm on <math>\mathcal E^r = \mathbb Z^{mr} </math> is defined in the ovious way. In the following analysis, we will often consider vectors and matrices over <math>\mathcal E </math>, i.e. in which the entries are vectors from <math>\mathcal E </math>.
 +
 +
<b>Claim.</b> (Lemma 4.1 in the first reference) The error matrix in <math>  C^{\pi} \circ C^{\sigma}</math> is <math>E + P^{\pi} \cdot E^{\sigma} </math>, where <math>P^{\pi} </math> is the matrix encoding <math> \pi</math> (in the clear), <math>E^{\sigma} \in \mathcal E^{r \times r}</math> is the error of <math> C^{\sigma} </math> and the <math>\mathbb Z </math>-entries of the matrix <math>E</math> are mutually independent, and those in its <math>i </math>-th row are subgaussian with parameter <math>O(||e_i^\pi||) </math>, where <math>e_{i}^{\pi} </math> is the <math>i</math>-th row of <math>E^{\pi} </math>.
 +
 +
Similarly to a multiplication chain of GSW ciphertexts, one can perform a (right-associative) chain of compositions while incurring only small error growth. For conveniece of analysis, we always include the fixed zero-error ciphertext <math> J \in \mathcal C^{r \times r} </math> as the rightmost ciphertext in the chain.
 +
 +
<b>Claim.</b> (Corollary 4.2 in the first reference) Suppose that <math> C_i</math>  are designed to encrypt permutation matrices <math>P_i \in \{0,1 \}^{r \times r} </math> and have error matrices <math>E_i \in \mathcal E^{r \times r} </math>. Then for any fixed values of these variables,
 +
 +
<center><math>C \leftarrow C_1 \circ(C_2 \circ(\dots (C_k \circ J)\dots)) </math></center>
 +
has an error matrix whose <math>\mathbb Z </math>-entries are mutually independent, and those in its <math>i</math>-th row are subgaussian with parameter <math> O(||e_i||) </math>, where <math>e_i^t \in \mathcal E^{kr} </math> is the <math> i</math>-th row of the concatenated matrices <math>[E_1| \dots | E_k] </math>.
 +
 +
==Bootstrapping ==
 +
 +
We have to instantiate the GSW and HEPerm with parameters <math>n, Q, \chi </math>. Importantly, the ciphertext modulus <math> Q </math> is not the modulus <math> q</math> of the scheme to be bootstrapped, but rather some modulus <math> Q >> q </math>. Let <math> \mathcal C</math> be the ciphertext of the GSW scheme.
 +
 +
Let <math>q</math> be of the form <math>q = \prod_{i \in [t]} r_i </math>, where <math> r_i</math> are small powers of distinct primes. One can choose <math>q = \tilde{O}(\lambda) </math> to be large enough by letting it be the product of all maximal prime-powers <math>r_i </math> that are bounded by <math>O(\log(\lambda)) </math>, of which there are <math>t = O(\log(\lambda)/log(\log(\lambda))) </math>. Let <math> \phi</math> be the group embedding of <math>\mathbb Z_{q} </math> into <math>S= S_{r_1} \times S_{r_t} </math>, and let <math>\phi_i </math> denote the <math>i</math>-th component of this embedding, i.e. the one from <math>\mathbb Z_{q} </math> into <math>S_{r_i} </math>.
 +
 +
* BootGen(<math>s \in \mathbb Z_{q}^d, sk </math>): Given secret key <math>s \in \mathbb Z_{q}^d </math> for the scheme GSW and a secret key <math>  sk </math>  for HEPerm, embed each coordinate <math>s_j \in \mathbb Z_{q} </math> of <math>s</math> as <math>\phi(s_j)\in S</math> and encrypt the components under HEPerm. That is, generate and output the bootstrapping key
 +
<center><math>bk = \{C_{i,j} \leftarrow HEPerm.Enc(sk,\phi_i(s_j)): i \in [t], j \in [d] \} </math>.</center>
 +
 +
Recalling that we are working with embeddings of <math>\mathbb Z_{r_i} </math>, each <math> C_{i,j} \in \mathcal C^{r_i}</math> can be represented as a tuple of <math>r_i </math> GSW ciphertexts encrypting an indicator vector. Since <math>t, r_i = O(\log \lambda) </math> and <math>d= \tilde{O}(\lambda) </math>, the bootstrapping key has <math>\tilde O(\lambda) </math> ciphertexts.
 +
 +
* Bootstrap(<math>bk, c \in \{0,1 \}^{d} </math>): given a binary ciphertext <math>c \in \{0,1 \}^d </math>, do the following:
 +
 +
First, homomorphically compute an encryption of
 +
<math> v = \langle s,c \rangle = \sum_{j: c_j =1} s_j \in \mathbb Z_q </math>
 +
using the encryptions of the <math>s_j \in \mathbb Z_{q} </math> as embedded into the permutation group <math>S</math>. Additions above are replaced using a chain of compositions.
 +
 +
Then, one has to round. Homomorphically map <math>v \in \mathbb Z_q </math> to <math> \{0,1 \} </math>, in the following way. For each <math>x \in \mathbb Z_{q} </math> such that <math> f(x) =1 </math>, homomorphically tests whether <math>v = x </math> by evaluating the homomorphic product of the resulting ciphertexts from all the equality tests <math> v = x </math> mod <math> r_i</math>. Then homomorphically sum the results of all the <math>v= x </math> tests.
 +
 +
Bootstrapping performs <math>\tilde O(\lambda) </math> homomorphic multiplications and additions on GSW ciphertexts.
 +
 +
We refer to the paper of Alperin-Sheriff and Peikert [2] for a detailed analysis of the security and correctness.
  
 
== References ==
 
== References ==

Latest revision as of 10:18, 30 December 2020

Gentry's bootstrapping theorem [1] allows for converting a “somewhat homomorphic” encryption scheme (which supports only a bounded number of homomorphic operations) into a fully homomorphic encryption one (which has no such bound). The bounded nature of all known somewhat homomorphic schemes cannot be avoided due to “error” terms in their ciphertexts, which are necessary for security. The error grows as a result of performing homomorphic operations, and if it grows too large, the ciphertext will no longer decrypt correctly.

Bootstrapping the error of a ciphertext so that it can support more homomorphic operations, by homomorphically evaluating the decryption function on the ciphertext. The result is a ciphertext that still encrypts the original encrypted message. If the error coming from the homomorphic evaluation is smaller than the error in the original ciphertext, we say that the ciphertext is “refreshed”. To date, bootstrapping is the only known way of obtaining an unbounded FHE scheme, i.e., one that can homomorphically evaluate any efficient function using keys and ciphertexts of a fixed size.

Here we present an efficient bootstrapping method for a variant of the GSW scheme, as presented in the paper of Alperin-Sheriff and Peikert [2].

Recall that in GSW, a ciphertext is a square binary matrix , a secret key is a "structured" mod vector , and is an "approximate mod eigenvector" of , in the sense that , where is the message.

In this new variant, a ciphertext is a rectangular mod matrix , a secret key is some (unstructured, short) integer vector and (mod ), i.e. amd are corresponding left- and right- "approximate singular vectors" of .

A "simpler" variant of the GSW cryptosystem

The authors present a variant of the GSW scheme which permits a tighter analysis of its error growth under homomorphic operations.

Given a modulus , let us denote by and define the "gadget" (we will think of it as column) vector

Remark that , according to our choice of .

A randomized decomposition function. There is a randomized, efficiently computable function such that is "subgaussian" with parameter , and always satisfies . [3]

In particular is randomized and has low entries with very large probability.

For vectors and matrices over , define the randomized function by applying independently to each entry. Notice that for any , if , then has small entries (is "subgaussian") and

, where

is the block matrix with copies of as diagonal blocks, and zeros elsewhere.

This version of the GSW scheme has as parameters a dimension , a modulus and , as defined above. For bootstrapping, we only work with ciphertexts encrypting messages in . The ciphertext space is . For simplicity, we present just a symmetric-key scheme, which can be converted to a public key setting, similar to the one described in GSW.

A substantial difference between the original GSW scheme and this variant is the following: the homomorphic multiplication procedure in the current variant uses the randomized operation presented above. This gives important advantages, such as very simple error analysis (using the subgaussianity property) and the ability to completely re-randomize the error in a ciphertext.

The algorithms of the scheme are as follows

  • GSW.Gen(): choose and output the secret key .
  • GSW.Enc(): choose uniformly and , let mod , and output the ciphertext

where .

  • GSW.Dec(): let be the penultimate column of . Output , where indicates whether its argument is closer modulo to or to , the penultimate entry of .
  • GSW.Add(): Output .
  • GSW.Multiply( ): Output . This operation is a ramdomized one, as is randomized. The multiplication is also right-associative.

The authors remark that a fresh ciphertext is just plus a matrix which contains independent LWE samples under the secret which are pseudorandom if one assumes the hardness of .

Correctness and homomorphic operations

A ciphertext is said to be designed to encrypt a message (under a secret key ) if it is a fresh encryption of , or if is the sum (or the product) of two ciphertexts that are designed to encrypt and .

The error vector of a ciphertext designed to encrypt a message under the key is (mod ).

Notice that the matrix is designed to encrypt and has error .

Claim. If is designed to encrypt some and has error vector whose penultimate coordinate has magnitude less than , then GSW.Dec() correctly outputs .

This follows from the fact that and the penultimate column of is , where mod .

Let be ciphertexts designed to encrypt and have error vectors . Then, their homomorphic sum has error vector . Moreover, if is the homomorphic product of these ciphertexts, then for (subgaussian), we have the following

,

which as is further equal to

It is important to remember that the error upon multiplication is quasi-additive and asymmetric with respect to the errors . The first error is multiplied by a subgaussian matrix , the second error vector is only multiplied by the message , which the authors make sure they always keep in .

Homomorphic product of multiple ciphertexts. Suppose that are designed to encrypt and have error vectors . Then for any fixed values of these variables, the matrix

has an error vector whose entries are mutually independent and subgaussian with parameter , where is the concatenation of the individual error vectors.


Homomorphic encryption for Symmetric Groups

We describe HEPerm a homomorphic encryption scheme for symmetric groups. Let be the ciphertext space for the GSW scheme. The main procedures of HEPerm are as follows:

  • HEPerm.Enc(): let be the permutation matrix associated with . Output the following ciphertext space
, where

This is an entry-wise encryption of . Decryption is obvious. A ciphertext is said to be "designed" to encrypt a permutation , if its -entries are designed to encrypt the corresponding entries of .

will denote the encryption of the identity permutation, where each entry is encrypted with zero noise.

  • Homomorphic composition: will be computed in the obvious way. Namely, the entries of the output where

Like the multiplication for ciphertexts in the GSW, the composition is right associative.

  • Homomorphic equality test Eq?(): Given a ciphertext encrypting some permutation and a permutation (in the clear), output a ciphertext encrypting if and otherwise, i.e. output
,

where is the fixed zero-error encryption of .

Remark the for the two operations above, the GSW ciphertext(s) that appear in the output are always designed to encrypt messages.

To analyse the noise resulting in these operations, let is recall that the GSW scheme is parameterized by . Denote the space of error vectors by , where . The Euclidean norm on is defined in the ovious way. In the following analysis, we will often consider vectors and matrices over , i.e. in which the entries are vectors from .

Claim. (Lemma 4.1 in the first reference) The error matrix in is , where is the matrix encoding (in the clear), is the error of and the -entries of the matrix are mutually independent, and those in its -th row are subgaussian with parameter , where is the -th row of .

Similarly to a multiplication chain of GSW ciphertexts, one can perform a (right-associative) chain of compositions while incurring only small error growth. For conveniece of analysis, we always include the fixed zero-error ciphertext as the rightmost ciphertext in the chain.

Claim. (Corollary 4.2 in the first reference) Suppose that are designed to encrypt permutation matrices and have error matrices . Then for any fixed values of these variables,

has an error matrix whose -entries are mutually independent, and those in its -th row are subgaussian with parameter , where is the -th row of the concatenated matrices .

Bootstrapping

We have to instantiate the GSW and HEPerm with parameters . Importantly, the ciphertext modulus is not the modulus of the scheme to be bootstrapped, but rather some modulus . Let be the ciphertext of the GSW scheme.

Let be of the form , where are small powers of distinct primes. One can choose to be large enough by letting it be the product of all maximal prime-powers that are bounded by , of which there are . Let be the group embedding of into , and let denote the -th component of this embedding, i.e. the one from into .

  • BootGen(): Given secret key for the scheme GSW and a secret key for HEPerm, embed each coordinate of as and encrypt the components under HEPerm. That is, generate and output the bootstrapping key
.

Recalling that we are working with embeddings of , each can be represented as a tuple of GSW ciphertexts encrypting an indicator vector. Since and , the bootstrapping key has ciphertexts.

  • Bootstrap(): given a binary ciphertext , do the following:

First, homomorphically compute an encryption of using the encryptions of the as embedded into the permutation group . Additions above are replaced using a chain of compositions.

Then, one has to round. Homomorphically map to , in the following way. For each such that , homomorphically tests whether by evaluating the homomorphic product of the resulting ciphertexts from all the equality tests mod . Then homomorphically sum the results of all the tests.

Bootstrapping performs homomorphic multiplications and additions on GSW ciphertexts.

We refer to the paper of Alperin-Sheriff and Peikert [2] for a detailed analysis of the security and correctness.

References

  1. C. Gentry. Computing arbitrary functions of encrypted data. In "Communications of the ACM", 2010.
  2. J. Alperin-Sheriff and C. Peikert. Faster Bootstrapping with Polynomial Error. In CRYPTO 2014 (Springer). https://eprint.iacr.org/2014/094
  3. D. Micciancio and C. Peikert. Trapdoors for lattices: Simpler, tighter, faster, smaller. In EUROCRYPT, pages 700–718. 2012 https://www.iacr.org/archive/eurocrypt2012/72370695/72370695.pdf