SequenceContainers.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #pragma once
  2. #include "openfhe/binfhe/lwe-ciphertext-fwd.h"
  3. #include "openfhe/core/lattice/hal/lat-backend.h"
  4. #include "openfhe/pke/ciphertext-fwd.h"
  5. #include "openfhe/pke/key/evalkey-fwd.h"
  6. #include "openfhe/pke/key/privatekey-fwd.h"
  7. // cxx currently does not support std::vector of opaque type
  8. namespace openfhe
  9. {
  10. using CiphertextImpl = lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>;
  11. class VectorOfCiphertexts final
  12. {
  13. std::vector<std::shared_ptr<CiphertextImpl>> m_ciphertexts;
  14. public:
  15. VectorOfCiphertexts(std::vector<std::shared_ptr<CiphertextImpl>>&& ciphertexts) noexcept;
  16. [[nodiscard]] const std::vector<std::shared_ptr<CiphertextImpl>>& GetRef() const noexcept;
  17. [[nodiscard]] std::vector<std::shared_ptr<CiphertextImpl>>& GetRef() noexcept;
  18. };
  19. class VectorOfDCRTPolys final
  20. {
  21. std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> m_elements;
  22. public:
  23. VectorOfDCRTPolys(std::shared_ptr<std::vector<lbcrypto::DCRTPoly>>&& elements) noexcept;
  24. [[nodiscard]] const std::shared_ptr<std::vector<lbcrypto::DCRTPoly>>& GetRef() const noexcept;
  25. };
  26. using EvalKeyImpl = lbcrypto::EvalKeyImpl<lbcrypto::DCRTPoly>;
  27. class VectorOfEvalKeys final
  28. {
  29. std::vector<std::shared_ptr<EvalKeyImpl>> m_evalKeys;
  30. public:
  31. VectorOfEvalKeys(std::vector<std::shared_ptr<EvalKeyImpl>> evalKeys);
  32. [[nodiscard]] const std::vector<std::shared_ptr<EvalKeyImpl>>& GetRef() const noexcept;
  33. };
  34. using LWECiphertextImpl = lbcrypto::LWECiphertextImpl;
  35. class VectorOfLWECiphertexts final
  36. {
  37. std::vector<std::shared_ptr<LWECiphertextImpl>> m_lweCiphertexts;
  38. public:
  39. VectorOfLWECiphertexts(
  40. std::vector<std::shared_ptr<LWECiphertextImpl>>&& lweCiphertexts) noexcept;
  41. [[nodiscard]] std::vector<std::shared_ptr<LWECiphertextImpl>>& GetRef() noexcept;
  42. };
  43. using PrivateKeyImpl = lbcrypto::PrivateKeyImpl<lbcrypto::DCRTPoly>;
  44. class VectorOfPrivateKeys final
  45. {
  46. std::vector<std::shared_ptr<PrivateKeyImpl>> m_privateKeys;
  47. public:
  48. VectorOfPrivateKeys(std::vector<std::shared_ptr<PrivateKeyImpl>>&& ciphertexts) noexcept;
  49. [[nodiscard]] const std::vector<std::shared_ptr<PrivateKeyImpl>>& GetRef() const noexcept;
  50. };
  51. class VectorOfVectorOfCiphertexts final
  52. {
  53. std::vector<std::vector<std::shared_ptr<CiphertextImpl>>> m_ciphertexts;
  54. public:
  55. VectorOfVectorOfCiphertexts(
  56. std::vector<std::vector<std::shared_ptr<CiphertextImpl>>>&& ciphertexts) noexcept;
  57. [[nodiscard]] std::vector<std::vector<std::shared_ptr<CiphertextImpl>>>& GetRef() noexcept;
  58. };
  59. } // openfhe