Multi-Key Homomorphic Encryption Scheme with Multi-Output Programmable Bootstrapping

: Multi-key Homomorphic Encryption (MKHE) scheme can homomorphically evaluate ciphertexts encrypted by different keys, which can effectively protect the privacy information of data holders in the joint computing of cloud services. Since the ﬁrst full Homomorphic encryption scheme was proposed, bootstrapping is the only way to realize the arbitrary depth homomorphic computation of MKHE schemes. But bootstrap operation is quite expensive. In order to implement fast bootstrapping in MKHE schemes, previous works proposed multi-key TFHE schemes to implement low-latency bootstrapping and output a univariate function of messages after bootstrapping, called Programmable Bootstrapping (PBS). However, these schemes can only encrypt single-bit messages. PBS only outputs a function. And after a homomorphic operation, a bootstrap is required, which undoubtedly results in an increase in the cost of the whole multi-key homomorphic encryption operation. In this paper, we propose a MKHE scheme for multi-output PBS. For this purpose, we study the encryption method and homomorphic operation steps of MKHE, and add BFV homomorphic encryption multiplication and multi-key ciphertext relinearization. We separate the homomorphic operation from bootstrapping. We homomorphically evaluate test polynomials for multiple functions. In contrast to previous MKHE schemes, we support the output of multiple message-related functions with a single bootstrapping operation on the ciphertext. It is no longer limited to encrypting single-bit plaintext, and an effective ciphertext packaging technology is added. According to the analysis given in this paper, it is known that in the scenario of multi-party joint computation, the proposed scheme can be implemented with less bootstrapping when the same number of functions are homomorphically operated. This will effectively reduce the computational overhead.


Introduction
With the development of cloud computing technology, more and more individuals and enterprises choose to submit their data to cloud servers for computing, thereby reducing expenses. However, data sent to cloud servers face the risk of data leakage. If the user does not want to disclose private data to the third party, encrypting the data before transmission is an option, but traditional encryption technology does not support computation on ciphertext.
Homomorphic encryption (HE) is an effective solution to the above problems. It allows for the computation of the ciphertext without knowing the plaintext and the keys, and the calculation result of the ciphertext is homomorphic to the calculation result of the corresponding plaintext. While the third party only holds the encrypted data, it is difficult to obtain the plaintext information.
The idea of homomorphic encryption has been proposed for a long time, but because of the complexity of the construction, the ciphertext calculation algorithm and times are very limited. Not until 2009 did Gentry [1] propose the first fully homomorphic encryption (FHE). This breakthrough has made homomorphic encryption more practical. After that, many branches of homomorphic encryption appeared, such as BGV [2], BFV [3,4], GSW [5], TFHE [6], CKKS [7], et al. However, these basic HE schemes are single key schemes, that is, ciphertexts participating in homomorphic computing are generated under one key. Actually, different parties cannot share a key to encrypt data, otherwise it is no different from directly sending plaintext. Therefore, each party should hold different keys in theory, and the cloud server can complete the homomorphic calculation of data encrypted with different keys, which is called multi-key homomorphic encryption (MKHE).
Lopez-Alt et al. [8] first proposed a multi-key homomorphic encryption scheme based on NTRU in 2012, and subsequently conducted a lot of research on MKHE in various homomorphic encryption branches. Among them, the earlier and most MKHE schemes [9][10][11][12] are implemented based on the GSW scheme. Then, in 2017, Chen et al. proposed the BGV type MKHE scheme [13] by combining the methods of BGV and GSW. In 2019, Chen et al. proposed the MKHE scheme [14] based on TFHE. However, the computational efficiency of these MKHE schemes is not ideal, which is the problem of MKHE schemes to be solved. And this is also a major reason why homomorphic encryption methods cannot be widely used in real scenarios.
At present, the key method for effective fully homomorphic computation is still the bootstrap method proposed by Gentry [1], which is used to refresh the noise of the ciphertext, so that the ciphertext can continue to participate in the next homomorphic evaluation. Specifically, the ciphertext of the homomorphic encryption scheme is added with noise, and the noise of the ciphertext will expand rapidly when the homomorphic evaluation is performed. When the noise increases beyond the specified range, the decryption of the ciphertext will fail, and the expected calculation result will not be achieved. The bootstrap method is to encrypt the ciphertext into another ciphertext when the noise of the ciphertext reaches the critical stage but does not exceed the limit, and the inner ciphertext is restored to the code of the plaintext by using the homomorphic evaluation decryption function to reduce the noise, so as to meet the homomorphic evaluation again. Then, by performing a bootstrapping every time the ciphertext noise reaches the upper limit, the circuit of any depth can be homomorphic, or "pure" fully homomorphic. But bootstrapping is also very expensive. Therefore, how to improve the efficiency of bootstrapping and make the multi-key fully homomorphic schemes more practical is an open problem.
Chillotti et al. proposed the fast bootstrapping HE schemes [6,15,16], which are called TFHE because their ciphertexts are mapped to torus. They are all based on the hardness assumptions of Learning with Errors (LWE) [17] and Ring-LWE (RLWE) [18]. Their schemes introduce external products, look-up tables and other methods in bootstrapping, so that the bootstrapping method has low latency and is better than other homomorphic encryption schemes in time and availability. Scheme [14] is a multi-key variant of TFHE, which adopts the advantages of TFHE to realize the MKHE scheme of fast bootstrapping. The scheme designs a method of a hybrid product, which is used for blind rotation in the calculation of multi-key ciphertexts, so that the bootstrapping is faster and the noise control is better. However, their scheme is only a basic MKHE scheme, the function of bootstrapping is relatively single, and every execution of the NAND gate circuit must run a bootstrapping operation. The efficiency is low in practice. After that, Chillotti et al. [19,20] improved TFHE, so that the plaintext message space was no longer limited to binary, and introduced the multiplication operation of BFV-type to improve the precision number of plaintext space. At the same time, the scheme satisfied the packing of ciphertexts and expanded the function of bootstrapping. It realizes multi-functional programmable bootstrapping (evaluates the function of the ciphertext while refreshing the ciphertext noise) and does not need to pad zero on the most significant bit of the ciphertext space. And a bootstrapping operation can homomorphically evaluate multiple functions, which makes the homomorphic computation more time-efficient. But these schemes are single-key schemes. Therefore, how to construct bootstrapping methods that homomorphically evaluate multiple decryption functions in the MKHE schemes is an interesting question.

