rust-paillier icon indicating copy to clipboard operation
rust-paillier copied to clipboard

document need for explicit rerandomisation

Open mortendahl opened this issue 8 years ago • 3 comments

addition and multiplication does not implicitly rerandomise ciphertexts for performance reasons

this behaviour should be very clear from the documentation as it's a potential security concern

mortendahl avatar Jan 18 '17 10:01 mortendahl

Would you mind expanding on this? From my limited playing around with the library, it appears the cyphertext changes differently on each operation. I.e. if I encrypt two values from the same key, perform the same operation on each and print out the cyphertext, they appear different.

Am I misunderstanding?

polyfractal avatar Feb 10 '17 14:02 polyfractal

Paillier is what's called a probabilistic encryption scheme, meaning every ciphertext is a mix of both the plaintext and a randomness. Hence, two encryptions of the same plaintext will most likely give two different ciphertexts as the randomness will most likely be different. This is good since it provides a stronger level of security, known as semantic security.

This GitHub issue is related to the fact that the library does not currently refresh the randomness automatically after performing homomorphic operations on ciphertexts, but requires an explicit call to rerandomise to do so -- this is for performance reasons since rerandomisation is expensive and it's enough to do so once even if several homomorphic operations are performed. The reason for doing this in the first place is to make sure that a ciphertext produced through homomorphic operations cannot be distinguished from a fresh ciphertext, e.g. Randomise(Encrypt(2) + Encrypt(2)) ~ Encrypt(4), where ~ means indistinguishable.

mortendahl avatar Feb 13 '17 13:02 mortendahl

Thanks for the explanation! Between this and some extra reading I think I'm clearer on how it all works :)

polyfractal avatar Feb 15 '17 15:02 polyfractal