I'm trying to implement two party computation for ECDSA signing using Paillier cryptosystem.
But my problem is that the order of Paillier is different from the order of the curve (secp256k1 in my case) so when I multiply two scalars in Paillier and then I decrypt them they are in a different order than the rest of the parameters.
Concrete example:
Paillier order - N
ECDSA order - Q
Alice got her secretKey - aliceSK
Bob got his SecretKey - bobSK
Alice generate Paillier key pair - (paAliceSK, paAlicePK)
expectedRes = (aliceSK X bobSK) mod Q
encAliceSK = Paillier.Encrypt(paAlicePK, aliceSK)
encBobSK = Paillier.Encrypt(paAlicePK, bobSK)
encRes = Paillier.Mul(paAlicePK, encAliceSK, encBobSK)
res = Paillier.Decrypt(paAlicePK, encRes)
res = res mod Q
I get at the end that res != expectedRes
.
But when I calcluate the expectedRes with mod N I'll get res == expectedRes
.
So my question is how should I use Paillier and return the decrypted Paillier result back to the curve order.