decryption.cpp 592 B

123456789101112131415161718
  1. #include <pybind11/pybind11.h>
  2. #include <pybind11/stl.h>
  3. #include <openfhe/pke/openfhe.h>
  4. #include "bindings.h"
  5. using namespace lbcrypto;
  6. namespace py = pybind11;
  7. template<typename Element>
  8. Plaintext DecryptInterface(Ciphertext<Element> ciphertext,const PrivateKey<Element> privateKey){
  9. Plaintext plaintextDecResult;
  10. auto cc = ciphertext->GetCryptoContext();
  11. cc->Decrypt(privateKey, ciphertext,&plaintextDecResult);
  12. return plaintextDecResult;
  13. }
  14. void bind_decryption(py::module &m){
  15. m.def("Decrypt",&DecryptInterface<DCRTPoly>,"Decrypt a ciphertext using private key");
  16. }