HEAAN
   HOME

TheInfoList



OR:

HEAAN (Homomorphic Encryption for Arithmetic of Approximate Numbers) is an open source homomorphic encryption (HE) library which implements an approximate HE scheme proposed by Cheon, Kim, Kim and Song (CKKS). The first version of HEAAN was published on GitHub on 15 May 2016, and later a new version of HEAAN with a bootstrapping algorithm Jung Hee Cheon, Kyoohyung Han, Andrey Kim, Miran Kim and Yongsoo Song
Bootstrapping for Approximate Homomorphic Encryption
In ''EUROCRYPT 2018(springer)''.
was released. Currently, the latest version is Version 2.1.


CKKS plaintext space

Unlike other HE schemes, the CKKS scheme supports approximate arithmetics over complex numbers (hence, real numbers). More precisely, the plaintext space of the CKKS scheme is \mathbb^ for some power-of-two integer n . To deal with the complex plaintext vector efficiently, Cheon et al. proposed plaintext encoding/decoding methods which exploits a ring isomorphism \phi: \mathbb (X^n+1) \rightarrow \mathbb^ .


Encoding method

Given a plaintext vector \vec z = (z_1,z_2,...,z_) \in \mathbb^ and a scaling factor \Delta > 1 , the plaintext vector is encoded as a polynomial m(X) \in R:= \mathbb (X^n+1) by computing m(X) = \lfloor \Delta \cdot \phi^(\vec z) \rceil \in R where \lfloor \cdot \rceil denotes the coefficient-wise rounding function.


Decoding method

Given a message polynomial m(X) \in R and a scaling factor \Delta > 1 , the message polynomial is decoded to a complex vector \vec z \in \mathbb^ by computing \vec z = \Delta^\cdot \phi(m(X)) \in \mathbb^. Here the scaling factor \Delta > 1 enables us to control the encoding/decoding error which is occurred by the rounding process. Namely, one can obtain the approximate equation \text(\text(\vec z; \Delta); \Delta) \approx \vec z by controlling \Delta where \text and \text denote the encoding and decoding algorithm, respectively. From the ring-isomorphic property of the mapping \phi: \mathbb (X^n+1) \rightarrow \mathbb^ , for m_1 = \text(\vec z_1;\Delta) and m_2 = \text(\vec z_2;\Delta) , the following hold: * \text(m_1 + m_2;\Delta) \approx \vec z_1 + \vec z_2 , * \text(m_1\cdot m_2;\Delta) \approx \vec z_1 \circ \vec z_2 , where \circ denotes the Hadamard product of the same-length vectors. These properties guarantee the approximate correctness of the computations in the encoded state when the scaling factor \Delta is chosen appropriately.


Algorithms

The CKKS scheme basically consists of those algorithms: key Generation, encryption, decryption, homomorphic addition and multiplication, and rescaling. For a positive integer q, let R_q := R/qR be the quotient ring of R modulo q. Let \chi_s, \chi_r and \chi_e be distributions over R which output polynomials with small coefficients. These distributions, the initial modulus Q , and the ring dimension n are predetermined before the key generation phase.


Key generation

