Classical Fully Homomorphic Encryption for Quantum Circuits: Difference between revisions

From Quantum Protocol Zoo
Jump to navigation Jump to search
Line 23: Line 23:
== Notations ==
== Notations ==
* k, security parameter
* k, security parameter
* Lc, depth of the circuit/ no. of layers
* <math>\tilde{x}</math> encryption of x
* x˜ encryption of x
* <math>L_c</math>, depth of a layer of circuit where each layer contains clifford gates and Toffoli gates
* Lc, depth of a layer of circuit where each layer contains clifford gates and Toffoli gates
* L, depth of the circuit (no. of layers in the circuit)
* L, depth of the circuit (no. of layers in the circuit)
* {pki,ski,evki,tski}, ith homomorphic key set generated from HE.KeyGen(). Public key for encryption, secret key for decryption, evaluation function key, trapdoor information required for randomness recovery from ciphertexts.
* <math>{{pk}_i,{sk}_i,{evk}_i,{tsk}_i}</math>, <math>i_{th}</math> homomorphic key set generated from HE.KeyGen(). Public key for encryption, secret key for decryption, evaluation function key, trapdoor information required for randomness recovery from ciphertexts.
* y, measurement outcome of third register
* y, measurement outcome of third register
* (µ0,r0)(µ1,r1) random claw for TCF pair, for given y
* <math>(µ_0,r_0),(µ_1,r_1)</math> random claw pair, for given y
* d, measurement outcome of the second register
* d, measurement outcome of the second register
== Hardware Requirements ==
== Hardware Requirements ==



Revision as of 11:34, 20 November 2018

The example protocol Mahadev (2017) achieves the functionality of Secure Delegated Quantum Computation by a method which involves fully classical offline and no quantum communication. It uses only classical Homomorphic Encryption (HE) scheme to evaluate quantum circuits for classical input/input. It allows a fully classical Client to hide her data such that Server can carry out any arbitrary quantum computation on the encrypted data without having any knowledge about Client’s inputs. It hides the output and input of the computation while Server is allowed to choose the unitary operation (any quantum gate) for required computation. Quantum offline communication would be required if Client’s input and output is quantum.

Tags: Two Party, Quantum Functionality, Universal Task, Secure Delegated Quantum Computation, Prepare and Send Quantum FHE, Classical Offline Communication, Superposition, Trapdoor Claw-Free Functions (TCF), Learning With Errors, Encrypted CNOT Operation.

Assumptions

  • This protocol is secure against honest but curious adversary setting.
  • HE is a classical leveled fully homomorphic encryption scheme which is quantum capable for given depth of one layer of circuit, (See Notations below).
  • A BQP Server can generate a superposition of inputs for the encryption function over some distribution given the public key used for encryption. The protocol takes learning with errors assumption.

Outline

FHE presents a classical protocol with the help of which a completely classical Client could assign Server a quantum computation for her encrypted (hidden) input/output. Similar to any classical HE this scheme is divided into four steps: Key Generation generates keys for encryption, decryption and evaluation of the circuit; Encryption encodes the input into a secret text using the encryption key generated during Key Generation; Evaluation performs operations (implements the circuit) on the encrypted input using evaluation key generated and Decryption transforms result of the evaluation step hidden in the secret text, to outcome of the circuit for Client's input using decryption key. Following the stages of Secure Delegated Quantum Computation, in preparation stage, Client encrypts her input by performing one time pad to hide it from the Server, who, in the computation stage, performs quantum computation by a completely classical evaluation step. There are two kinds of gates in Quantum Computation (See Heirarchy of Quantum Gates in Supplementary Information) Clifford Gates, which consists of Hadamard gate, CNOT and Pauli gates (X, Y, Z) and Toffoli gates (any single qubit phase/rotation gate). A universal scheme can perform both these types of gates implying that it can perform any quantum operation. Now, applying Clifford gates remains a simple step as it leaves the state with only Pauli corrections (X, Z) which are easy to handle as these gates commute with every quantum gate and hence can be shifted and cancelled out by applying corresponding inverse gate later by the Client, but when applying Toffoli Gates, it leaves the state with some Pauli corrections and Clifford gate corrections depending on the one pad key used for encryption key used by Client. Decryption key cannot deal with Clifford gate errors as they do not commute with all quantum operations and hence it needs to be corrected by applying corresponding inverse gate before the operation of next gate for computation by the Server. These Clifford gate corrections are a combination of CNOT corrections dependent on encryption key and a Hadamard correction independent of encryption key. Thus, applying Hadamard requires no extra information but CNOT gate errors require revelation of the encryption key. FHE deals with this problem via Encrypted CNOT operation using Trapdoor Claw-Free Function (TCF) without revelation of encryption key to the Server. Finally, in the Output Correction stage, Client gets her inputs and updated encryption keys to get the correct final outcome from the secret text using her decryption key. Following is an outline of the steps to illustrate the above mentioned scheme, assuming depth of circuit (see notations used) equal to L.
The preparation stage incorporates,

  • Key Generation: Client generates L+1 classical homomorphic key sets consisting of public key, evaluation key, secret key, trapdoor information (a piece of information required to invert the function used for encrypted CNOT operation, as explained in Circuit Evaluation) using HE.KeyGen() (classical HE step). Evaluation key consists of first L pairs of secret key-trapdoor information encrypted with last L public keys such that secret key-trapdoor key pair and public key do not belong to the same key set. Evaluation key also contains this public key used to encrypt the pair.
  • Encryption: Client uses classical one time pad to hide her input and encrypts the pad key with the first public key (not used to encrypt any trapdoor-secret key pair) using HE.Enc() (classical HE step). She then sends the hidden classical input with encrypted pad key and classical evaluation key to the Server over classical channel. This step marks the end of preparation stage.