Contributions
In this paper, based on the single-key scheme of [19,20], we improve the MKHE scheme of scheme [14] and construct a new multi-key variant of TFHE. The advantages of fast bootstrapping of TFHE schemes are maintained, and more functions are added.

•
Ciphertext packing. In our scheme, the space of encryptable plaintext messages has multiple bits. Each party encrypts the messages with its own key to generate the RLWE ciphertext. In contrast, scheme [14] can only perform encrypted computation on binary messages. According to the characteristics of the ciphertext slot, the number of messages that each party can encrypt is not limited to one, so as to realize the ciphertext packing of the scheme. • Bootstrapping is not required for every homomorphic operation. In this paper, we separate the homomorphic operation of multi-key ciphertexts from bootstrapping. Consequently, it is not necessary to perform a bootstrapping to refresh the ciphertext noise after one multi-key ciphertext homomorphic computation, while the known multi-key TFHE schemes require a bootstrapping operation after each gate run. • Programmable bootstrapping with multiple outputs. Since each party can encrypt the plaintext message space to achieve high accuracy, the Look-up table (LUT) of multiple functions can be set according to the plaintext space when performing multi-party joint computation. By doing this, you can homomorphically evaluate multiple functions while performing a single bootstrapping operation.
Finally, we provide the analysis of the operation of our scheme. Compared with the existing methods, our method maintains the same time complexity and realizes more functions of bootstrap operation. As we all know, bootstrapping is currently the only way to achieve fully homomorphic encryption, and it is also the most expensive method. As a result, our scheme can evaluate more functions with fewer bootstrapping times, which will greatly reduce the computational overhead. This is also the first attempt of programmable bootstrapping of multi-output functions in multi-key homomorphic encryption schemes.

Methodology Overview
The multi-key homomorphic encryption scheme in this paper is based on the standard LWE and RLWE hardness assumptions. Z is the set of integers, B is the set of {0, 1} and R = Z[X]/(X N + 1) is the cyclotomic polynomial. The lowercase bold letters denote vectors (More notations are described in Section 2.1). The encrypted message is placed in the most significant bits of the ciphertext coefficient. Let the size of the ciphertext space be q. Due to the fact that bootstrapping refreshes the noise of LWE ciphertext, multi-key ciphertext computation operates on RLWE ciphertext. Therefore, each participant independently generates one LWE key and one RLWE key. Assuming there are k participants, the LWE key and RLWE key of the ith party are s i ∈ B n and t i ∈ B[X]/(X N + 1), respectively. The ith participant generates LWE ciphertext based on s i , and then packages it into RLWE ciphertext under t i to send it out. The receiver expands a ciphertext into a multi-key ciphertext ct = (b, a 1 , . . . , a k ) ∈ R k+1 q based on the number of participants, and decrypts it using a joint key t = (1, t 1 , . . . , t k ) ∈ R k+1 2 , namely µ ≈ ct, t q where µ is the encoding associated with the plaintext message.
Homomorphic addition does not require special processing. Homomorphic product uses a tensor product similar to BFV, where the product of two ciphertexts is . If the ciphertext is decrypted, the key t ⊗ t ∈ R (k+1)×(k+1) 2 is required. But the resulting ciphertext cannot be homomorphically evaluated again or decrypted directly using a joint key. Therefore, it is necessary to convert the ciphertext term corresponding to the nonlinear term t i · t j of the keys into the ciphertext of key t, and the returned ciphertext ct ∈ R k+1 q satisfies ct , t ≈ ct ⊗ ct, t ⊗ t . Assume that all parties share a Common Reference String (CRS) a ∈ R d q and set up a gadget decomposition tool g ∈ Z d . The ith party generates the public key b i ≈ −a · t i ∈ R d q and generates the ciphertext q with the uni-encryption method. Then, through the ciphertext F i , the ciphertext item corresponding to t i · t j can be converted into three terms, corresponding to the keys 1, t i and t j , respectively. The noise of the ciphertext increases after homomorphic calculation. In order to decrypt correctly or continue to do homomorphic calculation, it is necessary to refresh the ciphertext noise by bootstrapping. Bootstrapping is accomplished by homomorphic computation of the decryption formula. First, set a test polynomial P(X) and initialize the RLWE ciphertext. Because the dimension of the RLWE ciphertext polynomial is N, according to the reflexivity of the cyclotomic polynomial, the ciphertext space that can be refreshed most by bootstrapping is 2N. Therefore, the ciphertext to be bootstrapped will undergo module switching, assuming it is ct = (b, a 1,1 , . . . , a 1,N , . . . , a k,1 , . . . , a k,N ) ∈ Z kN+1 2N , and the corresponding decryption key is t = (1, t 1,1 , . . . , t 1,N , . . . , t k,1 , . . . , t k,N ) ∈ B kN+1 , that is, the coefficient combination of all participants' RLWE keys. If the coefficients of the test polynomial P(X) are set as functions related to the exponent and homomorphically calculate P(X) · X − ct ,t , then the first term of the polynomial is the function related to the plaintext. To compute ct , t ≈ b + a 1,1 · t 1,1 + · · · + a k,N · t k,N , it needs to know the keys; however, the keys are not publishable, so the keys t i,j are encrypted by uni-encryption to generate ciphertexts q , and then the hybrid product calculation is performed. The hybrid product homomorphically computes t i,j · X a i,j , and the keys generated in this paper follow uniform binary sampling, using the CMux gate to compute ( The bootstrapping result is an LWE ciphertext, which is finally converted into an RLWE ciphertext using the multi-key switching keys, waiting for the next decryption or homomorphic computation. This scheme can calculate multiple functions at the same time, mainly based on the design of the test polynomial P(X) based on [20], and set the bits to zero in the least significant bits of the ciphertext space 2N. Consequently, the decryption function ct , t = · m + 2 · e is homomorphically calculated, where is the scaling factor. Set the test polynomial P(X) for the plaintext space p, extracting samples from the ciphertext of the decrypted function after homomorphic evaluation. This process results in 2 function ciphertexts related to m.

