|
@@ -18,7 +18,7 @@ void BGNPublicKey::encrypt(CurveBipoint& G_element, const Scalar& cleartext) con
|
|
|
G_element = cleartext_as_element + random_mask;
|
|
|
}
|
|
|
|
|
|
-CurveBipoint BGNPublicKey::encrypt(Scalar& lambda, const Scalar& cleartext) const
|
|
|
+CurveBipoint BGNPublicKey::curveEncrypt(Scalar& lambda, const Scalar& cleartext) const
|
|
|
{
|
|
|
lambda.set_random();
|
|
|
|
|
@@ -29,6 +29,17 @@ CurveBipoint BGNPublicKey::encrypt(Scalar& lambda, const Scalar& cleartext) cons
|
|
|
return cleartext_as_element + random_mask;
|
|
|
}
|
|
|
|
|
|
+TwistBipoint BGNPublicKey::twistEncrypt(Scalar& lambda, const Scalar& cleartext) const
|
|
|
+{
|
|
|
+ lambda.set_random();
|
|
|
+
|
|
|
+ TwistBipoint cleartext_as_element, random_mask;
|
|
|
+ cleartext_as_element = get_bipoint_twistgen() * cleartext;
|
|
|
+ random_mask = get_bipoint_twist_subgroup_gen() * lambda;
|
|
|
+
|
|
|
+ return cleartext_as_element + random_mask;
|
|
|
+}
|
|
|
+
|
|
|
void BGNPublicKey::encrypt(TwistBipoint& H_element, const Scalar& cleartext) const
|
|
|
{
|
|
|
Scalar lambda;
|