Further, the computation stage incorporates,

  • Circuit Evaluation: Server starts with the classical one time padded states from the Client and generates the required quantum states. For each gate of the circuit that Server applies, he updates the encrypted Pauli encryption according to rules given in Pseudo code below. In case of Toffoli gate operation, an additional step is incorporated where he corrects the extra Clifford gate error performing encrypted CNOT operation and then Hadamard operation on the target qubit. This step uses evaluation key and can be explained as follows.

Encrypted CNOT operation All errors imposed by Toffoli gates can be represented using encrypted CNOT operation, a Hadamard operation and a set of Pauli gates (X, Z). All errors imposed by Clifford gates can be represented by a combination of Pauli gates. A mathematical representation of this step can be found in the Supplementary Information.

  1. TCF: This operation uses Trapdoor Claw Free function pairs which have the same image (output) for different pre-images(inputs) called 'random claw pair'. Given the image, it is rendered a hard problem to find this corresponding random claw without its trapdoor information (example, a piece of information required to invert the function). For this protocol, the HE Encryption function (HE.Enc()) is taken as one of the functions. A second function whose distribution is shifted from the previous function by a natural (homomorphic) XOR operation (a requirement for the classical HE scheme used) of encrypted key bit used for that encryption function. This means, the functions have a common range such that for every image (output), the pre-images (input) for each of the functions stated above would also differ by a XOR operation of actual (not encrypted) key bit. Thus, any element in the said range set would have one pre-image in the domain set of each function, together called random claw pair. If one performs a XOR operation on the pair, the result is pad key bit. This is implied from the properties of homomorphic XOR. Thus, any pre-image pair (random claw) thus, obtained, hides the pad key (to be used later for Encrypted CNOT operation). In simple words, the above paragraph implies that if two functions are separated by encrypted pad key via a homomorphic XOR operation, their inputs for a common output (random claw pair) would be separated by the (not encrypted) pad key bit.
  2. Server's preparation Thus, Server creates a superposition of inputs for the functions over some distribution. Next, he creates a superposition of quantum states generated from Client's input. After applying the gates on qubits, for correction of CNOT errors, Server creates three registers. First has the superposition of single qubit states, second has the superposition of quantum states generated from Client's input while third register has the output of one of the two functions illustrated above, where the function (one of the two) is chosen according to the first register and its quantum input is taken from the second register. Hence, these registers are entangled. Server, now measures the third register which reduces second register to a random claw pair as discussed before, hiding the pad key. It is still hidden from the Server as he does not know trapdoor information to be able to know the random claw pair and he cannot compute it from the measured output as it is a hard problem.
  3. Server's Toffoli gate operation After some calculations it can be shown that if Server performs Hadamard operation on the second register and then measures it, the first register is reduced to corrected quantum state with some extra Pauli corrections. These final Pauli corrections require trapdoor information and measurement outcome of the second register. To perform the above operation one needs the secret text to be same throughtout the protocol and existence of a natural XOR operation. This is not known to have been achieved by a single HE together. Hence, this protocol uses AltHE (an alternate HE) which can operate XOR for encrypted CNOT operation while he uses HE for updation of Pauli keys. In order to do this, HE provides a conversion of secret text under HE to secret text under AltHE and vice versa. Thus, after encrypted CNOT operation, encrypted pad key bit and other measurement outcomes are recrypted using public key provided in the evaluation key for that step, under HE. Thus, the trapdoor information and pad key bit are encrypted under same public key. Now, using the measurement outcome and the encrypted trapdoor information with recrypted pad key, Server obtains Pauli corrections. The Server encrypts Pauli corrections under public key for corresponding layer and hence updates the recrypted pad key
  4. Server's Clifford gate operation Server obtains with Pauli corrections according to rules described in the Pseudo code and updates the recrypted pad key as before.
  • Decryption Server repeats the same procedure for each layer and at the end of last layer, sends the updated recryption of pad key and classical measurement output of the first register (containing the corrected quantum state encrypted by pad key) to Client. Client converts the pad key to another secret text using AltHE. The sent pad key is recrypted with public key of the last () evaluation key used. This is the public key. Hence, Client uses secret key (which was not included in the evaluation keys) to decrypt the updated encryption of pad key sent by the Server. She (Client) uses the resulting pad key to undo the one time pad on the sent output.

