Efficient Multi-Key Homomorphic Encryption with Packed Ciphertexts
Total Page:16
File Type:pdf, Size:1020Kb
Efficient Multi-Key Homomorphic Encryption with Packed Ciphertexts with Application to Oblivious Neural Network Inference Hao Chen1, Wei Dai1, Miran Kim2, and Yongsoo Song1 1 Microsoft Research, Redmond, USA 2 UTHealth, Houston, USA fhaoche, wei.dai, [email protected] [email protected] Abstract. Homomorphic Encryption (HE) is a cryptosystem which supports computation on en- crypted data. L´opez-Alt et al. (STOC 2012) proposed a generalized notion of HE, called Multi-Key Homomorphic Encryption (MKHE), which is capable of performing arithmetic operations on ci- phertexts encrypted under different keys. In this paper, we present multi-key variants of two HE schemes with packed ciphertexts. We present new relinearization algorithms which are simpler and faster than previous method by Chen et al. (TCC 2017). We then generalize the bootstrapping techniques for HE to obtain multi-key fully homomorphic encryption schemes. We provide a proof-of-concept implementation of both MKHE schemes using Microsoft SEAL. For example, when the dimension of base ring is 8192, homomor- phic multiplication between multi-key BFV (resp. CKKS) ciphertexts associated with four parties followed by a relinearization takes about 116 (resp. 67) milliseconds. Our MKHE schemes have a wide range of applications in secure computation between multiple data providers. As a benchmark, we homomorphically classify an image using a pre-trained neural network model, where input data and model are encrypted under different keys. Our implementation takes about 1.8 seconds to evaluate one convolutional layer followed by two fully connected layers on an encrypted image from the MNIST dataset. Keywords: Multi-key homomorphic encryption · Packed ciphertext · Ring learning with errors · Neural networks. 1 Introduction As large amount of data are being generated and used for driving novel scientific discoveries, the effective and responsible utilization of large data remains to be a big challenge. This issue might be alleviated by outsourcing to public cloud service providers with intensive computing resources. However, there still remains a problem in privacy and security of outsourcing data and analysis. In the past few years, significant progresses have been made on cryptographic techniques for secure computation. Among the techniques for secure computation, Multi-Party Computation (MPC) and Homomorphic Encryption (HE) have received increasing attention due to technical breakthroughs. The history of MPC dates back three decades ago [50, 5], and since then it has been intensively studied in the theory community. In this approach, two or more parties participate in an interactive protocol to compute a function on their private inputs, where only the output of the function is revealed to the parties. Recent years witnessed a large body of works on improving the practical efficiency of MPC, and state-of-the-art protocols have achieved orders of magnitude improvements on performance (see e.g. [20, 49, 36]). However, these protocols are still inherently inefficient in terms of communication complexity: the number of bits that the parties need to exchange during the protocol is proportional to the product between the complexity of the function and the number of parties. Therefore, the high communication complexity remains the main bottleneck of MPC protocols. Moreover, the aforementioned MPC protocols may not be desirable for cloud-based applications, as all the parties involved need to perform local computation proportional to the complexity of the function. 2 H. Chen et al. However, in practical use-cases, we cannot expect the data providers to either perform large amount of work or stay online during the entire protocol execution. Another model was proposed where the data owners secret-share their data with a small number of independent servers, who perform an MPC to generate the computation result [23, 44]. These protocols have good performance and they moved the burden from the data providers to the servers, but their privacy guarantees rely on the assumption that the servers do not collude. HE refers to a cryptosystem that allows computing on encrypted data without decrypting them, thus enabling securely outsourcing computation in an untrusted cloud. There have been significant technical advances on HE after Gentry's first construction [24]. For example, one can encrypt multiple plaintext values into a single packed ciphertext, and use the single instruction multiple data (SIMD) techniques to perform operations on these values in parallel [48, 26]. Hence, HE schemes with packing techniques [7, 6, 22, 16] have good amortized complexity per plaintext value, and they have been applied to privacy- preserving big data analysis [39, 11, 37]. However, traditional HE schemes only allow computation on ciphertexts decryptable under the same secret key. Therefore, HE does not naturally support secure computation applications involving multiple data providers, each providing its own secret key. Fig. 1. High-level overview of the application to oblivious neural network inference. L´opez-Alt et al. [43] proposed a Multi-Key Homomorphic Encryption (MKHE) scheme, which is a cryptographic primitive supporting arithmetic operations on ciphertexts which are not necessarily decryptable to the same secret key. In addition to solving the aforementioned issues of HE, MKHE can be also used to design round-efficient MPC protocols with minimal communication cost [45]. In addition, an MPC protocol from MKHE satisfies the on-the-fly MPC [43] property, where the circuit to be evaluated can be dynamically decided after the data providers upload their encrypted data. Despite its versatility, MKHE has been seldom used in practice. Early studies [19, 45, 46] used a multi- key variant of the GSW scheme [28]. These constructions have large ciphertexts and their performance does not scale well with the number of parties. Previous works [8, 10] proposed MKHE schemes with short ciphertexts, with the caveat that one ciphertext encrypts only a single bit. The only existing MKHE scheme with packed ciphertexts [13, 41] is a multi-key variant of the BGV scheme [7]. Note that all the above studies were purely abstract with no implementation given, and it remains an open problem whether an MKHE scheme with support for SIMD operations can be practical. 1.1 Our Contributions We design multi-key variants of the BFV [6, 22] and CKKS [16] schemes. We propose a new method for generating a relinearization key which is simpler and faster compared to previous technique in [13]. Furthermore, we adapt the state-of-the-art bootstrapping algorithms for these schemes [12, 14, 9] to the multi-key scenario to build Multi-Key Fully Homomorphic Encryptions with packed ciphertexts. Finally, we give a proof-of-concept implementation of our multi-key schemes using Microsoft SEAL [47] and Efficient MKHE with Packed Ciphertexts 3 present experimental results. To the best of our knowledge, this is the first practical implementation of MKHE schemes that support packed ciphertexts. We also present the first viable application of MKHE that securely evaluates a pre-trained convolu- tional neural network (CNN) model. We build an efficient protocol where a cloud server provides on-line prediction service to a data owner using a classifier from a model provider, while protecting the privacy of both data and model using MKHE. Our scheme with support for the multi-key operations makes it possible to achieve this at a low end-to-end latency, and near-optimal cost for the data and model providers, as shown in Fig. 1. The server can store numerous ciphertexts encrypted under different keys, but the computational cost of a certain task depends only on the number of parties related to the circuit. We note that our solution has the advantage over single-key HE since the ML model providers do not need to send the unencrypted model to the server. 1.2 Overview of Our Construction n Let R = Z[X]=(X +1) be the cyclotomic ring with a power-of-two dimension n, and si 2 R be the secret of the i-th party. The starting point of the construction of a ring-based MKHE scheme is the requirement that the resulting scheme should be able to handle homomorphic computations on ciphertexts under independently generated secret keys. A ciphertext of our MKHE scheme associated to k different parties k+1 is of the form ct = (c0; c1; : : : ; ck) 2 Rq for a modulus q, which is decryptable by the concatenated secret sk = (1; s1; : : : ; sk). In other words, its phase µ = hct; ski (mod q) is a randomized encoding of a plaintext message m corresponding to the base scheme. Homomorphic multiplication of BFV or CKKS consists of two steps: tensor product and relineariza- tion. The tensor product of two input ciphertexts satisfies hct1 ⊗ct2; sk⊗ski = hct1; ski· hct2; ski, so it is a valid encryption under the tensor squared secret sk ⊗ sk. In the relinearization step, we aim to transform (k+1)2 the extended ciphertext ct = ct1 ⊗ ct2 2 Rq into a canonical ciphertext encrypting the same message under sk. This step can be understood as a key-switching process which requires a special encryption of sk ⊗ sk. We note that sk ⊗ sk contains entries sisj which depend on secrets of two distinct parties. Hence a relinearization key corresponding to non-linear entries cannot be generated by a single party, different from the traditional HE schemes. We propose an RLWE-based cryptosystem to achieve this functionality. It looks similar to the ring variant of GSW [28, 21] but our scheme supports some operations between ciphertexts under different keys. Let g 2 Zd be an integral vector, called the gadget vector. This scheme assumes the Common d Reference String (CRS) model so all parties share a random polynomial vector a 2 Rq . Each party d×3 i generates a special encryption of secret si by itself, which is a matrix Di = [di;0jdi;1jdi;2] 2 Rq satisfying di;0 + si · di;1 ≈ ri · g (mod q) and di;2 ≈ ri · a + si · g (mod q) where ri is a small polynomial sampled from the key distribution.