BGN.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. PublicKey get_public_key() const;
  23. private:
  24. PublicKey public_key;
  25. PrivateKey private_key;
  26. };
  27. #endif /* __BGN_HPP */