Browse Source

cmake for decryption

Rener Oliveira (Ubuntu WSL) 2 years ago
parent
commit
754c18c37e
4 changed files with 10 additions and 4 deletions
  1. 3 1
      CMakeLists.txt
  2. 1 1
      src/bindings.cpp
  3. 1 1
      src/bindings.h
  4. 5 1
      src/pke/examples/simple-integers.py

+ 3 - 1
CMakeLists.txt

@@ -24,12 +24,14 @@ find_package(OpenFHE)
 find_package(pybind11 REQUIRED)
 
 set( CMAKE_CXX_FLAGS ${OpenFHE_CXX_FLAGS} )
+set( OpenFHE_Py_SOURCES src)
 
 include_directories( ${OPENMP_INCLUDES} )
 include_directories( ${OpenFHE_INCLUDE} )
 include_directories( ${OpenFHE_INCLUDE}/third-party/include )
 include_directories( ${OpenFHE_INCLUDE}/core )
 include_directories( ${OpenFHE_INCLUDE}/pke )
+include_directories( ${OpenFHE_Py_SOURCES} )
 ### add directories for other OpenFHE modules as needed for your project
 
 link_directories( ${OpenFHE_LIBDIR} )
@@ -49,7 +51,7 @@ endif()
 ### add_executable( test demo-simple-example.cpp )
 
 ### Pybind Modules
-pybind11_add_module(openfhe src/bindings.cpp)
+pybind11_add_module(openfhe src/bindings.cpp src/pke/decryption.cpp)
 ### Python installation 
 find_package(Python REQUIRED COMPONENTS Interpreter Development)
 

+ 1 - 1
src/bindings.cpp

@@ -110,6 +110,6 @@ PYBIND11_MODULE(openfhe, m) {
     bind_keys(m);
     bind_encodings(m);
     bind_ciphertext(m);
-    //bind_decryption(m);
+    bind_decryption(m);
 
 }

+ 1 - 1
src/bindings.h

@@ -9,5 +9,5 @@ void bind_enums(pybind11::module &m);
 void bind_keys(pybind11::module &m);
 void bind_encodings(pybind11::module &m);
 void bind_ciphertext(pybind11::module &m);
-//void bind_decryption(pybind11::module &m);
+void bind_decryption(pybind11::module &m);
 #endif // OPENFHE_BINDINGS_H

+ 5 - 1
src/pke/examples/simple-integers.py

@@ -41,4 +41,8 @@ plaintext3 = cryptoContext.MakePackedPlaintext(vectorOfInts3)
 
 
 ciphertext1 = cryptoContext.Encrypt(keypair.publicKey, plaintext1)
-ciphertextRot1 = cryptoContext.EvalRotate(ciphertext1, 1)
+ciphertextRot1 = cryptoContext.EvalRotate(ciphertext1, 1)
+
+plaintextRot1 = Decrypt(ciphertextRot1,keypair.secretKey)
+print(plaintextRot1) # still not printing the vector
+