|
@@ -86,6 +86,40 @@ Scalar BGNPrivateKey::decrypt(const Quadripoint& ciphertext)
|
|
|
return pair_max_checked;
|
|
|
}
|
|
|
|
|
|
+std::ostream& operator<<(std::ostream& os, const BGNPrivateKey& output)
|
|
|
+{
|
|
|
+ os << output.a1 << output.b1 << output.c1 << output.d1;
|
|
|
+ os << output.a2 << output.b2 << output.c2 << output.d2;
|
|
|
+ os << output.pi_1_curvegen;
|
|
|
+ os << output.pi_2_twistgen;
|
|
|
+ os << output.pi_T_pairgen;
|
|
|
+
|
|
|
+ return os;
|
|
|
+}
|
|
|
+
|
|
|
+std::istream& operator>>(std::istream& is, BGNPrivateKey& input)
|
|
|
+{
|
|
|
+ is >> input.a1 >> input.b1 >> input.c1 >> input.d1;
|
|
|
+ is >> input.a2 >> input.b2 >> input.c2 >> input.d2;
|
|
|
+ is >> input.pi_1_curvegen;
|
|
|
+ is >> input.pi_2_twistgen;
|
|
|
+ is >> input.pi_T_pairgen;
|
|
|
+
|
|
|
+ input.curve_max_checked = Scalar(0);
|
|
|
+ input.twist_max_checked = Scalar(0);
|
|
|
+ input.pair_max_checked = Scalar(0);
|
|
|
+
|
|
|
+ input.curve_memoizer.clear();
|
|
|
+ input.twist_memoizer.clear();
|
|
|
+ input.pair_memoizer.clear();
|
|
|
+
|
|
|
+ input.curve_memoizer[input.pi_1_curvegen * input.curve_max_checked] = input.curve_max_checked;
|
|
|
+ input.twist_memoizer[input.pi_2_twistgen * input.twist_max_checked] = input.twist_max_checked;
|
|
|
+ input.pair_memoizer[input.pi_T_pairgen * input.pair_max_checked] = input.pair_max_checked;
|
|
|
+
|
|
|
+ return is;
|
|
|
+}
|
|
|
+
|
|
|
BGNPrivateKey::BGNPrivateKey()
|
|
|
{ }
|
|
|
|