# Homomorphic encryption

## Description

**Homomorphic encryption** is a form of encryption with an additional evaluation capability for computing over encrypted data without access to the secret key. The result of such a computation remains encrypted. Homomorphic encryption can be viewed as an extension of public-key cryptography. _Homomorphic_ refers to homomorphism in algebra: the encryption and decryption functions can be thought of as homomorphisms between plaintext and ciphertext spaces.

Homomorphic encryption includes multiple types of encryption schemes that can perform different classes of computations over encrypted data. The computations are represented as either Boolean or arithmetic circuits.&#x20;

{% hint style="info" %}
Some common types of homomorphic encryption are _partially_ homomorphic, _somewhat_ homomorphic, _leveled_ _fully_ homomorphic, and _fully_ homomorphic encryption:

* _Partially homomorphic encryption_ encompasses schemes that support the evaluation of circuits consisting of only one type of gate, e.g., addition or multiplication.
* _Somewhat homomorphic encryption_ schemes can evaluate two types of gates, but only for a subset of circuits.
* _Leveled fully homomorphic encryption_ supports the evaluation of arbitrary circuits composed of multiple types of gates of bounded (pre-determined) depth.
* _Fully homomorphic encryption_ (FHE) allows the evaluation of arbitrary circuits composed of multiple types of gates of unbounded depth and is the strongest notion of homomorphic encryption.
{% endhint %}

For the majority of homomorphic encryption schemes, the multiplicative depth of circuits is the main practical limitation in performing computations over encrypted data. Homomorphic encryption schemes are inherently malleable. In terms of malleability, homomorphic encryption schemes have weaker security properties than non-homomorphic schemes.

***

## Approach

Homomorphic encryption schemes have been developed using different approaches. Specifically, fully homomorphic encryption schemes are often grouped into generations corresponding to the underlying approach.

### Paillier

In the Paillier cryptosystem, if the public key is the modulus 𝑛![{\displaystyle n}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b) and the base 𝑔![{\displaystyle g}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d3556280e66fe2c0d0140df20935a6f057381d77), then the encryption of a message 𝑚![{\displaystyle m}](https://wikimedia.org/api/rest_v1/media/math/render/svg/0a07d98bb302f3856cbabc47b2b9016692e3f7bc) is 𝐸(𝑚)=𝑔𝑚𝑟𝑛mod𝑛2![{\displaystyle {\mathcal {E\}}(m)=g^{m}r^{n}\\;{\bmod {\\;\}}n^{2\}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6dee820dade52831a828218bffb2d904012c1636), for some random 𝑟∈{0,…,𝑛−1}![{\displaystyle r\in \\{0,\ldots ,n-1\\\}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/0c70a2248522700bc2bb4e0768cf07b1e440ecd7). The homomorphic property is then

𝐸(𝑚1)⋅𝐸(𝑚2)=(𝑔𝑚1𝑟1𝑛)(𝑔𝑚2𝑟2𝑛)mod𝑛2=𝑔𝑚1+𝑚2(𝑟1𝑟2)𝑛mod𝑛2=𝐸(𝑚1+𝑚2).![{\displaystyle {\begin{aligned}{\mathcal {E\}}(m\_{1})\cdot {\mathcal {E\}}(m\_{2})&=(g^{m\_{1\}}r\_{1}^{n})(g^{m\_{2\}}r\_{2}^{n})\\;{\bmod {\\;\}}n^{2}\\\\\[6pt\]&=g^{m\_{1}+m\_{2\}}(r\_{1}r\_{2})^{n}\\;{\bmod {\\;\}}n^{2}\\\\\[6pt\]&={\mathcal {E\}}(m\_{1}+m\_{2}).\end{aligned\}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/197397f99f3b0e28da319905da0cfb51c8ff62d9)



***

### Microsoft SEAL <a href="#firstheading" id="firstheading"></a>

#### Algorithms

Microsoft SEAL supports both asymmetric and symmetric encryption algorithms.

#### Scheme types

Microsoft SEAL comes with two different homomorphic encryption schemes with very different properties:

* BFV: The BFV scheme allows modular arithmetic to be performed on encrypted integers. For applications where exact values are necessary, the BFV scheme is the only choice.
* CKKS: The CKKS scheme allows additions and multiplications on encrypted real or complex numbers, but yields only approximate results. In applications such as summing up encrypted real numbers, evaluating machine learning models on encrypted data, or computing distances of encrypted locations CKKS is going to be by far the best choice.

**Compression**

Data compression can be achieved by building SEAL with Zlib support. By default, data is compressed using the DEFLATE algorithm which achieves significant memory footprint savings when serializing objects such as encryption parameters, ciphertexts, plaintexts, and all available keys: Public, Secret, Relin (relinearization), and Galois. Compression can always be disabled.



