1 Introduction
In recent years, much progress has been made in developing quantum computing technologies [
1-
5]. Because of the quantum superposition principle, quantum computers can outperform their classical counterparts when performing certain tasks, for example, Shor’s algorithm [
6-
10], quantum simulation [
11-
14], solving linear systems of equations [
15-
17], and quantum machine learning [
18,
19]. Therefore, the emergence of quantum computers will change the world. Owing to high construction and maintenance costs, the first quantum computers are likely to be owned only by a small number of organizations. Fortunately, however, with cloud service, ordinary users are also expected to be able to apply so as to use these quantum computers.
As expected, IBM recently made a five-qubit quantum computer publicly available over the cloud [
20]. Based on a five-qubit superconducting chip in a star geometry and a full Clifford algebra, the system can be reprogrammed and allows for circuit design and simulation. Through the classical internet, users can easily test and execute quantum algorithms on an interactive platform called
. Several experiments have already been reported [
21-
23].
Future cloud quantum computing is likely to be available to users through an interface similar to IBM’s cloud quantum computing platform, where users interact with the platform through a website. In this case, the quantum circuit, input data, and output data of users are completely accessible to the server. While sharing cloud-based computational resources for quantum computing, we also need to consider privacy. Although a number of protocols and experiments have been proposed to develop secure cloud quantum computing [
24-
27], these encryption methods are not suited to the current level of technology, because input or output data cannot be accessible to the servers on the website in the previous protocol.
In classical cryptography, homomorphic encryption [
28-
30] is a scheme that allows certain operations to be performed on encrypted data without decryption. Thus, users can provide encrypted data to a remote server for processing without having to reveal the plaintext. Although the data are open to the server, the server cannot reveal the real data because the data are encrypted. After the server outputs the results to a user, the user can recover the actual output data through his privacy key. Therefore, homomorphic encryption has become a practical encryption technique for cloud computing.
In this study, we designed a homomorphic encryption protocol for cloud quantum computing, which is suitable for IBM’s cloud server. On the basis of the basic quantum gates provided by the server, we developed a series of construction methods for various operations. Finally, we successfully implemented a quantum algorithm for linear equations on IBM’s cloud server while protecting our privacy. This work will hopefully motivate more people to get involved in this field, because this study is the first to consider the security of users’ data on IBM’s cloud server and can provide guidance for future large-scale cloud quantum computing.
2 Methods
To solve linear equations on a quantum computer, we employ the quantum algorithm proposed by Harrow
et al. [
15], which can provide an exponential speedup over existing classical algorithms. Given a matrix
and a vector
, we aim to solve the equations
. To convert the problem to a quantum version, we rescale
and
to
. Thus, we can encode the problem as
Denote and as the eigenbasis and eigenvalues of matrix A, respectively. The input state can be expanded in the eigenbasis of as , where . To seek the solution , the algorithm can be decomposed into three main steps (see Fig. 1).
In the first step, phase estimation is applied to the transformation of into , where is the eigenvalue register of qubits, and eigenvalues are stored in the eigenvalue register after phase estimation.
In the second step, the map is implemented to extract the eigenvalues of . By implementing a controlled rotation on an additional ancilla qubit initially in the state , we can transform the system to
The final step is to implement inverse phase estimation to disentangle the eigenvalue register to . Then, we have
After measuring and postselecting the ancillary qubit of , we will obtain an output state , which is proportional to our expected result state .
To delegate the task of solving linear equations to IBM’s cloud quantum computing platform, one can directly encode the quantum circuit on the servers without considering security. This is equivalent to sending the cloud server the matrix and vector directly. However, when security is required, this approach is no longer feasible. Inspired by homomorphic encryption (see Fig. 2), we can compile a homomorphically encrypted version of the algorithm.
To implement homomorphic encryption, we must ensure that the operations of the server and the encryption scheme of the user meet the following conditions:
where denotes the operations of the server, and denotes the encryption of the message x. According to the conditions of homomorphic encryption, we can design the protocol as follows:
Step 1. For a linear equation with variants, the user randomly chooses as private keys, letting , and then substitutes it into the linear equations
The user rewrites the equations as , where , and then sends and to the cloud server.
Step 2. The server implements a quantum algorithm to solve the equations received from the user and feeds back the results to the user.
Step 3. The user decrypts the results as
Here, we analyze the entire process of the protocol. Step 1 can be regarded as the encryption process. That is, for , , where is the encryption of message . Let and F be linear equations and the algorithm for solving linear equations, respectively. Then step 2 can be represented as . Finally, step 3 is used to decrypt the results as , where D denotes the decryption operation; then the user can obtain the actual results. Note that the homomorphic encryption process perfectly hides the input and output of the user, and the server cannot obtain any of the private data, because it deals only with encrypted data.
3 Experimental realization
Here we present a proof-of-principle experiment of this protocol on IBM’s cloud quantum computing platform. Using one state qubit as the two-vector
, one eigenvalue qubit, and an ancilla qubit, we can use the protocol to solve systems of
linear equations. The quantum circuit of the algorithm for
linear equations can be compiled into the circuit shown in Fig. 3(a) [
13]. A unitary
is introduced to diagonalize matrix
as
, where
is the eigenvalue of
.
rotation can be realized by using a controlled
, where
,
is the usual Pauli matrix, and
θ is controlled by the eigenvalue qubit with the function
. The algorithm succeeds with probability when the ancilla qubit is measured in the state
. In our implementation, we choose the following two systems of linear equations:
Without loss of generality, we set the private key of the user to . By substituting into the linear equations, the user can perfectly hide his input data, and the equations can be rewritten as
Then the user can encode the circuit on IBM’s cloud quantum computing platform. For both of these linear equations, the
gate in Fig. 3(a) can be compiled into a Hadamard gate [see Fig. 3(c)]. Note that IBM provides only the CNOT gate as a two-qubit gate. To realize the controlled
operation (
is equal to
for both of the linear equations), we decomposed the controlled
gate into two CNOT gates, one
gate and one
gate. In our implementation, we set the eigenvalue register as the central qubit of IBM’s superconductor quantum chip. As the chip allows operation of CNOT gates only with the central qubit as the target qubit in their star geometry, if we want to operate CNOT gates with the central qubit as a control qubit, we need to combine a CNOT gate and four Hadamard gates. Then the controlled
gate can be compiled to a combination of several Hadamard gates, CNOT gates, the
gate, and the
gate [see Fig. 3(b)]. Now the question becomes how to construct an
R gate, because only Clifford gates (
and CNOT) and two non-Clifford gates (
T and
) are available on the platform. Adding almost any non-Clifford gate to the Clifford gates is universal [
31]. Therefore, by adding the
gate to the Clifford gates, it is possible to reach all the points of the Bloch sphere. A Monte Carlo simulation indicates that the more
gates our circuit has, the more densely we can cover the Bloch sphere with states we can reach. Figure 4 depicts the states attainable by adding at most 1, 3, 5, and 7
gates to the Clifford gates.
In Fig. 4, the red dot is the operation we desired. On the basis of the results of the numerical simulation, we can approximate the gate by the gate RS, which is a combination of seven gates and seven Hadamard gates [see Fig. 3(d)]. To characterize its accuracy, we compute the similarity as 0.998, where is the ideal unitary operation , and is the simulated unitary operation RS, indicating that our simulated unitary operation is very similar to the ideal operation . Through the red dot ( operation) and the purple dot (simulated operation RS) in Fig. 4(d), it is more intuitive that these two dots are very close. At this point, we can compile the full circuit for solving the two equations on the IBM servers.
4 Results
Measuring the first qubit of the circuit in Fig. 3(a) in the Pauli basis, we can obtain the solutions of the equations. Figures 5(a) and (b) show both the ideal (red bar) and experimentally obtained (blue bar) expectation values for each Pauli operator when the algorithm is implemented to solve Eqs. (9) and (10), respectively. We compute the fidelity of the output state as , where is the ideal output state, and is the experimentally output state from the measurement results of the Pauli basis. The output states have fidelities of 0.992(1) and 0.920(7) for Eqs. (9) and (10), respectively, indicating that our experiments yielded highly reliable results.
By postprocessing the results using a classical computer, the user can easily decrypt the secret results to obtain the actual results as and for Eqs. (7) and (8), respectively. Theoretical analysis shows that the error is within 2% of the actual solution. Thus, the homomorphic encryption protocol is found to be successful.
5 Conclusion
In summary, we presented the first experimental demonstration of a homomorphic encryption protocol for solving linear equations on IBM’s cloud quantum computer platform. The protocol is very suitable for current technology, which enables users to delegate the task of computation by encoding the circuit on the website of quantum servers while protecting their data. Even though the current quantum computations on IBM’s server are proof-of-principle demonstrations, the process can be scaled to larger systems in the future. Ideally, this work will provide a workable solution for future cloud quantum computation.
Higher Education Press and Springer-Verlag Berlin Heidelberg 2017