rust-paillier
rust-paillier copied to clipboard
BigInt type problem (curv and rust-paillier)
Hi, I encountered a type conversion issue among type BigInt
:
- Using
Paillier::encrypt
in rust-paillier, we need to first convert theBigInt
variable toRawPlaintext
. 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<'_>`
- 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!
Hi ,
- try to use x1.clone() instead of &x1
- I don’t see any error. Where do you get stuck ?
I think I have got the problem... It was caused by different version of curv used in different libraries.