Submitted Successfully!
To reward your contribution, here is a gift for you: A free trial for our video production service.
Thank you for your contribution! You can also upload a video entry or images related to this topic.
Version Summary Created by Modification Content Size Created at Operation
1 handwiki -- 1330 2022-11-23 01:44:50

Do you have a full video?

Confirm

Are you sure to Delete?
Cite
HandWiki. HEAAN. Encyclopedia. Available online: https://encyclopedia.pub/entry/35922 (accessed on 23 April 2024).
HandWiki. HEAAN. Encyclopedia. Available at: https://encyclopedia.pub/entry/35922. Accessed April 23, 2024.
HandWiki. "HEAAN" Encyclopedia, https://encyclopedia.pub/entry/35922 (accessed April 23, 2024).
HandWiki. (2022, November 23). HEAAN. In Encyclopedia. https://encyclopedia.pub/entry/35922
HandWiki. "HEAAN." Encyclopedia. Web. 23 November, 2022.
HEAAN

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 was released. Currently, the latest version is Version 2.1.

homomorphic encryption heaan ckks

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 $\displaystyle{ \mathbb{C}^{n/2} }$ for some power-of-two integer $\displaystyle{ n }$. To deal with the complex plaintext vector efficiently, Cheon et al. proposed plaintext encoding/decoding methods which exploits a ring isomorphism $\displaystyle{ \phi: \mathbb{R}[X]/(X^n+1) \rightarrow \mathbb{C}^{n/2} }$.

1.1. Encoding Method

Given a plaintext vector $\displaystyle{ \vec z = (z_1,z_2,...,z_{n/2}) \in \mathbb{C}^{n/2} }$ and a scaling factor $\displaystyle{ \Delta \gt 1 }$, the plaintext vector is encoded as a polynomial $\displaystyle{ m(X) \in R:= \mathbb{Z}[X]/(X^n+1) }$ by computing $\displaystyle{ m(X) = \lfloor \Delta \cdot \phi^{-1}(\vec z) \rceil \in R }$ where $\displaystyle{ \lfloor \cdot \rceil }$ denotes the coefficient-wise rounding function.

1.2. Decoding Method

Given a message polynomial $\displaystyle{ m(X) \in R }$ and a scaling factor $\displaystyle{ \Delta \gt 1 }$, the message polynomial is decoded to a complex vector $\displaystyle{ \vec z \in \mathbb{C}^{n/2} }$ by computing $\displaystyle{ \vec z = \Delta^{-1}\cdot \phi(m(X)) \in \mathbb{C}^{n/2} }$.

Here the scaling factor $\displaystyle{ \Delta \gt 1 }$ enables us to control the encoding/decoding error which is occurred by the rounding process. Namely, one can obtain the approximate equation $\displaystyle{ \text{Dcd}(\text{Ecd}(\vec z; \Delta); \Delta) \approx \vec z }$ by controlling $\displaystyle{ \Delta }$ where $\displaystyle{ \text{Ecd} }$ and $\displaystyle{ \text{Dcd} }$ denote the encoding and decoding algorithm, respectively.

From the ring-isomorphic property of the mapping $\displaystyle{ \phi: \mathbb{R}[X]/(X^n+1) \rightarrow \mathbb{C}^{n/2} }$, for $\displaystyle{ m_1 = \text{Ecd}(\vec z_1;\Delta) }$ and $\displaystyle{ m_2 = \text{Ecd}(\vec z_2;\Delta) }$, the following hold:

• $\displaystyle{ \text{Dcd}(m_1 + m_2;\Delta) \approx \vec z_1 + \vec z_2 }$,
• $\displaystyle{ \text{Dcd}(m_1\cdot m_2;\Delta) \approx \vec z_1 \circ \vec z_2 }$,