Related Works
MKHE scheme was first proposed by Lopez Alt et al. [8] to implement a dynamic Multi-Party Computation (MPC) protocol based on the NTRU public key cryptosystem. Subsequently, on the basis of the GSW scheme [5], Clear et al. [9] proposed an MKHE scheme supporting multi-identity, whose security is based on the standard assumption LWE problem [17]. Mukherjee et al. [10] simplified the scheme of [9] and used MKHE to construct MPC. The schemes of [9,10] need to preprocess the number of users involved in the homomorphic calculation, and are unable to add new users during the calculation process. This type is called single-hop. Then Peikert et al. [11] and Brakerski et al. [12] proposed the multihop MKHE scheme, respectively; however, Peikert et al.'s scheme limited the number of participants, and Brakerski et al.'s scheme extended the ciphertext via the bootstrapping method. The efficiency of the homomorphic operation is low. Chen et al. [14] constructed a multi-key variant of TFHE to achieve fast bootstrapping in the MKHE scheme, while also homomorphically evaluating a function in bootstrapping. However, this scheme can only encrypt binary numbers and does not support packaging technology, and bootstrapping is performed after each evaluation of the circuit gate. Chen et al. [13] and Li et al. [21] designed a multi-key variant of the BGV scheme by generating a linearized key based on the MK-GSW scheme, so that the plaintext space is not limited to the binary number set, and ciphertext packaging was achieved. Then Chen et al. [22] expanded their work, and constructed the MKHE scheme based on the homomorphic encryption scheme of BFV and CKKS, which optimized the relinearization technology. This technology was more efficient in ciphertext computing, but did not achieve programmable bootstrapping. Bootstrapping is needed to implement any number of homomorphic operations. In the existing multi-key homomorphic encryption schemes, there are hierarchical homomorphic encryption operations, that is, the number of homomorphic operations is limited. Among the schemes that support bootstrapping, only the scheme of TFHE class supports programmable bootstrapping. However, the existing MKHE schemes only support homomorphic operation of binary gates, and there is only one output function of programmable bootstrapping. In the work of Chillotti et al. [20], it is proposed to introduce BFV-type ciphertext multiplication into TFHE and realize multi-output programmable bootstrapping at the same time. However, this scheme is a single-key scheme, that is, it can only calculate the ciphertext under the same key, and cannot be applied to the case of multi-party joint computation. To this end, we will optimize this scheme to implement unique functions in a multi-key homomorphic encryption scheme. In Table 1, the functional comparison between the proposed scheme and related MKHE schemes is summarized.

Organization
In Section 2, we define or reference some background knowledge, including the basic knowledge of sample extraction and look-up tables required by the bootstrapping module in Section 3. We describe the basic components of multi-key homomorphic encryption in this paper, including key-switching keys generation, ciphertext relinearization and hybrid product. In Section 4, we describe the construction of our multi-key homomorphic encryption scheme, including encryption and decryption of ciphertext, homomorphic evaluation and bootstrapping. In Section 5, we conduct an analysis, including a supplementary analysis of safety, noise, and performance. Some optimization directions are discussed in Section 6. The conclusion is provided in Section 7.

Background Knowledge
In this subsection, we mainly introduce the low-level construction knowledge of MKFHE.

Notation
Throughout this paper, we use Z to denote the set of integers, B as the set of {0, 1}, bold lowercase letters to denote vectors, and bold uppercase letters to denote matrices. R = Z[X]/(X N + 1) denotes the ring of integer polynomials modulo the cyclotomic polynomial X N + 1, where N is a power of two. For a positive integer q, we denote R q = (Z/qZ)[X]/(X N + 1) for the integer polynomial ring R with coefficients modulo q, that is, the coefficient of the polynomial is reduced to [− q 2 , q 2 ) ∩ Z, and generally Z/qZ is expressed as Z q . R n q denotes the integer polynomial ring R q with integer dimension n. Let ψ denote the uniform distribution over the set of integer polynomials, where the coefficients are value 0 or 1 and modulo the cyclotometric polynomial X N + 1. · denotes rounding to the nearest integer value. a, b denotes the inner product of two vectors a and b. For a positive integer k, set [k] = {1, 2, . . . , k} is denoted by an index set. If D is a probability distribution, we use d ← D to denote the sampling d according to distribution D. Let D α be Gaussian distribution with variance α 2 where α is a small standard deviation.
Let ω α denote the random distribution over the set of integer polynomials, where the coefficient values are sampled over D α . U(S) denotes the uniform distribution on S, which is a finite set. For two nonnegative real functions f (n) and g(n), denote f (n) =Õ(g(n)) if there exists a positive constant c 1 , c 2 , N such that f (n) ≤ c 1 · g(n) · log c 2 g(n) is satisfied for any n ≥ N.

