Encryptions
We introduced private-key encrytion earlier, but public-key encryption is deferred to this section. It is because the hardness assumption: private-key encryption and other primitives can be based on the existence of OWFs, but we need other assumptions to obtain PKE.
Learning with Errors, LWE
In this section, we change the representation of so that
The modular arithmetic is the same. We also say that an element in is small if it is close to 0.
We consider matrix and vector such that . Let . Using standard linear algebra, it is efficient to solve (when is full rank).
The LWE problem considers the following variant: and are chosen as before, but an additional error vector is sampled such that is small (we will have each coordinate of small in ). Then, the goal is to find such that
where , , and is small. The hardness of this problem, Learning with Errors, is parameterized by , and the bound of small. When parameters are chosen appropriately, this problem is believed to be hard even for quantum algorithms (the belief is established by reductions from lattice problems which is beyond the scope).
For our purpose, it is easier to use the decision variant of LWE, formalized next.
Definition: Learning with Errors (LWE) Assumption
We say the decisional problem is quantum-hard if for all quantum polynomial-time distinguisher there is a negligible function such that for all ,
where are functions of , and is an efficiently samplable distribution over .
Discuss:
- Again, the hardness depend on the parameters . For example, when is uniform over , the two distributions are identical (but useless).
- Notice that the above definition also samples from .
- The two distributions differ in entropy: consists of uniform elements from , but is sampled from uniform elements plus elements from .
An useful set of parameter:
- , the smaller the harder LWE
- so that we can write an element in bits
- a distribution such that , outputs except with negligible probability (think as a uniform dist); the larger compared to the harder LWE
NIST candidate, CRYSTALS-Kyber:
- for
- so it can be viewed as
- binomial distribution, 3 or 5 fair trials (so that )
Ref: [KL, 14.3]. Regev05 proposed LWE, following the “learning from parity with error” problem. Regev10 is a good survey.
Corollary:
Suppose that . If , then .
Proof idea: because and coprime, and are identically distributed (and as well).
An Encryption Based on LWE
If we have the following decisional :
Then, given such that , we also have
by a simple reduction that multiply the former indisintinguishability by (because and are both uniform over ). Hence, we can construct a secret-key encryption.
Construction: Secret Key Encryption from LWE
Parameters: as a function of , a distribution over .
: output
: for binary message , sample and , output (where the arithmetic is in ).
: output
The correctness is direct. The (secret-key) CPA security can be proved by a reduction such that when ever the adversary of the encryption asks for an encryption, takes the next row from its LWE input and adds . The details are skipped here.
Homomorphic Encryption
Definition: Homomorphic encryption.
A (public or secret key) encryption scheme is said to be homomorphic if the scheme provides efficient operations that satisfies the syntax and correctness below.
Addition: For any messages ,
Multiplication: For any messages ,
Multiply by constant: For any messages ,
Here, the message space and the arithmetic operations are in , but one may define similarly for other algebra.
[Ref: Barak@Prinecton]
Discuss:
- The homomorphic operations are requiring correctness (not security).
- We sometimes relax the correctness to “except for negligible probability” due to technical construction
- The above definition requires only for “single hop” homomorphic operation, which means that and work for ciphertexts freshly encrypted by
- We may define -hop operations so that or work also for ciphertexts that is output by -hop or
- Ideally, we want unlimited-hop operations. Since in implement logical (XOR, AND), that enables any boolean-circuit computation on ciphertexts. This is called Fully Homomorphic Encryption, FHE.
- Less ideally, if a scheme achieves unlimited-hop and multiply by constant, it is called additive homomorphic encryption (or linear homomorphic), which is still useful.
- Notice that and need no key, which is essential (otherwise, given key, it would be trivial to perform the operations)
- It is trivial and cheating to output as the output of (and resp.), which belows up the size of the ciphertext and leaves the actual arithmetic to . However, in the above 1-hop Add and Mul definition, we have no way to require it (because one may always pad with unused bits). For more-than-constant hops, we require the ciphertext size to be small even after homomorphic evaluations.
Alternatively, we define homomorphic encryption with respect to a class of circuits .
Definition: Homomorphic encryption for class .
Let be a class of circuits. We say the encryption scheme is homomorphic for if for any , for any where is the input size of , let be the encryption key,
Moreover, we require the output size of to be compact, that is, bounded by .
The above secret-key encryption based on LWE has a direct homomorphic addition. To see why, consider two ciphertexts that is encrypted using the same key ,
The homomorphic is defined to be the coordinate-wise addition:
where and . The multiplication by constant is also coordinate-wise multiply by plaintext . Notice that the correctness holds as long as before modulo . Hence, we can perform operations (of addition or multiply by constant) and then still obtain the correct decrytion, where are the LWE parameters.
Multiplicative homomorphism is more involved. We show an application of additive homomorphic encryption first.
Definition: Public-key encryption.
is said to be a public-key encryption scheme if the following syntax, correctness, and security holds.
- is a PPT algorithm,
- is a PPT algorithm, for all and all ,
- is a deterministic algorithm, for all and , such that .
Correctness: For all ,
Security: For all NUPPT , there exists a negligible function such that for all , , distinguishes between the following distributions with probability at most :
With this definitions, there are some immediate impossibility results:
- Perfect secrecy is impossible: given , the adversary can try to encrypt all messages with all randomness.
- Deterministic encryption is also impossible: the adversary can try to encrypt the same message and get the same ciphertext.
Also, IND-CPA security is implied directly. Yet another difference compared to secret-key encryptions is that, the security for long messages is implied directly.
Lemma:
If is secure public-key encryption, then for any polynomial length , for all , the two distributions are indistinguishable:
where denotes the -th bit of .
Similarly, the adversary may adaptively choose depending on the earlier ciphertexts . That is called multi-message security and is also implied by single-message security.
Ref: [KL, 12.2]
Public-key Encryption from Additive Homomorphic Encryption
Theorem:
Let be a secret-key homomorphic encryption scheme for the class of functions , where is a polynomial of the security parameter (given to to be chosen later), and is the inner product of -bit vetors. Then, the following is a public-key encryption scheme.
: let , sample -bit string such that , compute . Output and public key
: sample -bit string uniformly at random subject to . Output
: it simply output .
The correctness follows because implies the existence of and then by the correctness of . The efficiency is also direct (just need to sample and with care). The security is sketched below.
Firstly, consider the hybrid scheme that in , we encrypt instead of . By CPA security of , the hybrid is indistinguishable from the real .
Secondly in the hybrid, the ciphertext is an encryption of 0 of the scheme. It could be attemping to think we were finished, but unfortunately as written, depends on and then still depends on (indeed, different encryptions of 0 might reveal something). The key is to observe that is short. Let be the output size of , and let . Informally, -bit is too short to provide sufficient information about -bit , and then it is information-theoretically hiding .
To be formal, we use Leftover Hash Lemma as follows. Let . Then, the adversary is given and aims to find , where is independent of . Rewrite the computation as
Notice that is uniform, is subject to , and is -bits. Observe that, subject to any fixed (of 1 bit) and any fixed (of bits), the min-entropy of is at least . Because is a universal hash family, by leftover hash lemma, is statistically close to a uniform bit by statistical difference .
Ref: Rothblum, TCC 2011, Homomorphic Encryption: From Private-Key to Public-Key
Homomorphic Multiplication
Consider the encryption scheme for LWE. The ciphertext has format , and the decrytion is done by , where is the decryption key, and is skipped. We can view the decryption as a function,
and the decryption is to compute . To obtain additive homomorphism, we are exactly performing
so that the decryption works as
For multiplication, we would like to perform similarly,
This would give a correct decrytion when we compute . However, we begin with linear functions , but we end with
a quadratic function (degree 2 of ). Moreover, the ciphertext size goes from to ~. This is far from ideal, and there are many techniques to resolve this. One is known as “relinearization”, and the trick is to provide the encryptions of
- for , where is the -th coordinate of .
- for .
Since the encryptions (of the above values ) are another linear function , the homomorphic multiplication can then
- Compute from and
- In , substitute with , which yields , a linear function of size .
The encryption of are given as public evaluation key in such constructions.
Notice This relinearization is oversimplified. Actually, the term in consists of products, such as . The naive representation of is a large integer of order , but that would incur huge error and incorrect decryption. A careful bitwise decomposition of and will reduce the error factor to .
Ref:
- Brakerski and Vaikuntanathan, Efficient fully homomorphic encryption from (standard) LWE, FOCS 2011,
- Brakerski, Gentry, and Vaikuntanathan, (Leveled) fully homomorphic encryption without bootstrapping, ITCS 2012
- Barak @ Princeton
Fully Homomorphic using Bootstrapping
The above homomorphic addition and multiplication (over ) are amazing because we can continue to perform the operations on the ciphertexts repeatedly even when the ciphertexts comes from the previous homomorphic operation. That correctness / functionality hold as long as the error term is before modulo .
The homomorphic addition incurs a small error: each introduces a factor at most . Starting with and , we have the budget to perform many additions.
However, the homomorphic multiplication incurs a much higher error due to the relinearization. Since the error increases exponentially in the number of operations, the bar is indeed a critical limitation.
To this end, Gentry (STOC 2009) introduced the idea of “bootstrapping.” That is, to view the high-error ciphertext as a constant string, the decryption algorithm plus the string as a circuit, and then the decryption key as the input of the circuit. That is, define
- Circuit : it takes input and then run and ouput .
Then, we can encrypt the decryption key using another key , and call the result as the evaluation key . With that, we can homomorphically perform decryption on high-error :
- .
The above can be later decrypted by as
where the first equality holds if the error incurred by is smaller than . Thus, we need a homomorhic encryption scheme such that
- The circuit depth of is bounded by small number
- The works correctly for circuit depth more than (because we want to perform at least one operation on )
The LWE-based encryption has a simple , which computes firstly a linear operation and secondly a modulo division, which takes circuit depth . This is why we want to minimize the error of homomorphic multiplication.
With that, we can generate a chain of keys such that each key encrypts the previous one, so that we can perform many operations. This is known as “leveled homomorphic encryption.”
Alternatively, let , and thus , which is known as “bootstrapping.” Because is given to the evaluator (to perform ), is essentially public and known to any adversaries. That introduces a significant concern in security: we do not know how to prove or disprove that the encryption is still secure given such , and this is called “circular security” and used as an additional assumption. Circular security gives a fully homomorphic encryption (and it is still the only known way).
Application: Private Information Retrieval
Definition: Private information retrieval (PIR)
A protocol is a PIR if it satisfies the following syntax, correctness, and privacy. Let be the size of a database such that .
Correctness: for all , all ,
Privacy: for all , all , for all NUPPT , the following are indistinguishable:
Moreover, we define the computation time and the communication to be the time and output size of .
There are many settings of PIR, for example, the database and thus the query may be answered by multiple servers. We consider the simpler single server setting here. There is trivial solutions, but we want the protocol to be efficient. Using a somewhat homomorphic encryption, we can construct an efficient PIR with short communication and client time.