1234567891011121314151617181920212223242526272829303132333435363738 |
- #ifndef __PUBLICKEY_HPP
- #define __PUBLICKEY_HPP
- #include "Scalar.hpp"
- #include "Bipoint.hpp"
- #include "Quadripoint.hpp"
- #include "pairing.hpp"
- class PublicKey
- {
- public:
- PublicKey() = default;
- PublicKey(const Bipoint<curvepoint_fp_t>& g, const Bipoint<twistpoint_fp2_t>& h, const Bipoint<curvepoint_fp_t>& g1, const Bipoint<twistpoint_fp2_t>& h1);
-
- void set(const Bipoint<curvepoint_fp_t>& g, const Bipoint<twistpoint_fp2_t>& h, const Bipoint<curvepoint_fp_t>& g1, const Bipoint<twistpoint_fp2_t>& h1);
-
- void encrypt(Bipoint<curvepoint_fp_t>& G_element, const Scalar& cleartext) const;
- void encrypt(Bipoint<twistpoint_fp2_t>& H_element, const Scalar& cleartext) const;
- void encrypt(Bipoint<curvepoint_fp_t>& G_element, Bipoint<twistpoint_fp2_t>& H_element, const Scalar& cleartext) const;
- Bipoint<curvepoint_fp_t> homomorphic_addition(const Bipoint<curvepoint_fp_t>& a, const Bipoint<curvepoint_fp_t>& b) const;
- Bipoint<twistpoint_fp2_t> homomorphic_addition(const Bipoint<twistpoint_fp2_t>& a, const Bipoint<twistpoint_fp2_t>& b) const;
- Quadripoint homomorphic_addition(const Quadripoint& a, const Quadripoint& b) const;
- Quadripoint homomorphic_multiplication(const Bipoint<curvepoint_fp_t>& a, const Bipoint<twistpoint_fp2_t>& b) const;
-
- Bipoint<curvepoint_fp_t> get_bipoint_curvegen() const;
- Bipoint<twistpoint_fp2_t> get_bipoint_twistgen() const;
- Bipoint<curvepoint_fp_t> get_bipoint_curve_subgroup_gen() const;
- Bipoint<twistpoint_fp2_t> get_bipoint_twist_subgroup_gen() const;
-
- private:
- Bipoint<curvepoint_fp_t> bipoint_curvegen; // g
- Bipoint<twistpoint_fp2_t> bipoint_twistgen; // h
- Bipoint<curvepoint_fp_t> bipoint_curve_subgroup_gen; // (g^(a1), g^(b1))
- Bipoint<twistpoint_fp2_t> bipoint_twist_subgroup_gen; // (h^(a2), h^(b2))
- };
- #endif
|