cryptocontext_wrapper.hpp 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // BSD 2-Clause License
  2. // Copyright (c) 2023, OpenFHE
  3. // All rights reserved.
  4. // Redistribution and use in source and binary forms, with or without
  5. // modification, are permitted provided that the following conditions are met:
  6. // 1. Redistributions of source code must retain the above copyright notice, this
  7. // list of conditions and the following disclaimer.
  8. // 2. Redistributions in binary form must reproduce the above copyright notice,
  9. // this list of conditions and the following disclaimer in the documentation
  10. // and/or other materials provided with the distribution.
  11. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  12. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  13. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  14. // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  15. // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  16. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  17. // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  18. // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  20. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. #ifndef OPENFHE_CRYPTOCONTEXT_BINDINGS_H
  22. #define OPENFHE_CRYPTOCONTEXT_BINDINGS_H
  23. #include <stdlib.h>
  24. #include <vector>
  25. #include <algorithm>
  26. #include <complex>
  27. #include "openfhe.h"
  28. using namespace lbcrypto;
  29. using ParmType = typename DCRTPoly::Params;
  30. Ciphertext<DCRTPoly> EvalFastRotationPrecomputeWrapper(CryptoContext<DCRTPoly>& self,
  31. ConstCiphertext<DCRTPoly> ciphertext);
  32. Ciphertext<DCRTPoly> EvalFastRotationWrapper(CryptoContext<DCRTPoly>& self,
  33. ConstCiphertext<DCRTPoly> ciphertext,
  34. const usint index,
  35. const usint m,
  36. ConstCiphertext<DCRTPoly> digits);
  37. Ciphertext<DCRTPoly> EvalFastRotationExtWrapper(CryptoContext<DCRTPoly>& self,ConstCiphertext<DCRTPoly> ciphertext, const usint index, ConstCiphertext<DCRTPoly> digits, bool addFirst);
  38. Plaintext DecryptWrapper(CryptoContext<DCRTPoly>& self,
  39. ConstCiphertext<DCRTPoly> ciphertext,const PrivateKey<DCRTPoly> privateKey);
  40. Plaintext DecryptWrapper(CryptoContext<DCRTPoly>& self,
  41. const PrivateKey<DCRTPoly> privateKey,ConstCiphertext<DCRTPoly> ciphertext);
  42. Plaintext MultipartyDecryptFusionWrapper(CryptoContext<DCRTPoly>& self,const std::vector<Ciphertext<DCRTPoly>>& partialCiphertextVec);
  43. const std::map<usint, EvalKey<DCRTPoly>> EvalAutomorphismKeyGenWrapper(CryptoContext<DCRTPoly>& self,const PrivateKey<DCRTPoly> privateKey,const std::vector<usint> &indexList);
  44. const std::shared_ptr<std::map<usint, EvalKey<DCRTPoly>>> GetEvalSumKeyMapWrapper(CryptoContext<DCRTPoly>& self, const std::string &id);
  45. const PlaintextModulus GetPlaintextModulusWrapper(CryptoContext<DCRTPoly>& self);
  46. const double GetModulusWrapper(CryptoContext<DCRTPoly>& self);
  47. void RemoveElementWrapper(Ciphertext<DCRTPoly>& self, usint index);
  48. const double GetScalingFactorRealWrapper(CryptoContext<DCRTPoly>& self, uint32_t l);
  49. const uint64_t GetModulusCKKSWrapper(CryptoContext<DCRTPoly>& self);
  50. const ScalingTechnique GetScalingTechniqueWrapper(CryptoContext<DCRTPoly>& self);
  51. const usint GetDigitSizeWrapper(CryptoContext<DCRTPoly>& self);
  52. #endif // OPENFHE_CRYPTOCONTEXT_BINDINGS_H