BGN.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __BGN_HPP
  2. #define __BGN_HPP
  3. #include "Scalar.hpp"
  4. #include "Bipoint.hpp"
  5. #include "Quadripoint.hpp"
  6. #include "PublicKey.hpp"
  7. #include "PrivateKey.hpp"
  8. class BGN
  9. {
  10. public:
  11. BGN();
  12. void encrypt(Bipoint<curvepoint_fp_t>& G_element, const Scalar& cleartext) const;
  13. void encrypt(Bipoint<twistpoint_fp2_t>& H_element, const Scalar& cleartext) const;
  14. void encrypt(Bipoint<curvepoint_fp_t>& G_element, Bipoint<twistpoint_fp2_t>& H_element, const Scalar& cleartext) const;
  15. Bipoint<curvepoint_fp_t> homomorphic_addition(const Bipoint<curvepoint_fp_t>& a, const Bipoint<curvepoint_fp_t>& b) const;
  16. Bipoint<twistpoint_fp2_t> homomorphic_addition(const Bipoint<twistpoint_fp2_t>& a, const Bipoint<twistpoint_fp2_t>& b) const;
  17. Quadripoint homomorphic_addition(const Quadripoint& a, const Quadripoint& b) const;
  18. Quadripoint homomorphic_multiplication(const Bipoint<curvepoint_fp_t>& a, const Bipoint<twistpoint_fp2_t>& b) const;
  19. Scalar decrypt(const Bipoint<curvepoint_fp_t>& ciphertext) const;
  20. Scalar decrypt(const Bipoint<twistpoint_fp2_t>& ciphertext) const;
  21. Scalar decrypt(const Quadripoint& ciphertext) const;
  22. const PublicKey& get_public_key() const;
  23. const PrivateKey& get_private_key() const;
  24. private:
  25. PublicKey public_key;
  26. PrivateKey private_key;
  27. };
  28. #endif /* __BGN_HPP */