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:
bit length must be an even number
For an odd l-bit number, we can't find two l/2-bit numbers with two the most significant bits set on which multiplied gives an l-bit number,
bit length must be minimum 18
we need to find two l/2-bit safe primes, p and q which are not equal. This is not possible for l<18.
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.
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:
- bit length must be an even number
For an odd `l`-bit number, we can't find two `l/2`-bit numbers with two the most significant bits set on which multiplied gives an `l`-bit number,
- bit length must be minimum `18`
we need to find two `l/2`-bit safe primes, `p` and `q` which are not equal. This is not possible for `l<18`.
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](https://github.com/keep-network/paillier/pull/10) with review for a reference.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
So far,
GetThresholdKeyGeneratoraccepted bit length of safe primespandqwhich multiplied together create a public keyn = pq. Forl-bit primepandq, public keynwas a2l-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 thinkpandqsafe primes are rather implementation details.In this PR,
GenThresholdKeyGeneratoraccepts bit length of a public key. Two validation rules have been added:For an odd
l-bit number, we can't find twol/2-bit numbers with two the most significant bits set on which multiplied gives anl-bit number,18we need to find two
l/2-bit safe primes,pandqwhich are not equal. This is not possible forl<18.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
AreSafePrimestoIsSafePrime- 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.
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
😆 🍻