PublicKey.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. void encrypt(Bipoint<curvepoint_fp_t>& G_element, const Scalar& cleartext) const;
  11. void encrypt(Bipoint<twistpoint_fp2_t>& H_element, const Scalar& cleartext) const;
  12. void encrypt(Bipoint<curvepoint_fp_t>& G_element, Bipoint<twistpoint_fp2_t>& H_element, const Scalar& cleartext) const;
  13. Bipoint<curvepoint_fp_t> homomorphic_addition(const Bipoint<curvepoint_fp_t>& a, const Bipoint<curvepoint_fp_t>& b) const;
  14. Bipoint<twistpoint_fp2_t> homomorphic_addition(const Bipoint<twistpoint_fp2_t>& a, const Bipoint<twistpoint_fp2_t>& b) const;
  15. Quadripoint homomorphic_addition(const Quadripoint& a, const Quadripoint& b) const;
  16. Quadripoint homomorphic_multiplication(const Bipoint<curvepoint_fp_t>& a, const Bipoint<twistpoint_fp2_t>& b) const;
  17. Bipoint<curvepoint_fp_t> get_bipoint_curvegen() const;
  18. Bipoint<twistpoint_fp2_t> get_bipoint_twistgen() const;
  19. Bipoint<curvepoint_fp_t> get_bipoint_curve_subgroup_gen() const;
  20. Bipoint<twistpoint_fp2_t> get_bipoint_twist_subgroup_gen() const;
  21. private:
  22. PublicKey();
  23. 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);
  24. friend class BGN;
  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