The key generation algorithm is following: * Sample a secret polynomial s \leftarrow \chi_s . * Sample a (resp. a' ) uniform randomly from R_Q (resp. R_ ), and e,e' \leftarrow \chi_e . * Output a secret key sk \leftarrow (1, s)\in R_Q^2 , a public key pk \leftarrow (b = -a \cdot s + e, a) \in R_Q^2 , and an evaluation key evk \leftarrow (b' = -a' \cdot s + e' + P\cdot s^2, a') \in R_^2.


Encryption

The encryption algorithm is following: * Sample an ephemeral secret polynomial r \leftarrow \chi_r . * For a given message polynomial m \in R , output a ciphertext ct \leftarrow (c_0 = r\cdot b + e_0 + m, c_1 = r\cdot a + e_1) \in R_Q^2 .


Decryption

The decryption algorithm is following: * For a given ciphertext ct \in R_q^2 , output a message m' \leftarrow \langle ct, sk \rangle (\text q) . The decryption outputs an approximate value of the original message, i.e., \text(sk, \text(pk, m)) \approx m, and the approximation error is determined by the choice of distributions \chi_s, \chi_e, \chi_r . When considering homomorphic operations, the evaluation errors are also included in the approximation error. Basic homomorphic operations, addition and multiplication, are done as follows.


Homomorphic addition

The homomorphic addition algorithm is following: * Given two ciphertexts ct and ct' in R_q^2, output ct_ \leftarrow ct + ct' \in R_q^2. The correctness holds as \text(sk, ct_\text) \approx \text(sk, ct) + \text(sk, ct') .


Homomorphic multiplication

The homomorphic multiplication algorithm is following: * Given two ciphertext ct =(c_0, c_1) and ct' =(c_0', c_1') in R_q^2, compute (d_0, d_1, d_2) = (c_0c_0', c_0c_1'+c_1c_0', c_1c_1') (\text q). Output ct_ \leftarrow (d_0, d_1) + \lfloor P^\cdot d_2 \cdot evk \rceil \in R_q^2. The correctness holds as \text(sk, ct_\text) \approx \text(sk, ct) \cdot \text(sk, ct') . Note that the approximation error (on the message) exponentially grows up on the number of homomorphic multiplications. To overcome this problem, most of HE schemes usually use a modulus-switching technique which was introduced by Brakerski, Gentry and Vaikuntanathan.Z. Brakerski, C. Gentry, and V. Vaikuntanathan
Fully Homomorphic Encryption without Bootstrapping
In ''ITCS 2012''
In case of HEAAN, the modulus-switching procedure is called rescaling. The Rescaling algorithm is very simple compared to Brakerski-Gentry-Vaikuntanathan's original algorithm. Applying the rescaling algorithm after a homomomorphic multiplication, the approximation error grows linearly, not exponentially.


Rescaling

The rescaling algorithm is following: * Given a ciphertext ct \in R_q^2 and a new modulus q' < q, output a rescaled ciphertext ct_\leftarrow \lfloor (q'/q)\cdot ct\rceil \in R_^2. The total procedure of the CKKS scheme is as following: Each plaintext vector \vec z which consists of complex (or real) numbers is firstly encoded as a polynomial m(X) \in R by the encoding method, and then encrypted as a ciphertext ct \in R_q^2 . After several homomorphic operations, the resulting ciphertext is decrypted as a polynomial m'(X) \in R and then decoded as a plaintext vector \vec z' which is the final output.


Security

The
IND-CPA Ciphertext indistinguishability is a property of many encryption schemes. Intuitively, if a cryptosystem possesses the property of indistinguishability, then an adversary will be unable to distinguish pairs of ciphertexts based on the message th ...
security of the CKKS scheme is based on the hardness assumption of the
ring learning with errors In post-quantum cryptography, ring learning with errors (RLWE) is a computational problem which serves as the foundation of new cryptographic algorithms, such as NewHope, designed to protect against cryptanalysis by quantum computers and also to ...
(RLWE) problem, the ring variant of very promising lattice-based hard problem
Learning with errors Learning with errors (LWE) is the computational problem of inferring a linear n-ary function f over a finite ring from given samples y_i = f(\mathbf_i) some of which may be erroneous. The LWE problem is conjectured to be hard to solve, and thus to ...
(LWE). Currently the best known attacks for RLWE over a power-of-two cyclotomic ring are general LWE attacks such as dual attack and primal attack. The bit security of the CKKS scheme based on known attacks was estimated by Albrecht's LWE estimator. Martin Albrecht. Security Estimates for the Learning with Errors Problem, https://bitbucket.org/malb/lwe-estimator


Library

Version 1.0, 1.1 and 2.1 have been released so far. Version 1.0 is the first implementation of the CKKS scheme without bootstrapping. In the second version, the bootstrapping algorithm was attached so that users are able to address large-scale homomorphic computations. In Version 2.1, currently the latest version, the multiplication of ring elements in R_q was accelerated by utilizing
fast Fourier transform A fast Fourier transform (FFT) is an algorithm that computes the discrete Fourier transform (DFT) of a sequence, or its inverse (IDFT). Fourier analysis converts a signal from its original domain (often time or space) to a representation in th ...
(FFT)-optimized number theoretic transform (NTT) implementation.


References

{{reflist Cryptographic primitives Public-key cryptography Lattice-based cryptography Homomorphic encryption