Notations

  • k, security parameter
  • encryption of x
  • , depth of a layer of circuit where each layer contains clifford gates and Toffoli gates
  • L, depth of the circuit (no. of layers in the circuit)
  • , homomorphic key set generated from HE.KeyGen(). Public key for encryption, secret key for decryption, evaluation function key, trapdoor information required for randomness recovery from ciphertexts.
  • y, measurement outcome of third register
  • Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (µ_0,r_0),(µ_1,r_1)} random claw pair, for given y
  • d, measurement outcome of the second register

Hardware Requirements

Properties

  • Quantum Capable A classical HE is quantum capable i.e. can perform quantum computation efficiently if there exists AltHE which can execute natural XOR operations.
  • Indistinguishability under Chosen Plaintext Attacks by adversary(IND-CPA) The presented classical FHE scheme is CPA secure i.e. it is not possible for any polynomial time adversary to distinguish between the encrypted classical message bits 0 and 1, by learning with errors.
  • Compactness This protocol is compact i.e. decryption does not depend on the complexity of the quantum circuit.
  • Correctness Correctness is implied from the correctness of encrypted CNOT operation.
  • Circuit Privacy This protocol is not circuit private as both Client and Server know the quantum circuit used for performing the computation.
  • Full Homomorphism This protocol is fully homomorphic i.e. Server can operate any quantum circuit using this protocol.
  • Circular Security This orotocol has a stronger notion of circular security where not only the secret key but also the trapdoor functions are encrypted when provided to the Server.

Pseudo-Code

Stage 1 Client’s Preparation

  • Input: k, L, Lc, classical message m, ( and Quantum Input |ψi in case of quantum inputs)
  • Output: Homomorphic key sets (pki,evki,ski,tski), encrypted pad key ˜a,˜b (and Quantum One time Padded Output State XaZb |ψi in case of quantum output)
Key Generation (FHE.KeyGen(1λ,1L))
  1. For 1 ≤ i ≤ L + 1,
  2. Client generates homomorphic key set, (pki,evki,ski,tski) =HE.Keygen(1 The public key pk is pk1 and the secret key sk is skL+1.

The evaluation key evk consists of (evk1,...,evkL+1) as well as (pki+1,HE.Encpki+1(ski), HE.Encpki+1(tski)) for 1 ≤ i ≤ L.

Encryption (FHE.Encpk(m))
  1. Client chooses pad key for each message bit a,b ∈ {0,1}λ.
  2. She then encrypts this pad key and sends it to the Server with the evaluation keys. HE.Encpk1(a,b)),
  3. She sends encrypted classical message XaZb |li which can be represented as the classical string a⊕m. In case of quantum output Client uses pad key to hide her quantum state using QOTP (XaZb |ψi) and then sends this hidden state to the Server alongwith the encrypted pad key.


Stage 2 Server’s Computation

• Input: evaluation key (evki), encrypted pad key ˜a,˜b concatenation (c), one time padded message l (and Quantum One time Padded Output State in case of quantum output) • Output: updated encryption of pad key ˜a,˜b (and Quantum One time Padded Output State Xa˜Z˜bC |ψi in case of quantum output, where C is the quantum circuit)

