BGN.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef __BGN_HPP
  2. #define __BGN_HPP
  3. #include "Bipoint.hpp"
  4. #include "Quadripoint.hpp"
  5. #include "Scalar.hpp"
  6. #include "PublicKey.hpp"
  7. #include "PrivateKey.hpp"
  8. class BGN
  9. {
  10. public:
  11. BGN();
  12. void encrypt(CurveBipoint& G_element, const Scalar& cleartext) const;
  13. void encrypt(TwistBipoint& H_element, const Scalar& cleartext) const;
  14. void encrypt(CurveBipoint& G_element, TwistBipoint& H_element, const Scalar& cleartext) const;
  15. CurveBipoint homomorphic_addition(const CurveBipoint& a, const CurveBipoint& b) const;
  16. TwistBipoint homomorphic_addition(const TwistBipoint& a, const TwistBipoint& b) const;
  17. Quadripoint homomorphic_addition(const Quadripoint& a, const Quadripoint& b) const;
  18. Quadripoint homomorphic_multiplication(const CurveBipoint& a, const TwistBipoint& b) const;
  19. CurveBipoint homomorphic_addition_no_rerandomize(const CurveBipoint& a, const CurveBipoint& b) const;
  20. TwistBipoint homomorphic_addition_no_rerandomize(const TwistBipoint& a, const TwistBipoint& b) const;
  21. Quadripoint homomorphic_addition_no_rerandomize(const Quadripoint& a, const Quadripoint& b) const;
  22. Quadripoint homomorphic_multiplication_no_rerandomize(const CurveBipoint& a, const TwistBipoint& b) const;
  23. Scalar decrypt(const CurveBipoint& ciphertext);
  24. Scalar decrypt(const TwistBipoint& ciphertext);
  25. Scalar decrypt(const Quadripoint & ciphertext);
  26. CurveBipoint rerandomize(const CurveBipoint& a) const;
  27. TwistBipoint rerandomize(const TwistBipoint& a) const;
  28. Quadripoint rerandomize(const Quadripoint& a) const;
  29. const BGNPublicKey& get_public_key() const;
  30. const BGNPrivateKey& get_private_key() const;
  31. friend std::ostream& operator<<(std::ostream& os, const BGN& output);
  32. friend std::istream& operator>>(std::istream& is, BGN& input);
  33. private:
  34. BGNPublicKey public_key;
  35. BGNPrivateKey private_key;
  36. };
  37. #endif /* __BGN_HPP */