PublicKey.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef __PUBLICKEY_HPP
  2. #define __PUBLICKEY_HPP
  3. #include "Scalar.hpp"
  4. #include "Bipoint.hpp"
  5. #include "Quadripoint.hpp"
  6. #include "pairing.hpp"
  7. class PublicKey
  8. {
  9. public:
  10. PublicKey() = default;
  11. 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);
  12. 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);
  13. void encrypt(Bipoint<curvepoint_fp_t>& G_element, const Scalar& cleartext) const;
  14. void encrypt(Bipoint<twistpoint_fp2_t>& H_element, const Scalar& cleartext) const;
  15. void encrypt(Bipoint<curvepoint_fp_t>& G_element, Bipoint<twistpoint_fp2_t>& H_element, const Scalar& cleartext) const;
  16. Bipoint<curvepoint_fp_t> homomorphic_addition(const Bipoint<curvepoint_fp_t>& a, const Bipoint<curvepoint_fp_t>& b) const;
  17. Bipoint<twistpoint_fp2_t> homomorphic_addition(const Bipoint<twistpoint_fp2_t>& a, const Bipoint<twistpoint_fp2_t>& b) const;
  18. Quadripoint homomorphic_addition(const Quadripoint& a, const Quadripoint& b) const;
  19. Quadripoint homomorphic_multiplication(const Bipoint<curvepoint_fp_t>& a, const Bipoint<twistpoint_fp2_t>& b) const;
  20. Bipoint<curvepoint_fp_t> get_bipoint_curvegen() const;
  21. Bipoint<twistpoint_fp2_t> get_bipoint_twistgen() const;
  22. Bipoint<curvepoint_fp_t> get_bipoint_curve_subgroup_gen() const;
  23. Bipoint<twistpoint_fp2_t> get_bipoint_twist_subgroup_gen() const;
  24. private:
  25. Bipoint<curvepoint_fp_t> bipoint_curvegen; // g
  26. Bipoint<twistpoint_fp2_t> bipoint_twistgen; // h
  27. Bipoint<curvepoint_fp_t> bipoint_curve_subgroup_gen; // (g^(a1), g^(b1))
  28. Bipoint<twistpoint_fp2_t> bipoint_twist_subgroup_gen; // (h^(a2), h^(b2))
  29. };
  30. #endif