|
@@ -1,27 +1,5 @@
|
|
|
#include "PrivateKey.hpp"
|
|
|
|
|
|
-PrivateKey::PrivateKey(const PublicKey& pub_key, const Scalar& a1, const Scalar& b1, const Scalar& c1, const Scalar& d1, const Scalar& a2, const Scalar& b2, const Scalar& c2, const Scalar& d2)
|
|
|
-{
|
|
|
- set(pub_key, a1, b1, c1, d1, a2, b2, c2, d2);
|
|
|
-}
|
|
|
-
|
|
|
-void PrivateKey::set(const PublicKey& pub_key, const Scalar& a1, const Scalar& b1, const Scalar& c1, const Scalar& d1, const Scalar& a2, const Scalar& b2, const Scalar& c2, const Scalar& d2)
|
|
|
-{
|
|
|
- this->a1 = a1;
|
|
|
- this->b1 = b1;
|
|
|
- this->c1 = c1;
|
|
|
- this->d1 = d1;
|
|
|
-
|
|
|
- this->a2 = a2;
|
|
|
- this->b2 = b2;
|
|
|
- this->c2 = c2;
|
|
|
- this->d2 = d2;
|
|
|
-
|
|
|
- this->pi_1_curvegen = pi_1(pub_key.get_bipoint_curvegen());
|
|
|
- this->pi_2_curvegen = pi_2(pub_key.get_bipoint_twistgen());
|
|
|
- this->pi_T_curvegen = pi_T(pairing(pub_key.get_bipoint_curvegen(), pub_key.get_bipoint_twistgen()));
|
|
|
-}
|
|
|
-
|
|
|
Scalar PrivateKey::decrypt(const Bipoint<curvepoint_fp_t>& ciphertext)
|
|
|
{
|
|
|
static std::unordered_map<Bipoint<curvepoint_fp_t>, Scalar> memoizer;
|
|
@@ -92,6 +70,26 @@ void PrivateKey::decrypt(const Quadripoint& ciphertext)
|
|
|
return max_checked - Scalar(1);
|
|
|
}
|
|
|
|
|
|
+PrivateKey::PrivateKey()
|
|
|
+{ }
|
|
|
+
|
|
|
+void PrivateKey::set(const PublicKey& pub_key, const Scalar& a1, const Scalar& b1, const Scalar& c1, const Scalar& d1, const Scalar& a2, const Scalar& b2, const Scalar& c2, const Scalar& d2)
|
|
|
+{
|
|
|
+ this->a1 = a1;
|
|
|
+ this->b1 = b1;
|
|
|
+ this->c1 = c1;
|
|
|
+ this->d1 = d1;
|
|
|
+
|
|
|
+ this->a2 = a2;
|
|
|
+ this->b2 = b2;
|
|
|
+ this->c2 = c2;
|
|
|
+ this->d2 = d2;
|
|
|
+
|
|
|
+ this->pi_1_curvegen = pi_1(pub_key.get_bipoint_curvegen());
|
|
|
+ this->pi_2_curvegen = pi_2(pub_key.get_bipoint_twistgen());
|
|
|
+ this->pi_T_curvegen = pi_T(pairing(pub_key.get_bipoint_curvegen(), pub_key.get_bipoint_twistgen()));
|
|
|
+}
|
|
|
+
|
|
|
Bipoint<curvepoint_fp_t> PrivateKey::pi_1(const Bipoint<curvepoint_fp_t>& input) const
|
|
|
{
|
|
|
Bipoint<curvepoint_fp_t> retval;
|