PublicKey.hpp 1.3 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(CurveBipoint& G_element, const Scalar& cleartext) const;
  11. void encrypt(TwistBipoint& H_element, const Scalar& cleartext) const;
  12. void encrypt(CurveBipoint& G_element, TwistBipoint& H_element, const Scalar& cleartext) const;
  13. CurveBipoint homomorphic_addition(const CurveBipoint& a, const CurveBipoint& b) const;
  14. TwistBipoint homomorphic_addition(const TwistBipoint& a, const TwistBipoint& b) const;
  15. Quadripoint homomorphic_addition(const Quadripoint& a, const Quadripoint& b) const;
  16. Quadripoint homomorphic_multiplication(const CurveBipoint& a, const TwistBipoint& b) const;
  17. CurveBipoint get_bipoint_curvegen() const;
  18. TwistBipoint get_bipoint_twistgen() const;
  19. CurveBipoint get_bipoint_curve_subgroup_gen() const;
  20. TwistBipoint get_bipoint_twist_subgroup_gen() const;
  21. private:
  22. PublicKey();
  23. void set(const CurveBipoint& g, const TwistBipoint& h, const CurveBipoint& g1, const TwistBipoint& h1);
  24. friend class BGN;
  25. CurveBipoint bipoint_curvegen; // g
  26. TwistBipoint bipoint_twistgen; // h
  27. CurveBipoint bipoint_curve_subgroup_gen; // (g^(a1), g^(b1))
  28. TwistBipoint bipoint_twist_subgroup_gen; // (h^(a2), h^(b2))
  29. };
  30. #endif