didiercrunch / paillier

Paillier cryptosystem implemented in Go
MIT License
20 stars 16 forks source link

Pass a public key bit length when creating a threshold key generator #11

Closed pdyraga closed 6 years ago

pdyraga commented 6 years ago

So far, GetThresholdKeyGenerator accepted bit length of safe primes p and q which multiplied together create a public key n = pq. For l-bit prime p and q, public key n was a 2l-bit number.

This ia a bit clumsy. I'd rather expect to specify a bit length of the public key, especially that n (public key) defines a plaintext space. Also, I think p and q safe primes are rather implementation details.

In this PR, GenThresholdKeyGenerator accepts bit length of a public key. Two validation rules have been added:

I removed the comment about required threshold as I am not sure it's correct (active adversary attack against SSS). We'll investigate it separately and add the required validation.

I have also renamed AreSafePrimes to IsSafePrime - according to the safe prime definition, only the first function argument can be considered a safe prime.

Here is our internal PR with review for a reference.

didiercrunch commented 6 years ago

There is absolutely no reason why I would not merge this PR right away.

Next time you are in montreal I'll pay the beers.

cheers,

didier

pdyraga commented 6 years ago

😆 🍻