LWE and RLWE
The LWE problem and the RLWE problem were respectively introduced by Regev et al. [17], Lyubaskevsky et al. [18] and the simplified special-case version [23]. In TFHE, three main types of ciphertexts are used: LWE, RLWE and RGSW. RGSW is mainly used in the calculation of the external product of ciphertexts. In this paper, we do not use the external product, so we mainly use LWE and RLWE.
Theorem 1 (LWE Sample). For security parameter λ, let n = n(λ) be an integer dimension, let q = q(λ) ≥ 2 be an integer, χ = χ(λ) be a distribution over Z and α = α(λ) be a discretized Gaussian parameter. For secret key s sampled uniformly over χ n and error e is sampled uniformly over D α . An LWE sample is a pair (b, a) ∈ Z n+1 q , where b = − a, s + e (mod q) and a is sampled uniformly over Z n q .
Theorem 2 (RLWE Sample). For security parameter λ, let N = N(λ) be an integer with a power of 2, q = q(λ) ≥ 2 be an integer, ψ = ψ(λ) be a distribution over R and α = α(λ) be a discretized Gaussian parameter. Secret key s is sampled uniformly over ψ. The error e is sampled uniformly over ω α . An RLWE sample is a pair (b, a) ∈ R 2 q , where b = −a · s + e (mod q) and a is sampled uniformly over R q .
We define the following two problems based on LWE and RLWE samples:

Lemma 1.
In LWE and RLWE problems, there is no difference between a random vector and a vector (b, a) ∈ Z n+1 q or (b, a) ∈ R 2 q from our perspective. We cannot obtain any valuable information here, so we consider the Decisional (R)LWE Problem is hard.
We assume that the message m ∈ Z q . Add the message to b. So, b = − a, s + m + e (mod q), and obtain the LWE ciphertext (b, a) ∈ Z n+1 q of m. For the same assumption message m ∈ R q , we add the message to b that b = −a · s + m + e (mod q), resulting in the RLWE ciphertext (b, a) ∈ R 2 q of m. An additional scaling factor is added when encrypting in this paper to store the plaintext message in the most significant bits.
For one LWE ciphertext c = (b, a) ∈ Z n+1 q and a key s ∈ B n , we define the phase function ϕ s (c) as ϕ s (c) = b + a, s (mod q). When decrypting, we use c and s to calculate ϕ s (c) = c, (1, s) , and then approximately solve for the message m ∈ Z q . The same can be done similarly for RLWE ciphertexts.

Gadget Decomposition
The gadget decomposition tool can approximate large numbers and effectively control the growth of noise in homomorphic evaluation. We define the gadget decomposition as a function from R q to R d . Let g = (B 0 , . . . , B d−1 ) ∈ Z d be a gadget vector where base B is an integer and d is degree. Suppose there is a polynomial ring element a = R q , and a small polynomial vector g −1 (a) = (u 0 , . . . ,

Modulus Switching
Modulus switching mainly changes the modulus of the ciphertext into a different modulus. For two moduli 2N and q, the LWE ciphertext ct ∈ Z n+1 q is input, and the LWE ciphertext ct ∈ Z n+1 2N is output after modulus switching, without changing the size of the plaintext message and the key.

Sample Extract
The sample extract algorithm, based on an input index i, extracts an LWE ciphertext, which is an LWE encryption of the constant coefficient of the ith term of the polynomial ∑ N−1 i=0 m i X i . Specifically, this algorithm is called RLWE-to-LWE. Assuming that t ∈ R 2 q is an RLWE secret and s ∈ Z N+1 q is an LWE secret, where s is the combination of correlation coefficients extracted from t, the algorithm does not add additional noise. The expression for this operation is as follows: Table   This is used primarily to represent the function f : Table (LUT) and then it is encapsulated into an RLWE ciphertext. During the bootstrapping, the ciphertext is evaluated assuming that F · X −i , where i is the homomorphic decryption function of the ciphertext, and the LWE ciphertext is extracted at position '0' through sample extract, revealing that this is the LWE ciphertext with plaintext message f i . By constructing an appropriate LUT, a function can be evaluated during bootstrapping refresh of ciphertext. This article references the construction method of [20] to achieve the evaluation of multiple functions f during one bootstrapping operation of LWE ciphertext in multi-party computations.

Multi-Key Homomorphic Encryption
A multi-key homomorphic encryption system allows the computation of ciphertexts encrypted with different keys. Let M be the message space with arithmetic structure. A multi-key homomorphic encryption scheme MKHE consists of five PPT algorithms (Setup, KeyGen, Enc, Dec, Eval). Assume that an index id is set to each party.
• Setup: pp ← MKHE.Setup(1 λ ). Takes the security parameter λ as an input, returns the public parameter pp. • Key Generation: (sk, pk) ← MKHE.KeyGen(pp). Generates a pair of private keys and public keys. We assume that the private keys and public keys set the index id corresponding to each party. • Encryption: ct id ← MKHE.Enc(µ id , pk id ). Encrypts a message µ id ∈ M and returns a ciphertext ct id ∈ {0, 1} * . Similarly, we assume that the index id of each ciphertext corresponds to the ciphertext under the corresponding key.
. Given a ciphertext ct with the corresponding sequence of secret keys {sk id } id∈ [k] . Decrypts the ciphertext into a mes- . Given a circuit C and multi-key ciphertexts ct 1 , . . . , ct k with the corresponding set of public keys pk 1 , . . . , pk k , it returns a ciphertext ct. We assume that the output ciphertext contains information about the relevant parties involved.
Correctness. For 1 ≤ id ≤ k, according to ct id ← MKHE.Enc(µ id , pk id ), the ciphertexts of k parties are generated. If the ciphertext of any party is decrypted directly, the ) to obtain C(m 1 , . . . , m k ) with an overwhelming probability; we call this MKHE scheme correct.

The Building Blocks of Basic Scheme
This section describes the basic building blocks for building MKHE in LWE and RLWE, including key switching, relinearization, and hybrid product.

