Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Latest commit

 

History

History
19 lines (13 loc) · 4.01 KB

SECURITY.md

File metadata and controls

19 lines (13 loc) · 4.01 KB

Code Review

Lattigo 2.0.0 has been code-reviewed by ELCA in November 2020 and, within the allocated time for the code review, no critical or high-risk issues were found.

Security of Approximate-Numbers Homomorphic Encryption

Homomorphic encryption schemes are by definition malleable, and are therefore not secure against chosen ciphertext attacks (CCA security). They can be though secure against chosen plaintext attacks (CPA security).

Classified as an approximate decryption scheme, the CKKS scheme is secure as long as the plaintext result of a decryption is only revealed to entities with knowledge of the secret-key. This is because, given a ciphertext (-as + m + e, a), the decryption outputs a plaintext m+e. Li and Micciancio show that using this plaintext, it is possible to recover the secret-key with ((-as + m + e) - (m + e)) * a^-1 = asa^-1 = s (the probability of a being invertible is overwhelming, and if a is not invertible, only require a few more samples are required).

This attack demonstrates that, when using an approximate homomorphic encryption scheme, the usual CPA security may not sufficient depending on the application setting. Many applications do not require to share the result with external parties and are not affected by this attack, but the ones that do must take the appropriate steps to ensure that no key-dependent information is leaked. A homomorphic encryption scheme that provides such functionality and that can be secure when releasing decrypted plaintext to external parties is defined to be CPAD secure. The corresponding indistinguishability notion (IND-CPAD) is defined as "indistinguishability under chosen plaintext attacks with decryption oracles."

CPAD Security for CKKS

Lattigo implements tools to mitigate Li and Micciancio's attack. In particular, the decoding step of CKKS (and its real-number variant R-CKKS) allows the user to add a key-independent error e of standard deviation σ to the decrypted plaintext before decoding.

If at any point of an application, decrypted values have to be shared with external parties, then the user must ensure that each shared plaintext is first sanitized before being shared. To do so, the user must use the DecodePublic method instead of the usual Decode. DecodePublic takes as additional input σ, and samples a key-independent error e with standard deviation σ, that is added to the plaintext before decoding.

Estimating σ must be done carefully and we suggest the following iterative process to do so:

  1. Given a security parameter λ and a circuit C that takes as inputs length-n vectors ω following a distribution χ, select the appropriate parameters enabling the homomorphic evaluation of C(ω), denoted by H(C(ω)), which includes the encoding, encryption, evaluation, decryption and decoding.
  2. Sample input vectors ω from the distribution χ and compute the standard deviation σ in the time domain (coefficient domain) of e = C(ω) - H(C(ω)). This can be done using the encoder method GetErrSTDTimeDom(C(ω), H(C(ω)), Δ), where Δ is the scale of the plaintext after the decryption. The user should make sure that the underlying circuit computed by H(C()) is identical to C(); i.e., if the homomorphic implementation H(C()) uses polynomial approximations, then C() should use them too, instead of using the original exact function. This will ensure that e, and therefore σ, are as close as possible to the actual underlying scheme error, and not influenced by function-approximation errors.
  3. Use the encoder method DecodePublic with the parameter σ to decode plaintexts that will be published. DecodePublic adds an error e with standard deviation σ bounded by B = σ • (2π)0.5. The precision loss, compared to a private decoding, should be less than half a bit on average.