Circuit Evaluation (FHE.Eval())
  • Let the Circuit be denoted by C and the gates be ci
  1. Server creates a superposition state for the encrypted classical message and Pauli one time pads it using encrypted pad key. He applies the circuit on it as follows:
  2. For all i, ci gate is applied on qubit l and the lth bits of pad key (˜a[l],˜b[l]) are updated to (a˜0[l],˜b0[l]) as follows.
    1. If ci = {P,H,CNOT}, a Clifford gate then //(ciXa[l]Zb[l]ψ = Xa0[l]Zb0[l]ciψ)
      1. if ci =H then //Hadamard Gate
        (a˜[l],˜b[l]) → (˜b[l],a˜[l]) (Hadamard tranforms X gate into Z and Z into X)
      2. if ci =P then //Pauli Gate
        (a˜[l],˜b[l]) → (a˜[l],a˜[l] ⊕˜b[l])
      3. if ci =CNOT with m as target bit and n as control bit then (CNOT)
        (a˜[l],˜b[l];˜a[n],˜b[n]) → (a˜[l],˜b[l] ⊕˜b[n];˜a[l] ⊕ a˜[n],˜b[n])
    2. If ci = T gate then //Toffoli Gate on lth,nth,oth key bits
      1. The Toffoli gate is applied to the Pauli one time padded state and the state is reduced to combination of Clifford C and Pauli P corrections as follows:
        TXa[l]Zb[l]Xa[n]Zb[n]Xa[o]Zb[o] |ψi
        =TXa[l]Zb[l]Xa[n]Zb[n]Xa[o]Zb[o]T † T |ψi
        = CNOTl,oa[n]CNOTn,oa[l]CZl,nb[o]Xa[l]Zb[l]T |ψi
        = CNOTl,oa[n]CNOTn,oa[l]HnCNOTl,nb[o]HnXa[l]Zb[l]T |ψi
        = CabPabT |ψi, where C{CNOT,H} and
      2. The Pauli key encryptions are homomorphically updated according to P_ab
      3. Three encrypted CNOTs are used to correct Cab as follows.
        1. The server applies encrypted CNOT operation to the two qubit state ZzXx |ψi using the ciphertext ˆc =HE.Convert(c).
        2. Server generates following superposition sampled over random distribution D for the TCF function pairs (f0 =AltHE.Encpk(),f1) based on the condition f0 ⊕H f1 = cˆ{euqation missing}
        3. Servers generates three register for quantum input, function input, function output and entangles them as follows{equation missing}
        4. Server measures the last register to get a ciphertext y =AltHE.Encpk(µ0,r0), where µ0 ⊕ µ1 = s.
        5. Server performs Hadamard on second register and measures it to get a string d such that first register of input quantum state is reduced to: the following ideal state:
          (Zd·((µ0,r0)⊕(µ1,r1)) ⊗ Xµ0)CNOT (1)
          where AltHE.Encpk(µ0;r0) = AltHE.Encpk(µ1;r1) ⊕H cˆ and ⊕H is the homomorphic XOR operation.
        6. The server uses pki+1 to compute HE.Encpki+1(ca,b,pki) and HE.Encpki+1(c,y,dˆ ).
        7. The server computes the encryption of a,b under pki+1 by homomorphically running the decryption circuit on inputs HE.Encpki+1(ski) and HE.Encpki+1(ca,b,pki) .
        8. The server homomorphically computes (µ0,r0) and (µ1,r1), using the ciphertexts encrypting tski,ski,c,y,dˆ (all encrypted with HE under public key pki+1). The server then uses this result, along with the ciphertexts encrypting a,b,d, to homomorphically compute ˜b = b + (d · ((µ0,r0) ⊕ (µ1,r1)),0) and ˜a = a + (0,µ0).
  3. Server sends updated encryptions of Pauli corrections ˜a,˜b and the classical outcome after measurement of the output state (or Quantum one time padded state in case of quantum output) to Client.


Stage 3 Client’s Output Correction

  • Input: Classical output state, l ∈ {0,1}λ (or Quantum One time padded state in case of Quantum output), encrypted Pauli corrections ˜a,˜b
  • Output: Decrypted classical message x ⊕ m (or final quantum output of computation ZzXx |ψi)
Decryption (FHE.Decsk)
  1. Client decrypts ˜a,˜b using skL+1 to obtain a,b.
  2. She then uses the decrypted Pauli corrections to get the output XaZb |li, which can be represented as a ⊕ l.
    She operates XaZb on quantum output to get C|ψi, in case of quantum output.