Easy Fhe
Easy Fhe
Craig Gentry
IBM T.J. Watson Research Center
19 Skyline Dr.
Hawthorne, NY
[email protected]
c ← EvaluateE (pk2 , DAdd , sk1 , c1 , c2 ) 5.1 Alice Gets Her Hands Dirty
After her dream, Alice rushes to her store to see if her
is an encryption under pk2 of m1 ⊕ m2 .
idea works. She locks box #1 and puts it inside box #2.
By recursing this process, we get a fully homomorphic en-
Working with the gloves of box #2, she tries to unlock box
cryption scheme. The public key in E † consists of a sequence
#1 in less than one minute. The thickness of the gloves and
of public keys (pk1 , . . . , pk`+1 ) and a chain of encrypted se-
the stickiness of the lock combine to make it impossible.
cret keys sk1 , . . . , sk` , where ski is encrypted under pki+1 . She is despondent until she remembers that she has a
To evaluate a function f in E † , we express f as a circuit, special grease that makes her locks less sticky. This time,
topologically arrange its gates into levels, and step through she locks box #3 and puts it inside box #4. She also puts
the levels sequentially. For a gate at level i + 1 (e.g., an Add her bottle of grease inside box #4. Working with the gloves
gate), we take as input the encrypted secret key ski and a of box #4, she squirts some grease on the lock and then tries
couple of ciphertexts associated to output wires at level i to unlock it. But the gloves stiffen before she can finish.
that are under pki , and we homomorphically evaluate DAdd Then, she thinks: why didn’t I grease the box’s lock before
to get a ciphertext under pki+1 associated to a wire at level putting it inside the other box? That way, I wouldn’t waste
i + 1. Finally, we output the ciphertext associated to the my valuable time with the gloves greasing the lock.
output wire of f . She locks box #5, greases its lock, and then puts it inside
Putting the encrypted secret key bits sk1 , . . . , sk` in E † ’s box #6. Working with gloves, she tries the lock again. This
public key is not a problem for security. These encrypted time it works, despite the clumsiness of the gloves!
secret key bits are indistinguishable from encryptions of 0 At last, she has a system that lets her securely delegate
as long as E is semantically secure. the processing of her precious materials into arbitrarily com-
plicated pieces! Her workers just need to apply the grease
4.4 Circular Security to each box before they put it inside the next box. She can
hardly wait to put the system in place the following morning. • EncryptE ∗ (pk∗ , m): Run EncryptE (pk, m) to obtain cipher-
text c. For i ∈ {1, . . . , β}, set zi ← c · yi mod 2 keeping
5.2 Greasing the Decryption Circuit only about log α bits of precision after the binary point for
In our somewhat homomorphic encryption scheme E from each zi . The ciphertext c∗ consists of c and ~z = hz1 , . . . , zβ i.
Section 3, the decryption function is: The important point here is that the hint ~
y is used to post-
m ← (c mod p) mod 2 process a ciphertext c output by EncryptE , with the objective
of leaving less work remaining for DecryptE ∗ to do.
Equivalently, but more simply, the equation is: This sort of two-phase approach to decryption has been
m ← LSB(c) XOR LSB(bc/pe) , used before in server-aided cryptography. (See cites in [2].)
In that setting, a user wants to minimize its cryptographic
where LSB takes the least significant bit and b·e rounds to computation – e.g., because it is using a constrained device,
the nearest integer. This is equivalent, since (c mod p) = such as a smartcard or handheld. So, it outsources expensive
c − p · bc/pe. Since p is odd, we have that (c mod p) mod 2 = computations to a server. To set up this arrangement, the
c−bc/pe mod 2. This is just the XOR of the least significant user (in some schemes) must give the server a hint ~ y that
bits of c and bc/pe. is statistically dependent on its secret key sk, but which is
In the decryption circuit DE , computing the LSB is imme- not sufficient to permit the server to decrypt efficiently on
diate: the circuit simply does not have output wires for the its own. The server uses the hint to process a ciphertext
more significant bits. Computing an XOR also takes only directed to the user, leaving less work for the user to do.
one gate. If the decryption function is complicated, it must In our setting, the encrypter or evaluator plays the role of
be because computing bc/pe is complicated. Is the function the server, post-processing the ciphertext so as to leave less
f (p, c) = bc/pe (with the few steps afterwards) something work for the decryption algorithm to do.
that E can handle? If so, E is bootstrappable, and can be
• DecryptE ∗ (sk∗ , c∗ ): Output LSB(c) XOR LSB(b i si zi e).
P
used to construct a fully homomorphic encryption scheme.
Unfortunately, even a single multiplication of long num- PDecryption P works, since (up to small precision errors)
bers – namely, c with 1/p – seems to be too complex for E i si z i = i c · si yi = c/p mod 2.
to handle. The reason is that c and 1/p each need to be To ensure that the rounding is correct despite the low pre-
expressed with at least P ≈ log p bits of precision to en- cision, we need c to be closer (than the trivial p/2) to a multi-
sure that f (p, c) is computed correctly. When you multiply ple of p (say, within p/16). This makes FE ∗ smaller than FE ,
two P -bit numbers, a bit of the result may be a high-degree since FE ∗ is limited to functions where |f (a1 , . . . , at )| < p/16
polynomial of the input bits; this degree is also roughly P . when the ai are N bits. This makes only a small difference.
We saw that E can handle an elementary symmetric poly- The important point regarding DecryptE ∗ is that we re-
nomial in t variables of degree (roughly) d < P/(N · log t). place the multiplication of c and 1/p with a summation that
However, E cannot handle even a single monomial of degree contains only α nonzero terms. The bits of this summation
P , where the noise of output ciphertext is upper-bounded can be computed by a polynomial of degree α · polylog(α),
by (2N )P ≈ pN p/2. Consequently, E does not seem to which E ∗ can handle if we set α to be small enough.
be bootstrappable. • AddE ∗ (pk∗ , c∗1 , c∗2 ) : Extract c1 and c2 from c∗1 and c∗2 .
However, if we are willing to get our hands dirty by tin- Run c ← AddE (pk, c1 , c2 ). The output ciphertext c∗ consists
kering with E to make the decryption function simpler, we of c, together with the result of post-processing c with ~ y.
eventually get a scheme E ∗ that is bootstrappable. The main MultE ∗ (pk∗ , c∗1 , c∗2 ) is analogous.
idea of the transformation is to replace E’s decryption func-
tion, which multiplies two long numbers, with a decryption 5.3 How to Add Numbers
function that adds a fairly small set of numbers. In terms To see that E ∗ can handle the decryption function plus
of the bits of the addends, this summation corresponds to a an additional gate when α is set small
polynomial of fairly low degree that E ∗ can handle. P enough, let us con-
sider the computation of the sum i si zi . In this sum,
Let us go through the transformation step by step, begin- we have β numbers a1 , . . . , aβ , each ai expressed in binary
ning with KeyGenE ∗ . The transformation uses a couple of (ai,0 , . . . , ai,−` ) with ` = O(log α), where at most α of the
integer parameters: 0 < α < β. ai ’s are nonzero (since the Hamming weight of s is α). We
• KeyGenE ∗ (λ): Run KeyGenE (λ) to obtain keys (pk, sk), want to express each bit of the output as a polynomial of
where sk is an odd integer p. Generate a set ~ y = hy1 , . . . , yβ i the input bits, while minimizing the degree of the polyno-
of rational numbers in [0, 2) such that there is a sparse subset mial and the number of monomials.
S ⊂ {1, . . . , β} of size α with i∈S yi ≈ 1/p mod 2. Set sk∗
P
Our approach to the problem is to add up the column of
to be the sparse subset S, encoded as a vector s ∈ {0, 1}β LSBs of the numbers – computing the Hamming weight of
with Hamming weight α. Set pk∗ ← (pk, ~ y ). this column – to obtain a number in binary representation.
The important difference between KeyGenE ∗ and KeyGenE Then, we add up the column of penultimate bits, etc. Af-
is that KeyGenE ∗ includes a hint about the secret integer p – terwards, we combine the partial results. More precisely,
namely, a set of numbers ~ y that contains a (hidden) sparse for j ∈ [0, −`], we compute the Hamming weight bj , repre-
subset that sums to 1/p (to within a very small error, and up sented in binary, of (a1,j , . . . , aβ,j ). Then, we add up the
to addition by an even number). This hint is the “grease,” ` + 1 numbers b0 , ..., 2−` b−` to obtain the final correct sum.
which will be used in EncryptE ∗ and DecryptE ∗ . Although it Conveniently, the binary representation of the Hamming
is technically not the decryption key sk∗ , the integer p still weight of any vector ~ x ∈ {0, 1}t is given by
can be used to decrypt a ciphertext output by EncryptE ∗ , (e2blog tc (x1 , . . . , xt ) mod 2, . . . , e20 (x1 , . . . , xt ) mod 2)
so revealing this hint obviously impacts security, a point we
elaborate on in Section 5.4. where ei (x1 , . . . , xt ) is the ith elementary symmetric polyno-
mial over x1 , . . . , xt . These polynomials have degree at most decryption function. The lattice-based scheme with com-
t. Also, we know how to efficiently evaluate the elementary parable security has λ6 · polylog(λ) computation. This is
symmetric polynomials. They are simply coefficients of the high, but not totally unreasonable. Consider: to make RSA
polynomial p(z) = ti=1 (z−xi ). An important point is that, 2λ -secure against known attacks – in particular, against the
Q
in our case, we only need to evaluate the polynomials up to number field sieve factoring algorithm – you need to use
degree α, since we know a priori that each of the Hamming an RSA modulus with approximately λ3 bits. Then, RSA
weights is at most α. We saw in Section 3.3 that we can decryption involves exponentiation by a λ3 -bit exponent –
handle elementary symmetric polynomials in t variables of i.e., about λ3 multiplications. Even if one uses fast Fourier
degree up to about λ/ log t = Ω(λ/ log λ) for our suggested multiplication, this exponentiation requires λ6 · polylog(λ)
parameters. We can set α to be smaller than this. computation. Also, unlike RSA, the decryption function
The final step of computing the sum of the bj ’s does not in our scheme is highly parallelizable, which may make an
require much computation, since there are only ` + 1 = enormous difference in some implementations.
O(log α) of them. We get that a ciphertext encrypting a
bit of the overall sum has noise of at most N · α · g(log α) 7. EPILOGUE
bits for some polynomial g of low degree. If the final sum The morning after her dream, Alice explains her glovebox
modulo 2 is (b00 , b0−1 , . . .) in binary, then the rounding oper- solution to her workers. They are not happy, but they wish
ation modulo 2 is simply b00 XOR b0−1 . With the additional to remain employed. As the day progresses, it becomes clear
XOR operation in decryption, and possibly one more gate, that the gloveboxes are slowing down the pace of jewelry
the noise after evaluating the decryption function plus a gate construction considerably. The main problem seems to be
has at most N · α · h(log α) bits for some polynomial h. the thick gloves, which multiply the time needed for each
The scheme E ∗ becomes bootstrappable when this noise assembly step. After a few days of low output, Alice curtails
has at most log(p/16) = P − 4 bits. For example, this works her use of the gloveboxes to pieces that contain the most
when α = λ/polylog(λ), N = λ, and P = λ2 . valuable diamonds.
5.4 Security of the Transformed Scheme Alice loses her suit against Acme Glovebox Company, be-
cause, as far as anyone knows in Alice’s parallel world, gloves
The encryption key of E ∗ contains a hint about the secret in gloveboxes are always very stiff and stiffen completely af-
p. But we can prove that E ∗ is semantically secure, unless ter moderate use. The old judge explains this to her in a
either it is easy to break the semantic security of E (which patronizing tone.
implies that the approximate gcd problem is easy), or the But Alice refuses to give up. She hires a handsome young
following sparse (or low-weight) subset sum problem (SSSP) glovebox researcher, and tasks him with developing a glove
is easy: given a set of β numbers ~ y and another number s, flexible enough to permit the nimble assembly of jewels and
find the sparse (α-element) subset of ~ y whose sum is s. unlocking of boxes, but sturdy enough to prevent the boxes
The SSSP has been studied before in connection with from being easily compromised. The researcher, amazed at
server-aided cryptosystems. If α and β are set appropri- his good fortune, plunges into the problem.
ately, the SSSP is a hard problem, as far as we know. In
particular, if we set α to be about λ, it is hardto find the
sparse subset by “brute force,” since there are αβ
≈ β α pos-
8. REFERENCES
[1] D. Boneh and R. J. Lipton. Algorithms for black-box
sibilities. If the sparse subset sum is much closer to 1/p
fields and their application to cryptography (extended
than any other subset sum, the problem yields to a lattice
abstract). In CRYPTO, pages 283–297, 1996.
attack. But these attacks fail when we set β large enough
[2] C. Gentry. A fully homomorphic encryption scheme.
(but still polynomial in λ) so that an exponential (in λ) num-
PhD thesis, Stanford University, 2009.
ber of subset sums are as close to 1/p as the sparse subset.
crypto.stanford.edu/craig.
Concretely, we can set β = λ5 · polylog(λ).
[3] C. Gentry. Fully homomorphic encryption using ideal
lattices. In M. Mitzenmacher, editor, STOC, pages
6. CONCLUSIONS 169–178. ACM, 2009.
We now know that FHE is possible. We already have the [4] S. Goldwasser and S. Micali. Probabilistic encryption.
scheme presented here, the lattice-based scheme by Gentry J. Comput. Syst. Sci., 28(2):270–299, 1984.
[2, 3], and a recent scheme by Smart and Vercauteren [7].
[5] R. L. Rivest, L. M. Adleman, and M. L. Dertouzos. On
There is still work to be done toward making FHE truly
data banks and privacy homomorphisms. In
practical. Currently, all known FHE schemes follow the
Foundations of Sec. Comp., pages 169–180, 1978.
blueprint above: construct a bootstrappable somewhat ho-
[6] R. L. Rivest, A. Shamir, and L. M. Adleman. A
momorphic encryption scheme E, and obtain FHE by run-
method for obtaining digital signatures and public-key
ning EvaluateE on E’s decryption function. But this ap-
cryptosystems. Commun. ACM, 21(2):120–126, 1978.
proach is computationally expensive. Not only is the decryp-
tion function expressed (somewhat inefficiently) as a circuit, [7] N. P. Smart and F. Vercauteren. Fully homomorphic
but then EvaluateE replaces each bit in this circuit with a encryption with relatively small key and ciphertext
large ciphertext that encrypts that bit. Perhaps someone sizes, 2009. http://eprint.iacr.org/2009/571.
will find a more efficient blueprint. [8] W. van Dam, S. Hallgren, and L. Ip. Quantum
The scheme presented here, while conceptually simpler, algorithms for some hidden shift problems. SIAM J.
seems to be less efficient than the lattice-based scheme. To Comput., 36(3):763–778, 2006.
get 2λ security against known attacks – e.g., on the the ap- [9] M. van Dijk, C. Gentry, S. Halevi, and
proximate gcd problem – ciphertexts are λ5 · polylog(λ) bits, V. Vaikuntanathan. Fully homomorphic encryption over
which leads to λ10 · polylog(λ) computation to evaluate the the integers, 2009. http://eprint.iacr.org/2009/616.