Wrong decryption!!
mahyamaftouni opened this issue · 2 comments
mahyamaftouni commented
Hi
In the encrypt function the do while condition should be
r.compareTo(n) >= 0 || !n.gcd(r).equals(BigInteger.ONE)
instead of just:
r.compareTo(n) >= 0
cause in paillier r is coprime with n!
and check uniqueness of p and q in keybuilder!
any way i used your codes, Thanks 👍
BARJ commented
Hi @mahyamaftouni , could you please enlighten me why r is coprime with n.
Do you have a source?
According to the wikipedia page, r only has to be a random number of the set Z^*_n
kunerd commented
@mahyamaftouni I think @BARJ is right, see page 7 on http://www.cs.tau.ac.il/%7Efiat/crypt07/papers/Pai99pai.pdf
select a random r < n