Basic Modules for LWE Ciphertext and RLWE Ciphertext
This section first describes the parameter settings, basic encryption methods, and key switching for the generation of LWE ciphertext and RLWE ciphertext.
• Setup(1 λ ): Given λ as the input security parameter, generate the dimension n of the LWE, the uniform distribution χ, Gaussian distribution parameter α, the ciphertext modulus q, and set the variable . Generate the dimension N of RLWE, the key distribution ψ, Gaussian distribution parameter α and the ciphertext modulus q. Set a CRS a ← U(R d q ), let the LWE public parameter pp = (n, χ, q, α, ) and RLWE public parameter pp = (N, ψ, α, q, a), returns parameter pp = (pp, pp ).
In this paper, the bootstrapping algorithm is performed on the LWE ciphertext to refresh the ciphertext noise. The variable selects the refreshed bits during module switching, and 2 represents the number of functions that can be output in batch during bootstrapping. Our basic scheme is to build on the CRS model and obtain the vector a ∈ R d q by sampling according to the generated public parameters pp . We assume that any party generates keys and ciphertexts based on common parameters as input, so as to support arithmetic operations between ciphertexts under different keys.
• KeyGen(pp ): Sample the LWE secret s ← χ n , set the LWE secret key s = (1, s) ∈ Z n+1 q . Sample the RLWE secret t ← ψ, set the RLWE secret key t = (1, t) ∈ R 2 q . Sample e ← ω d α as an error vector and set the b = −t · a + e (mod q) ∈ R d q as a public key. Returns the triple (s, t, b). The coefficients of the MKHE basic keys can be sampled from uniform distribution or Gaussian distribution, and the keys used in this paper mainly follow uniform binary distribution sampling. If different sampling methods are used to generate this scheme, replace the appropriate parameters and modify the CMux gate described in the next section.
• Enc(m, s): To encrypt a message m ∈ Z p . This is the standard LWE encryption. Generate samples a ← U(Z n q ) and e ← D α . Let b = − a, s + e + · m (mod q) and returns the ciphertext ct = (b, a) ∈ Z n+1 q . Suppose q is a ciphertext space, p is a plaintext space, and p < q. Load the plaintext message into the most significant bits of the ciphertext space, and then add noise to the least significant bits. Therefore, the scaling factor is = q p , as long as the noise in the ciphertext does not change the plaintext message, it can be decrypted normally, namely |e| < 2 .
• SwitchKeyGen(s 1 , s 2 ): Generate LWE-to-RLWE key-switching keys. Enter the LWE key s 1 = (s 1,1 , . . . , s 1,n ) ∈ Z n q and the RLWE key q , and return the key-switching keys KSK = {KS i } i∈[n] ∈ (R d×2 q ) n . Security. The ith term KS i of the key-switching keys adds the value related to the ith term of the LWE key s 1 ∈ Z n q to the product of the uniform distribution A i ∈ R d q and the RLWE key s 2 ∈ R q in the first column, and adds noise e i . This is similar to encrypting the ith term of the LWE key s 1 under the RLWE key s 2 to form a RLWE ciphertext. Assuming that the key-switching keys items are sampled according to the RLWE parameter (N, ψ, α), the RLWE decision problem shows that the advantage of distinguishing the key-switching q from the independent uniform distribution U(R d×2 q ) is almost negligible. It is difficult to extract the information of the LWE key s 1,i from KS i .
q is a ciphertext about the same LWE key s ∈ Z n q , set the index to q ) n are the key-switching keys from s to t ∈ R q . The following will list the correctness of the packing of the ciphertext calculation: Returns the RLWE ciphertext ct = (b , a 1 , . . . , a k ) ∈ R k+1 q after the key-switching.
Proof. Suppose that the LWE ciphertext under the concatenated key s = (s 1 , . . . , s k ) is are the key-switching keys generated by k participants respectively, and the key of the LWE ciphertext is transformed from s ∈ Z kN q to t = (t 1 , . . . , t k ) ∈ R k q without changing the plaintext message. The correctness of the multi-key-switching calculation is listed below: • UniEnc(m, t): Given a RLWE key t ∈ R q , enter a plaintext message m ∈ R q . Generate the ciphertext F = [f 0 |f 1 |f 2 ] ∈ R d×3 q as follows: Sample error e 2 ← ω d α , set f 2 = r · a + m · g + e 2 (mod q) ∈ R d q . This algorithm is a symmetric encryption, which can encrypt a ring element, and the generated ciphertext consists of three polynomial vectors. Compared with the general RGSW ciphertext in R 2d×2 q , its ciphertext size is about a quarter smaller. The first two columns of the ciphertext can be viewed as encrypting r with the key t, and the third column can be viewed as encrypting the message m with r, where r follows the ψ distribution. We will use uni-encryption to perform tensor products of multiple keys and hybrid products for bootstrapping. Security. First, given a plaintext message m ∈ R q , let RLWE parameters be (N, ψ, α, q) and declare a distribution q , denote by CRS, public key, and uni-encryption of m. Because the first four items are related to the RLWE key t, and f 2 is independent of the RLWE key t. According to the hardness of the RLWE problem, we can change the definition of the first four items and reveal that D 0 is compu- q . Then, because r ← ψ follows the same distribution as the RLWE key t, we also change the definition of f 2 according to the hardness of the RLWE problem and get that D 1 is computationally indistinguishable from distribution Observe that the uniform distribution D 2 is independent of the given plaintext message m, so it can be considered that the uni-encryption scheme is semantically secure.

