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

BigInt type problem (curv and rust-paillier)

Open marvellous987 opened this issue 3 years ago • 2 comments

Hi, I encountered a type conversion issue among type BigInt:

  1. Using Paillier::encrypt in rust-paillier, we need to first convert the BigInt variable to RawPlaintext. However, there is an error:
error[E0277]: the trait bound `RawPlaintext<'_>: From<&curv::BigInt>` is not satisfied
   --> ...
    |
63  |         RawPlaintext::from(&x1)
    |         ^^^^^^^^^^^^^^^^^^ the trait `From<&curv::BigInt>` is not implemented for `RawPlaintext<'_>`
  1. Using Paillier::decrypt in rust-paillier:
    let gamma1 = Paillier::decrypt(
        &dk,
        RawCiphertext::from(C_gamma.clone())
    ).0
    .clone()
    .into_owned();

and gamma1 is a paillier::Bigint rather than a curv::BigInt.

I think it is the same origin of problem, would anyone can give me any suggestion?

Thank you!

marvellous987 avatar Oct 28 '21 06:10 marvellous987

Hi ,

  1. try to use x1.clone() instead of &x1
  2. I don’t see any error. Where do you get stuck ?

omershlo avatar Oct 28 '21 06:10 omershlo

I think I have got the problem... It was caused by different version of curv used in different libraries.

marvellous987 avatar Oct 28 '21 07:10 marvellous987