where $\displaystyle{ \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 $\displaystyle{ \Delta }$ is chosen appropriately.

2. Algorithms

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

2.1. Key Generation

The key generation algorithm is following:

• Sample a secret polynomial $\displaystyle{ s \leftarrow \chi_s }$.
• Sample $\displaystyle{ a }$ (resp. $\displaystyle{ a' }$) uniform randomly from $\displaystyle{ R_Q }$ (resp. $\displaystyle{ R_{PQ} }$), and $\displaystyle{ e,e' \leftarrow \chi_e }$.
• Output a secret key $\displaystyle{ sk \leftarrow (1, s)\in R_Q^2 }$, a public key $\displaystyle{ pk \leftarrow (b = -a \cdot s + e, a) \in R_Q^2 }$, and an evaluation key $\displaystyle{ evk \leftarrow (b' = -a' \cdot s + e' + P\cdot s^2, a') \in R_{PQ}^2 }$.

2.2. Encryption

The encryption algorithm is following:

• Sample an ephemeral secret polynomial $\displaystyle{ r \leftarrow \chi_r }$.
• For a given message polynomial $\displaystyle{ m \in R }$, output a ciphertext $\displaystyle{ ct \leftarrow (c_0 = r\cdot b + e_0 + m, c_1 = r\cdot a + e_1) \in R_Q^2 }$.

2.3. Decryption

The decryption algorithm is following:

• For a given ciphertext $\displaystyle{ ct \in R_q^2 }$, output a message $\displaystyle{ m' \leftarrow \langle ct, sk \rangle }$ $\displaystyle{ (\text{mod } q) }$.

The decryption outputs an approximate value of the original message, i.e., $\displaystyle{ \text{Dec}(sk, \text{Enc}(pk, m)) \approx m }$, and the approximation error is determined by the choice of distributions $\displaystyle{ \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.

The homomorphic addition algorithm is following:

• Given two ciphertexts $\displaystyle{ ct }$ and $\displaystyle{ ct' }$ in $\displaystyle{ R_q^2 }$, output $\displaystyle{ ct_{\text{add}} \leftarrow ct + ct' \in R_q^2 }$.

The correctness holds as $\displaystyle{ \text{Dec}(sk, ct_\text{add}) \approx \text{Dec}(sk, ct) + \text{Dec}(sk, ct') }$.

2.5. Homomorphic Multiplication

The homomorphic multiplication algorithm is following:

• Given two ciphertext $\displaystyle{ ct =(c_0, c_1) }$ and $\displaystyle{ ct' =(c_0', c_1') }$ in $\displaystyle{ R_q^2 }$, compute $\displaystyle{ (d_0, d_1, d_2) = (c_0c_0', c_0c_1'+c_1c_0', c_1c_1') }$ $\displaystyle{ (\text{mod } q) }$. Output $\displaystyle{ ct_{\text{mult}} \leftarrow (d_0, d_1) + \lfloor P^{-1}\cdot d_2 \cdot evk \rceil \in R_q^2 }$.

The correctness holds as $\displaystyle{ \text{Dec}(sk, ct_\text{mult}) \approx \text{Dec}(sk, ct) \cdot \text{Dec}(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.[1] 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.

2.6. Rescaling

The rescaling algorithm is following:

• Given a ciphertext $\displaystyle{ ct \in R_q^2 }$ and a new modulus $\displaystyle{ q' \lt q }$, output a rescaled ciphertext $\displaystyle{ ct_{\text{rs}}\leftarrow \lfloor (q'/q)\cdot ct\rceil \in R_{q'}^2 }$.

The total procedure of the CKKS scheme is as following: Each plaintext vector $\displaystyle{ \vec z }$ which consists of complex (or real) numbers is firstly encoded as a polynomial $\displaystyle{ m(X) \in R }$ by the encoding method, and then encrypted as a ciphertext $\displaystyle{ ct \in R_q^2 }$. After several homomorphic operations, the resulting ciphertext is decrypted as a polynomial $\displaystyle{ m'(X) \in R }$ and then decoded as a plaintext vector $\displaystyle{ \vec z' }$ which is the final output.

3. Security

The IND-CPA security of the CKKS scheme is based on the hardness assumption of the ring learning with errors (RLWE) problem, the ring variant of very promising lattice-based hard problem Learning with errors (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.[2]

4. 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 $\displaystyle{ R_q }$ was accelerated by utilizing fast Fourier transform (FFT)-optimized number theoretic transform (NTT) implementation.

References

1. Z. Brakerski, C. Gentry, and V. Vaikuntanathan. Fully Homomorphic Encryption without Bootstrapping. In ITCS 2012 http://eprint.iacr.org/2011/277
2. Martin Albrecht. Security Estimates for the Learning with Errors Problem, https://bitbucket.org/malb/lwe-estimator
More
Information
Subjects:
Contributor MDPI registered users' name will be linked to their SciProfiles pages. To register with us, please refer to https://encyclopedia.pub/register :
View Times: 378
Entry Collection:
Revision: 1 time (View History)
Update Date: 23 Nov 2022
1000/1000