Relinearization and Hybrid Product
This paper proposes to use uni-encryption to calculate the product of multiple parties' extended ciphertexts and the key part of bootstrapping. In the case of calculating these ciphertexts with different keys, a uni-encryption scheme can be effectively homomorphic, so that each party's keys meet the semantic security standards. This section will introduce the two-part components proposed in this paper.
are the relinearization keys and public keys published by k parties. Let ct i,j = c 1,i · c 2,j (mod q) ∈ R q , so ct 1 ⊗ ct 2 = (ct i,j ) 0≤i,j≤k ∈ R (k+1)×(k+1) q . According to the compo- 2 to the last k entries, respectively. In the iterative calculation of each term, . The correctness of the ciphertext relinearization is calculated as follows: ): Input multi-key RLWE ciphertext ct ∈ R k+1 q and the ith party's uni-encryption ciphertext F i ← UniEnc(m, t i ) and k participants public keys {b j } j∈ [k] . Assuming RLWE ciphertext ct = (ct 0 , ct 1 , . . . , ct k ) ∈ R k+1 q , let b 0 = −a, for 0 ≤ i ≤ k. The calculation follows the following method: Let v j = g −1 (ct j ), b j (mod q), return the ciphertext after the hybrid product Proof. Assuming that the participants have a total of k parties, the concatenated key is (1, t) = (t 0 = 1, t 1 , . . . , t k ) ∈ R k+1 q . According to the component conditions, the first term of the hybrid product output result is , the correctness of the ciphertext hybrid product is computed as follows: ): Given two multi-key RLWE ciphertexts ct 1 , ct 2 ∈ R k+1 q , and the uni-encrypted ciphertext F i of the ith party and the public keys {b} j∈[k] of the k parties. Return the ciphertext ct = ct 1 + Prod(ct 2 − ct 1 , F i , b j j∈[k] ).
As described above, our keys sampling follows a uniform binary distribution, and the CMux gate chooses the output ct 1 or ct 2 according to the key t i ∈ B.

Description
This section describes the multi-key scheme with single bootstrapping and multioutput for the proposed scheme.
• MKHE.KeyGen(p ): Suppose that each party independently generates its own keys based on the input parameter pp and follows the following method: 1. Run KeyGen(p ) to generate the LWE secrets, RLWE secrets and public keys as the triple (s i , q . In this paper, the ciphertext of the ith party is packed into the RLWE ciphertext, and the index id i is 0 when there is only one LWE ciphertext. If each party has multiple LWE ciphertexts, the product of multiple LWE ciphertexts can be achieved according to the change id i . See [20] for more details. • MKHE.Dec(ct, t 1 , . . . , t k ): Given a ciphertext ct ∈ R k+1 q and a set of keys t 1 , . . . , t k of the associated partys, set key t = (1, t 1 , .., t k ) ∈ R k+1 q . Compute 1 ct, t q to decrypt the RLWE ciphertext.
Next, the computation of the MKHE scheme will be described. Before this, the ciphertext needs to be preprocessed, and the RLWE ciphertexts of all parties are extended to the ciphertext under the concatenated key. By default, this paper preprocesses all the RLWE ciphertext before homomorphic calculation. Assuming that the number of parties is k, the extended ciphertext should satisfy the concatenated secret key t = (1, t 1 , .., t k ) ∈ R k+1 q . Rearrange and combine the input ciphertext ct i = (b i , a i,id 1 , . . . , a i,id k i ) ∈ R k i +1 q , the asso- Then the extended ciphertext is q , padding empty slots with zero.
After completing the homomorphic addition or multiplication of two ciphertexts, the noise of the ciphertext will grow rapidly. In the next step, we reference the method of [14] homomorphic accumulator to complete bootstrapping. That is, the decryption circuit of the extended LWE ciphertext is evaluated to realize the refresh of the noise. We obtain the ciphertext ct ∈ R k+1 q after homomorphic calculation, and use the sample extract algorithm to convert RLWE ciphertext into LWE ciphertext. Run SampleExtract i (ct). According to the index extracted from the packed ciphertext, the key of the LWE ciphertext obtained is the permutation and combination of the polynomial coefficients of the concatenated key t.
Finally, the LWE ciphertext ct ∈ Z kN+1 q is returned.
Using bits, the least significant bits can be used as the index of the bootstrapping function; thus, the plaintext message space will be correspondingly reduced, set plaintext message space p = q ·2 +1 . LUT function P ( f 1 ,..., f 2 ) ∈ R q is a polynomial composed of 2 functions, where 0 < 2 < for scaling factor = 2N p . Set ordinary RLWE ciphertext ct as an accumulator and perform CMux gate operation on it. F i,j is the uni-encryption for t i,j ∈ B where i ∈ [k] and j ∈ [N]. Using F i,j as the selection parameter, ct or ct · X a i,j can be homomorphically selected by the method of mixed product. Let plaintext space m ∈ [0, p − 1], t = (1, t 1 , . . . , t k ) ∈ Z kN+1 q . The calculation shows that ct , t ≈ · .., f 2 ) · X − ·m . Therefore, the LUT function is rotated by · m, and the entries of coefficients f 1 (m), ..., f 2 (m) are moved to the first 2 terms. Then the first 2 LWE ciphertexts are extracted and they are the result of homomorphic evaluation.
Finally, the ciphertext under the LWE key was replaced by the ciphertext under the RLWE key in the key-switching, waiting for the next homomorphic decryption or the multi-key ciphertext homomorphic calculation again. After bootstrapping, the ciphertext ct ∈ Z kN+1 q satisfies ct, t ≈ · f (m) (mod q), the key is t = (1, t 1 , . . . , t k ) ∈ Z kN+1 q . Replace the LWE key with the RLWE key (1, t) = (1, t 1 , . . . , t k ) ∈ R k+1 q with the key-switching keys. Then the corresponding ciphertext satisfies ct, (1, t) ≈ · f (m) (mod q). Security. This paper uses uni-encryption to generate bootstrapping keys and key-switching keys. It has been indicated in Section 3.2 that the keys meet semantic security standards. In order to enable the homomorphic encryption system to still have enough space for homomorphic computation (homomorphic addition or homomorphic multiplication) after a homomorphic computation of the decryption function, and to achieve any depth of homomorphic computation, we need to use the bootstrapping keys cyclically. So, as with many bootstrapping homomorphic encryption schemes, we propose an additional circular security assumption. Because the generation of these keys meets the semantic security, it is difficult to distinguish these ciphertexts from other ciphertexts. Consequently, we believe that the circular security hypothesis is secure.

Distributed Decryption
In an ideal homomorphic encryption scheme, each party only has its own key and does not know the keys of other parties. However, when decrypting a multi-key ciphertext, all the keys of the parties are needed, so it is not practical to complete the decryption without revealing the keys of all parties. In practical applications, such as MPC schemes, efficient protocols can be designed for joint decryption. This paper cites [24] to implement a simple distributed decryption based on noise flooding technology. Specific parameters and security can be referred to in this paper. A noise distribution ϕ with variance larger than the standard error distribution ψ of the basic scheme is first set, and a noise is added to the calculation of each party. Distributed decryption is roughly divided into two parts. The first part sends the items in RLWE ciphertext ct = (b, a 1 , . . . , a k ) ∈ R k+1 q except for those with plaintext messages to the corresponding participants, and each participant partially decrypts them and sends them out again. The second part is to connect the partially decrypted messages. The specific structure is as follows: • MKHE.PartDec(a i , t i ): Given the (1 + i) term a i ∈ R q of the RLWE ciphertext that needs to be decrypted, as well as the RLWE key t i ∈ R q of the ith party, sample an error e i ← ϕ. Generate message m i = a i · t i + e i (mod q) and return.
are the partially decrypted messages from all participants.

Security
As mentioned above, the basic encryption method in this article is based on the LWE and RLWE assumptions, using the uni-encryption method to generate relinearization keys and bootstrapping keys to complete the calculation of multi-key ciphertext. Consequently, the selected LWE parameters and RLWE parameters should meet the security level of at least λ bits. The basic principle is to add the encoded plaintext to a random encryption of zero to generate ciphertext, and then we can perform homomorphic evaluation on this ciphertext. The security of encryption generated key-switching keys, relinearization keys, and bootstrap keys methods are evaluated in Section 3.1.
• LWE problem. The LWE parameters (n, χ, q, α) are obtained according to the parameter generation, secret s = (s 1 , . . . , s n ) ← χ n . Let D α as an error distribution over Z q . The decisional learning with errors problem is to distinguish distributions D 0 and D 1 , among them D 0 = {(b, a) : a = (a 1 , . . . , a n ) RLWE problem. The RLWE parameters (N, ψ, α, q) are obtained according to the parameter generation, secret t ← ψ. Let ω α as an error distribution over R q . The decisional ring learning with errors problem is to distinguish distributions D 0 and D 1 , We base security on the LWE assumption. Firstly, if the adversary can distinguish between LWE encrypted vectors and uniform random vectors on Z n+1 q , then the adversary can solve the LWE problem. However, when the security level is at least λ bits, the LWE problem is hard, so the adversary cannot distinguish effectively. Secondly, if the adversary can effectively select the LWE encryption vector on Z n+1 q , but ciphertext generated by this encryption is independent of the plaintext message, making it difficult for the adversary to find plaintext messages from the ciphertext. The same holds for the RLWE assumption, and the adversary cannot solve the RLWE problem efficiently.

Noise Analysis
In Section 2.3 we introduced the base B and degree d of the gadget decomposition tool, and we know that the decomposition vectors are uniformly distributed over the interval Set the variance to B = 1/12 · B 2 − 1 for B is odd, 1/12 · B 2 + 2 for B is even; . Applying the decomposition will produce errors that are uniformly distributed in the interval (− 1 2·B d , 1 2·B d ], and we set the variance to ξ 2 = 1 12·B 2d . Gadget decomposition tools are used in the key switching and uni-encryption of the proposed scheme. We assume that the coefficients of the polynomial have the same independent random distribution, and noise estimates are provided next. LWE encryption. To encrypt a message m ∈ Z p , obtain ciphertext ct = (b, a) ∈ Z n+1 q where samples a ← U(Z n q ), e ← D α and b = − a, s + e + · m (mod q). Calculating phase ϕ s (ct) = e + · m (mod q). Hence, the noise of LWE encryption e LWEenc = e. The variance is V LWEenc = α 2 .
1. Hybrid product. The bootstrapped ciphertext is a uni-encrypted set of LWE keys t ∈ B, and the phase ϕ t (ct) = ∑ k j=0 g −1 (ct j ), , (r · e + e 1 ) (mod q). Hence, ϕ t (ct) = t · ∑ k j=0 ct j · t j + ∑ k j=0 g −1 (ct j ), (r · e + t · e · t j + e 2 · t j ) + ∑ k j=0 g −1 (v j ), (r· e + e 1 ) (mod q). To obtain the calculated noise, we use the following equation: e hybrid = ∑ k j=0 g −1 (ct j ), (r · e + e 2 · t j ) + ∑ k j=0 (t · e · t j + r · e ) + ∑ k j=0 g −1 (v j ), e 1 . e and e are noises generated by the decomposition. So, it is necessary to complete the noise variance V hybrid ≈ kN(NBdα 2 + ξ 2 ) of the hybrid product once. 2. CMux gate. Since the secret keys are sampled from a uniform binary distribution, Then, the uni-encrypted ciphertext of t i,j is used for homomorphic computation. Let c = ct · X −a i,j − ct = (c 0 , c 1 , . . . , c k ) ∈ R k+1 q , calculate the hybrid product once to get the phase ϕ t (ct) = ∑ k j=0 ct j · t j + t i,j · ∑ k j=0 c j · t j + e hybrid . c is regarded as the result of the homomorphic addition of two RLWE keys. Since the initial RLWE ciphertext is noise-free, the amount of noise increase after each run of the CMux gate can be considered as e hybrid . Run the CMux gate kN times in a bootstrapping operation; then, the final noise variance is V CMux ≈ 3kNV hybrid ≈ 3k 2 N 2 (NBdα 2 + ξ 2 ). 3. Key Switching. The above computation is then extracted to generate LWE ciphertexts.
Let one of them be c ∈ Z kN+1 q , and the key switching converts it into RLWE ciphertexts c ∈ R k+1 q . So there's where e i,j is the noise generated by the decomposition. Then, the noise variance of the key exchange is V swith = kN( 1 2 ξ 2 + NBdα 2 ). The noise variance of the final bootstrapping operation is approximately V boot = V CMux + V swith ≈ 3k 2 N 2 (NBdα 2 + ξ 2 ).

Performance Analysis
The MKHE scheme proposed in this paper is an extension of the multi-key TFHE scheme. The main purpose is to extend the functionality of bootstrap in the multi-key homomorphic encryption scheme, that is, to evaluate multiple functions homomorphically under a single refresh noise. At the same time, as much as possible, the computational efficiency is not degraded. Therefore, this paper mainly compares with the scheme [14]. Table 2 will list the comparison results.  [14]Õ(kn)Õ(k 2 n 2 )Õ(k 2 n 2 ) 1 OursÕ(kn)Õ(k 2 n)Õ(k 2 n 2 ) 2 From the table comparison analysis, we can see that the space and time performance of bootstrapping in this paper is consistent with the scheme of CCS19. Since each computation of the NAND gate of CCS19 requires a bootstrap, their homomorphic operation time complexity coincides with the bootstrap time complexity. In this paper, the homomorphic operation is separated from bootstrapping, so bootstrapping is not required after each homomorphic operation.The plaintext space of the CCS19 scheme is binary, and the utilization of the test polynomial encoded by LUT in bootstrapping is only 2 n . The plaintext space of this paper is p, which is no longer restricted to binary values. According to the reasonable setting of parameter , the proposed scheme can evaluate 2 functions at the same time in a bootstrap operation without adding additional noise, and the utilization of the LUT-encoded test polynomial is improved to p·2 n . Therefore, in the scenario of multi-party joint computation, when homomorphically computing the same number of functions, the proposed scheme can be implemented with fewer bootstrapping operations, which will effectively reduce the computational overhead.

Discussion
This scheme is a multi-key variant of the TFHE scheme, based on [20]. The selection of parameters can be referred to in this paper. This scheme is a basic multi-key scheme, which realizes the packing of ciphertext, homomorphic addition, tensor product and bootstrapping method of multi-output functions. We prove that the homomorphic calculation and bootstrapping method of ciphertext are effective, so it is easy to expand more homomorphic encryption functions and optimize based on this scheme.
A bootstrapping scheme without padding. Scheme [20] implements a high-precision homomorphic encryption scheme. Their bootstrapping method allows the most significant bit of the ciphertext to be non-zero, thereby increasing the plaintext message space and enabling the encryption of larger plaintexts. The basic function of this scheme is based on [20], so it is easy to expand the unfilled multi-key bootstrapping method in our scheme. The disadvantage is that their no-fill scheme requires more bootstrapping operations, while the bootstrapping operation in the homomorphic encryption scheme is quite expensive, thus greatly increasing the time and computational complexity. One improvement direction is to increase the number of bits in the plaintext space while simultaneously reducing computational complexity.
Faster evaluation LUT. This scheme applies LUT in the bootstrapping module. Two methods of packaging and calculating the LUT in the TFHE bootstrapping scheme are implemented in paper [15]. The ciphertext construction in this paper is in line with the TFHE scheme. Therefore, their LUT packing technique can be referred to in order to achieve a faster bootstrapping calculation of our scheme.
A faster MKHE scheme. The multi-key ciphertext homomorphic computation and bootstrapping method of this scheme are based on [14,22]. The hybrid product of [14] and the relinearization algorithm of [22] were optimized in [25,26], respectively, to improve the computational speed. It is easy to see that our scheme can also use their optimization schemes to improve the computation speed of the ciphertext multiplication and bootstrapping part of the homomorphic encryption.

Conclusions
The homomorphic encryption scheme can calculate the ciphertext. So, it can effectively reduce the risk of data leakage of the data holder in the cloud computing environment. However, most of the current homomorphic encryption schemes are designed for a single key. In practical scenarios, many outsourced computing requires homomorphic operations of data provided by different owners. Therefore, it is not limited to encrypting messages with a single key. In the existing MKHE schemes which support PBS, there are problems that a ciphertext can only encrypt binary message and only one function can be output at a time with PBS. In this paper, we specifically describe the MKHE scheme that supports multi-output PBS, so that multi-key ciphertexts can store high-precision plaintext messages. The tensor product and its relinearization are added to the computation of the multi-key ciphertexts. We separate the homomorphic operation from bootstrapping and implement a fast bootstrapping function similar to TFHE. At the same time, multiple functions can be homomorphically evaluated in a bootstrapping calculation, which enables faster homomorphic computation when there are multiple computing requirements. Our scheme also supports the packing technique of ciphertexts. Finally, we present the performance analysis. The results show that the scheme has better application scenarios.
In the discussion section, we discuss some improvement directions of this scheme. In addition, we can also consider how to homomorphically evaluate multiple functions at the bootstrapping time without reducing the plaintext space. Based on the concepts presented in this paper, we propose a CRS-free multi-key homomorphic encryption scheme. This scheme can be effectively applied in multi-party computation (MPC) or neural networks for enhanced privacy and security.