瀏覽代碼

implementation with cxx

Hovsep Papoyan 10 月之前
父節點
當前提交
48249a9f5f

+ 6 - 6
Cargo.toml

@@ -1,11 +1,11 @@
 [package]
-name = "openfhe"
-version = "0.0.0"
-edition = '2021'
-description = "Rust package of the OpenFHE Fully Homomorphic Encryption Library."
-license-file = "LICENSE"
+name = "openfhe_rs_dev"
+version = "0.1.0"
+edition = "2021"
 
 [dependencies]
+cxx = "1.0"
 
 [build-dependencies]
-bindgen = "0.65.1"
+cxx-build = "1.0"
+

+ 35 - 17
build.rs

@@ -1,20 +1,38 @@
-use std::env;
-use std::path::PathBuf;
+fn main()
+{
+    cxx_build::bridge("src/main.rs")
+        .file("src/direct.cc")
+        .include("/usr/local/include/openfhe")
+        .include("/usr/local/include/openfhe/third-party/include")
+        .include("/usr/local/include/openfhe/core")
+        .include("/usr/local/include/openfhe/pke")
+        .include("/usr/local/include/openfhe/binfhe")
+        .flag_if_supported("-std=c++17")
+        .flag_if_supported("-Wall")
+        .flag_if_supported("-Werror")
+        .flag_if_supported("-O3")
+        //.flag_if_supported("-DOPENFHE_VERSION=1.1.4")
+        .flag_if_supported("-Wno-parentheses") // [-Wparentheses]
+        //.flag_if_supported("-DMATHBACKEND=4")
+        .flag_if_supported("-fopenmp") // [-Wunknown-pragmas]
+        .flag_if_supported("-fPIE")
+        .flag_if_supported("-Wno-unused-parameter") // [-Wunused-parameter]
+        .flag_if_supported("-Wno-missing-field-initializers") // [-Wmissing-field-initializers]
+        .compile("openfhe_rs_dev");
 
-fn main() {
-    println!("cargo:rustc-link-search=cpp/build/src/");
-    
-    println!("cargo:rustc-link-lib=openfhesys");
+    println!("cargo::rerun-if-changed=src/main.rs");
+    println!("cargo::rerun-if-changed=src/direct.hpp");
+    println!("cargo::rerun-if-changed=src/direct.cc");
+
+    // linking additional shared libraries
+    println!("cargo::rustc-link-arg=-L/usr/local/lib");
+    println!("cargo::rustc-link-arg=-lOPENFHEpke");
+    println!("cargo::rustc-link-arg=-lOPENFHEbinfhe");
+    println!("cargo::rustc-link-arg=-lOPENFHEcore");
 
-    let bindings = bindgen::Builder::default()
-        .header("cpp/include/bindings.hpp")
-        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
-        .generate()
-        .expect("Unable to generate bindings");
-    println!("cargo:rerun-if-changed=cpp/include/bindings.hpp");
-    // Write the bindings to the $OUT_DIR/bindings.rs file.
-    let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
-    bindings
-        .write_to_file(out_path.join("bindings.rs"))
-        .expect("Couldn't write bindings!");
+    println!("cargo::rustc-link-arg=-L/usr/lib/gcc/x86_64-linux-gnu/11");
+    println!("cargo::rustc-link-arg=-lgomp");
+    
+    // necessary to avoid using LD_LIBRARY_PATH
+    println!("cargo::rustc-link-arg=-Wl,-rpath=/usr/local/lib");
 }

+ 0 - 94
cpp/.clang-format

@@ -1,94 +0,0 @@
----
-BasedOnStyle: WebKit
-AlignAfterOpenBracket: Align
-AlignConsecutiveAssignments: false
-AlignConsecutiveDeclarations: false
-AlignEscapedNewlines: Left
-AlignOperands: true
-AlignTrailingComments: true
-AllowAllParametersOfDeclarationOnNextLine: false
-AllowShortBlocksOnASingleLine: false
-AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
-AllowShortIfStatementsOnASingleLine: Never
-AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
-AlwaysBreakAfterReturnType: None
-AlwaysBreakBeforeMultilineStrings: true
-AlwaysBreakTemplateDeclarations: Yes
-BinPackArguments: true
-BinPackParameters: true
-BreakAfterJavaFieldAnnotations: true
-BreakBeforeBinaryOperators: None
-BreakBeforeBraces: Custom
-BraceWrapping:
-    AfterClass: false
-    AfterControlStatement: false
-    AfterEnum: false
-    AfterFunction: false
-    AfterNamespace: false
-    AfterObjCDeclaration: false
-    AfterStruct: false
-    AfterUnion: false
-    AfterExternBlock: false
-    BeforeCatch: false
-    BeforeElse: false
-    IndentBraces: false
-    SplitEmptyFunction: false
-    SplitEmptyRecord: false
-    SplitEmptyNamespace: false
-BreakBeforeInheritanceComma: false
-BreakBeforeTernaryOperators: false
-BreakConstructorInitializers: AfterColon
-BreakStringLiterals: true
-ColumnLimit: 120
-CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
-ConstructorInitializerIndentWidth: 4
-ContinuationIndentWidth: 4
-Cpp11BracedListStyle: true
-DerivePointerAlignment: true
-DisableFormat: false
-ExperimentalAutoDetectBinPacking: true
-FixNamespaceComments: true
-ForEachMacros: ['BOOST_FOREACH']
-IncludeBlocks: Regroup
-IncludeCategories:
-    -   Regex:           '^"(<)/'
-        Priority:        1
-    -   Regex:           '^(<(boost)/)'
-        Priority:        2
-    -   Regex:           '^(<(nil\/crypto3)/)'
-        Priority:        3
-    -   Regex:           '.*'
-        Priority:        4
-IndentCaseLabels: true
-IndentPPDirectives: None
-IndentWidth: 4
-IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
-Language: Cpp
-NamespaceIndentation: All
-ObjCBlockIndentWidth: 4
-ObjCSpaceAfterProperty: true
-ObjCSpaceBeforeProtocolList: true
-PointerAlignment: Right
-ReflowComments: true
-SortIncludes: false
-SortUsingDeclarations: true
-SpaceAfterCStyleCast: false
-SpaceAfterTemplateKeyword: false
-SpaceBeforeAssignmentOperators: true
-SpaceBeforeParens: ControlStatements
-SpaceInEmptyParentheses: false
-SpacesBeforeTrailingComments: 4
-SpacesInAngles: false
-SpacesInCStyleCastParentheses: false
-SpacesInContainerLiterals: true
-SpacesInParentheses: false
-SpacesInSquareBrackets: false
-Standard: Cpp11
-TabWidth: 4
-UseTab: Never
-
-...

+ 0 - 1
cpp/.gitignore

@@ -1 +0,0 @@
-build

+ 0 - 29
cpp/CMakeLists.txt

@@ -1,29 +0,0 @@
-cmake_minimum_required (VERSION 3.5.1)
-
-project(openfhe_sys CXX)
-set(CMAKE_CXX_STANDARD 17)
-option( BUILD_STATIC "Set to ON to include static versions of the library" OFF)
-
-find_package(OpenFHE)
-
-set( CMAKE_CXX_FLAGS ${OpenFHE_CXX_FLAGS} )
-
-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_INCLUDE}/binfhe)
-### add directories for other OpenFHE modules as needed for your project
-
-link_directories( ${OpenFHE_LIBDIR} )
-link_directories( ${OPENMP_LIBRARIES} )
-if(BUILD_STATIC)
-    set( CMAKE_EXE_LINKER_FLAGS "${OpenFHE_EXE_LINKER_FLAGS} -static")
-    link_libraries( ${OpenFHE_STATIC_LIBRARIES} )
-else()
-    set( CMAKE_EXE_LINKER_FLAGS ${OpenFHE_EXE_LINKER_FLAGS} )
-    link_libraries( ${OpenFHE_SHARED_LIBRARIES} )
-endif()
-
-add_subdirectory(src)

+ 0 - 472
cpp/include/bindings.hpp

@@ -1,472 +0,0 @@
-// BSD 2-Clause License
-
-// Copyright (c) 2023, OpenFHE
-
-// All rights reserved.
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef OPENFHE_BINDINGS_H
-#define OPENFHE_BINDINGS_H
-
-#include <cstdint>
-#include "constants-fwd.h"
-
-// forward declarations
-class FFIPublicKeyImpl;
-class FFIPrivateKeyImpl;
-class FFIKeyPair;
-class FFIParams;
-class FFICryptoContextImpl;
-
-typedef std::uint32_t usint;
-typedef std::uint64_t FFIPlaintextModulus;
-
-// enums from stdlatticeparms.h
-
-enum FFISecurityLevel {
-    HEStd_128_classic,
-    HEStd_192_classic,
-    HEStd_256_classic,
-    HEStd_128_quantum,
-    HEStd_192_quantum,
-    HEStd_256_quantum,
-    HEStd_NotSet,
-};
-
-// enums from constants-lattice.h
-
-enum FFISecretKeyDist {
-    GAUSSIAN        = 0,
-    UNIFORM_TERNARY = 1,  // Default value, all schemes support this key distribution
-    SPARSE_TERNARY  = 2,
-    // BINARY = 3, // Future implementation
-};
-
-// enums from scheme-id.h
-
-enum FFISCHEME {
-    INVALID_SCHEME = 0,
-    CKKSRNS_SCHEME,
-    BFVRNS_SCHEME,
-    BGVRNS_SCHEME,
-};
-
-enum CryptoContextType {
-    BFVRNS,
-    BGVRNS,
-    // Add other types as needed
-};
-
-// KeyPair FFI forwad declaration
-
-class FFIKeyPair;
-
-// PublicKeyImpl FFI
-
-class FFIPublicKeyImpl {
-protected:
-    void* pubkey_ptr;
-public:
-    FFIPublicKeyImpl();
-
-    explicit FFIPublicKeyImpl(void* new_pubkey_ptr);
-
-    void SetKeyTag(const char*& tag);
-
-    const char* GetKeyTag() const;
-
-    friend class FFIKeyPair;
-    friend class FFICryptoContextImpl;
-};
-
-// PrivateKeyImpl FFI
-
-class FFIPrivateKeyImpl {
-protected:
-    void* privkey_ptr;
-public:
-    FFIPrivateKeyImpl();
-
-    explicit FFIPrivateKeyImpl(void* new_privkey_ptr);
-
-    void SetKeyTag(const char*& tag);
-
-    const char* GetKeyTag() const;
-
-    friend class FFIKeyPair;
-    friend class FFICryptoContextImpl;
-};
-
-// KeyPair FFI
-
-class FFIKeyPair {
-protected:
-    void* keypair_ptr;
-public:
-    FFIKeyPair();
-    
-    explicit FFIKeyPair(void* new_keypair_ptr){
-        keypair_ptr = new_keypair_ptr;
-    }
-
-    explicit FFIKeyPair(const FFIPublicKeyImpl& publicKey, const FFIPrivateKeyImpl& privateKey);
-    
-    bool is_allocated() const;
-
-    FFIPublicKeyImpl GetPublicKey() const;
-
-    FFIPrivateKeyImpl GetPrivateKey() const;
-};
-
-// Plaintext FFI
-
-class FFIPlaintext {
-protected:
-    void* plaintext_ptr;
-public:
-    explicit FFIPlaintext(void* new_plaintext_ptr){
-        plaintext_ptr = new_plaintext_ptr;
-    }
-
-    double GetScalingFactor() const;
-
-    void SetScalingFactor(double sf);
-
-    FFISCHEME GetSchemeID() const;
-
-    std::size_t GetLength() const;
-
-    void SetLength(std::size_t newSize);
-
-    bool IsEncoded() const;
-
-    double GetLogPrecision() const;
-
-    void Encode();
-
-    void Decode();
-
-    std::int64_t LowBound() const;
-
-    std::int64_t HighBound() const;
-};
-
-// Ciphertext FFI
-
-class FFICiphertext {
-protected:
-    void* ciphertext_ptr;
-public:
-    FFICiphertext();
-
-    explicit FFICiphertext(void* new_ciphertext_ptr){
-        ciphertext_ptr = new_ciphertext_ptr;
-    }
-
-    std::size_t GetLevel() const;
-
-    void SetLevel(std::size_t level);
-
-   FFICiphertext Clone() const;
-
-//  TODO add RemoveElement method from wrappers
-
-    std::size_t GetSlots() const;
-
-    void SetSlots(std::size_t slots);
-
-    friend class FFICryptoContextImpl;
-};
-
-// Params FFI
-class FFIParams{
-protected:
-    void* params_ptr;
-public:
-    FFIParams();
-
-    FFIParams(FFISCHEME scheme);
-
-    FFIPlaintextModulus GetPlaintextModulus() const;
-
-    FFISCHEME GetScheme() const;
-
-    usint GetDigitSize() const;
-
-    float GetStandardDeviation() const;
-
-    FFISecretKeyDist GetSecretKeyDist() const;
-
-    usint GetMaxRelinSkDeg() const;
-
-    lbcrypto::ProxyReEncryptionMode GetPREMode() const;
-
-    lbcrypto::MultipartyMode GetMultipartyMode() const;
-
-    lbcrypto::ExecutionMode GetExecutionMode() const;
-
-    lbcrypto::DecryptionNoiseMode GetDecryptionNoiseMode() const;
-
-    double GetNoiseEstimate() const;
-
-    double GetDesiredPrecision() const;
-
-    double GetStatisticalSecurity() const;
-
-    double GetNumAdversarialQueries() const;
-
-    usint GetThresholdNumOfParties() const;
-
-    lbcrypto::KeySwitchTechnique GetKeySwitchTechnique() const;
-
-    lbcrypto::ScalingTechnique GetScalingTechnique() const;
-
-    usint GetBatchSize() const;
-
-    usint GetFirstModSize() const;
-
-    uint32_t GetNumLargeDigits() const;
-
-    usint GetMultiplicativeDepth() const;
-
-    usint GetScalingModSize() const;
-
-    FFISecurityLevel GetSecurityLevel() const;
-
-    usint GetRingDim() const;
-
-    usint GetEvalAddCount() const;
-
-    usint GetKeySwitchCount() const;
-
-    lbcrypto::EncryptionTechnique GetEncryptionTechnique() const;
-
-    lbcrypto::MultiplicationTechnique GetMultiplicationTechnique() const;
-
-    usint GetMultiHopModSize() const;
-
-    lbcrypto::COMPRESSION_LEVEL GetInteractiveBootCompressionLevel() const;
-
-    void SetPlaintextModulus(FFIPlaintextModulus ptModulus);
-
-    void SetDigitSize(usint digitSize);
-
-    void SetStandardDeviation(float standardDeviation);
-
-    void SetSecretKeyDist(FFISecretKeyDist secretKeyDist);
-
-    void SetMaxRelinSkDeg(usint maxRelinSkDeg);
-
-    void SetPREMode(lbcrypto::ProxyReEncryptionMode preMode);
-
-    void SetMultipartyMode(lbcrypto::MultipartyMode multipartyMode);
-
-    void SetExecutionMode(lbcrypto::ExecutionMode executionMode);
-
-    void SetDecryptionNoiseMode(lbcrypto::DecryptionNoiseMode decryptionNoiseMode);
-
-    void SetNoiseEstimate(double noiseEstimate);
-
-    void SetDesiredPrecision(double desiredPrecision);
-
-    void SetStatisticalSecurity(uint32_t statisticalSecurity);
-
-    void SetNumAdversarialQueries(uint32_t numAdversarialQueries);
-
-    void SetThresholdNumOfParties(uint32_t thresholdNumOfParties);
-
-    void SetKeySwitchTechnique(lbcrypto::KeySwitchTechnique keySwitchTechnique);
-
-    void SetScalingTechnique(lbcrypto::ScalingTechnique scalingTechnique);
-
-    void SetBatchSize(usint batchSize);
-
-    void SetFirstModSize(usint firstModSize);
-
-    void SetNumLargeDigits(uint32_t numLargeDigits);
-
-    void SetMultiplicativeDepth(usint multiplicativeDepth);
-
-    void SetScalingModSize(usint scalingModSize);
-
-    void SetSecurityLevel(FFISecurityLevel securityLevel);
-
-    void SetRingDim(usint ringDim);
-
-    void SetEvalAddCount(usint evalAddCount);
-
-    void SetKeySwitchCount(usint keySwitchCount);
-
-    void SetEncryptionTechnique(lbcrypto::EncryptionTechnique encryptionTechnique);
-
-    void SetMultiplicationTechnique(lbcrypto::MultiplicationTechnique multiplicationTechnique);
-
-    void SetMultiHopModSize(usint multiHopModSize);
-
-    void SetInteractiveBootCompressionLevel(lbcrypto::COMPRESSION_LEVEL interactiveBootCompressionLevel);
-
-//     std::stream str();  
-
-    friend FFICryptoContextImpl GenCryptoContext(FFIParams params);
-};
-
-// class CryptoContextBFVRNSCCParams : public FFIParams {
-// public:
-//     // CryptoContextBFVRNSCCParams();
-//     CryptoContextBFVRNSCCParams():FFIParams(BFVRNS_SCHEME){};
-// };
-
-// class CryptoContextBGVRNSCCParams : public FFIParams {
-// public:
-//     // CryptoContextBGVRNSCCParams();
-//     CryptoContextBGVRNSCCParams():FFIParams(BGVRNS_SCHEME){};
-// };
-
-// CryptoContext FFI
-
-class FFICryptoContextImpl {
-protected:
-    void* cc_ptr;
-public:
-    FFICryptoContextImpl();
-
-    std::size_t GetKeyGenLevel() const;
-
-    void SetKeyGenLevel(std::size_t level);
-
-    usint GetRingDimension() const;
-
-    FFIPlaintextModulus GetPlaintextModulus() const;
-
-    double GetModulus() const;
-
-    const uint64_t GetModulusCKKS() const;
-
-    double GetScalingFactorReal(uint32_t level) const;
-
-    lbcrypto::ScalingTechnique GetScalingTechnique() const;
-
-    usint GetDigitSize() const;
-
-    usint GetCyclotomicOrder() const;
-
-    void Enable(lbcrypto::PKESchemeFeature feature);
-
-    FFIKeyPair KeyGen() const;
-
-    void EvalMultKeyGen(const FFIPrivateKeyImpl key);
-
-    void EvalMultKeysGen(const FFIPrivateKeyImpl key);
-
-//     void EvalRotateKeyGen(const FFIPrivateKeyImpl privateKey, const std::vector<int32_t>& indexList,
-//      const FFIPublicKey publicKey = nullptr);
-
-//     FFIPlaintext MakeStringPlaintext(const std::string& str) const;
-
-//     FFIPlaintext MakePackedPlaintext(const std::vector<int64_t>& value, std::size_t noiseScaleDeg = 1,
-//                                   uint32_t level = 0) const;
-
-//     FFIPlaintext MakeCoefPackedPlaintext(const std::vector<int64_t>& value, std::size_t noiseScaleDeg = 1,
-//                                       uint32_t level = 0) const;
-
-//     Plaintext MakeCKKSPackedPlaintext(const std::vector<std::complex<double>>& value, std::size_t scaleDeg = 1,
-//                                       uint32_t level = 0, const std::shared_ptr<ParmType> params = nullptr,
-//                                       usint slots = 0) const;
-
-//     Plaintext MakeCKKSPackedPlaintext(const std::vector<double>& value, std::size_t scaleDeg = 1, uint32_t level = 0,
-//                                       const std::shared_ptr<ParmType> params = nullptr, usint slots = 0) const;
-
-    FFICiphertext EvalRotate(const FFICiphertext ciphertext, std::int32_t index) const;
-
-// // const?
-//     Ciphertext<DCRTPoly> EvalFastRotationPrecompute(ConstCiphertext<DCRTPoly> ciphertext);
-// // const?
-//     Ciphertext<DCRTPoly> EvalFastRotation(ConstCiphertext<DCRTPoly> ciphertext, const usint index, const usint m,ConstCiphertext<DCRTPoly> digits);
-// // const?
-//     Ciphertext<DCRTPoly> EvalFastRotationExt(ConstCiphertext<DCRTPoly> ciphertext, const usint index, ConstCiphertext<DCRTPoly> digits, bool addFirst);
-
-//     void EvalAtIndexKeyGen(const PrivateKey<Element> privateKey, const std::vector<int32_t>& indexList,
-//                            const PublicKey<Element> publicKey = nullptr);
-
-//     Ciphertext<Element> EvalAtIndex(ConstCiphertext<Element> ciphertext, int32_t index) const;
-
-    // FFICiphertext Encrypt(const FFIPublicKeyImpl publicKey, FFIPlaintext plaintext) const;
-
-//     DecryptResult Decrypt(ConstCiphertext<Element> ciphertext, const PrivateKey<Element> privateKey,
-//                           Plaintext* plaintext);
-
-//     inline DecryptResult Decrypt(const PrivateKey<Element> privateKey, ConstCiphertext<Element> ciphertext,
-//                                  Plaintext* plaintext);
-
-//     EvalKey<Element> KeySwitchGen(const PrivateKey<Element> oldPrivateKey,
-//                                   const PrivateKey<Element> newPrivateKey) const;
-                                  
-//     Ciphertext<Element> EvalAdd(ConstCiphertext<Element> ciphertext, double constant) const;
-
-//     Ciphertext<Element> EvalAdd(ConstCiphertext<Element> ciphertext1, ConstCiphertext<Element> ciphertext2) const;
-
-//     Ciphertext<Element> EvalAdd(ConstCiphertext<Element> ciphertext, ConstPlaintext plaintext) const;
-
-//     void EvalAddInPlace(Ciphertext<Element>& ciphertext, ConstPlaintext plaintext) const;
-
-//     void EvalAddInPlace(ConstPlaintext plaintext, Ciphertext<Element>& ciphertext) const;
-
-//     void EvalAddInPlace(Ciphertext<Element>& ciphertext1, ConstCiphertext<Element> ciphertext2) const;
-
-//     Ciphertext<Element> EvalAddMutable(Ciphertext<Element>& ciphertext1, Ciphertext<Element>& ciphertext2) const;
-
-//     Ciphertext<Element> EvalAddMutable(Ciphertext<Element>& ciphertext, Plaintext plaintext) const;
-
-//     Ciphertext<Element> EvalAddMutable(Plaintext plaintext, Ciphertext<Element>& ciphertext) const;
-
-//     void EvalAddMutableInPlace(Ciphertext<Element>& ciphertext1, Ciphertext<Element>& ciphertext2) const;
-
-//     Ciphertext<Element> EvalSub(ConstCiphertext<Element> ciphertext1, ConstCiphertext<Element> ciphertext2) const;
-
-//     Ciphertext<Element> EvalSub(ConstCiphertext<Element> ciphertext, ConstPlaintext plaintext) const;
-
-//     Ciphertext<Element> EvalSub(ConstPlaintext plaintext, ConstCiphertext<Element> ciphertext) const;
-
-//     Ciphertext<Element> EvalSub(ConstCiphertext<Element> ciphertext, double constant) const;
-
-//     Ciphertext<Element> EvalSub(double constant, ConstCiphertext<Element> ciphertext) const;
-
-//     void EvalSubInPlace(Ciphertext<Element>& ciphertext, double constant) const;
-
-//     void EvalSubInPlace(double constant, Ciphertext<Element>& ciphertext) const;
-
-//     void EvalSubInPlace(Ciphertext<Element>& ciphertext1, ConstCiphertext<Element> ciphertext2) const;
-
-//     Ciphertext<Element> EvalSubMutable(Ciphertext<Element>& ciphertext1, Ciphertext<Element>& ciphertext2) const;
-
-//     Ciphertext<Element> EvalSubMutable(Ciphertext<Element>& ciphertext, Plaintext plaintext) const;
-
-//     Ciphertext<Element> EvalSubMutable(Plaintext plaintext, Ciphertext<Element>& ciphertext) const;
-
-//     void EvalSubMutableInPlace(Ciphertext<Element>& ciphertext1, Ciphertext<Element>& ciphertext2) const;
-    friend FFICryptoContextImpl GenCryptoContext(FFIParams params);
-};
-
-FFICryptoContextImpl GenCryptoContext(FFIParams params);
-
-#endif // OPENFHE_BINDINGS_H

+ 0 - 65
cpp/include/pke/cryptocontext_wrapper.hpp

@@ -1,65 +0,0 @@
-// BSD 2-Clause License
-
-// Copyright (c) 2023, OpenFHE
-
-// All rights reserved.
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef OPENFHE_CRYPTOCONTEXT_BINDINGS_H
-#define OPENFHE_CRYPTOCONTEXT_BINDINGS_H
-
-#include <stdlib.h>
-#include <vector>
-#include <algorithm>
-#include <complex>
-#include "openfhe.h"
-
-using namespace lbcrypto;
-using ParmType = typename DCRTPoly::Params;
-
-Ciphertext<DCRTPoly> EvalFastRotationPrecomputeWrapper(CryptoContext<DCRTPoly>& self,
-                                                        ConstCiphertext<DCRTPoly> ciphertext);
-
-Ciphertext<DCRTPoly> EvalFastRotationWrapper(CryptoContext<DCRTPoly>& self,
-                                            ConstCiphertext<DCRTPoly> ciphertext,
-                                              const usint index,
-                                              const usint m,
-                                              ConstCiphertext<DCRTPoly> digits);
-Ciphertext<DCRTPoly> EvalFastRotationExtWrapper(CryptoContext<DCRTPoly>& self,ConstCiphertext<DCRTPoly> ciphertext, const usint index, ConstCiphertext<DCRTPoly> digits, bool addFirst);
-
-Plaintext DecryptWrapper(CryptoContext<DCRTPoly>& self,
-ConstCiphertext<DCRTPoly> ciphertext,const PrivateKey<DCRTPoly> privateKey);
-Plaintext DecryptWrapper(CryptoContext<DCRTPoly>& self,
-const PrivateKey<DCRTPoly> privateKey,ConstCiphertext<DCRTPoly> ciphertext);
-Plaintext MultipartyDecryptFusionWrapper(CryptoContext<DCRTPoly>& self,const std::vector<Ciphertext<DCRTPoly>>& partialCiphertextVec);
-
-const std::map<usint, EvalKey<DCRTPoly>> EvalAutomorphismKeyGenWrapper(CryptoContext<DCRTPoly>& self,const PrivateKey<DCRTPoly> privateKey,const std::vector<usint> &indexList);
-const std::shared_ptr<std::map<usint, EvalKey<DCRTPoly>>> GetEvalSumKeyMapWrapper(CryptoContext<DCRTPoly>& self, const std::string &id);
-const PlaintextModulus GetPlaintextModulusWrapper(CryptoContext<DCRTPoly>& self);
-const double GetModulusWrapper(CryptoContext<DCRTPoly>& self);
-void RemoveElementWrapper(Ciphertext<DCRTPoly>& self, usint index);
-const double GetScalingFactorRealWrapper(CryptoContext<DCRTPoly>& self, uint32_t l);
-const uint64_t GetModulusCKKSWrapper(CryptoContext<DCRTPoly>& self);
-const ScalingTechnique GetScalingTechniqueWrapper(CryptoContext<DCRTPoly>& self);
-const usint GetDigitSizeWrapper(CryptoContext<DCRTPoly>& self);
-#endif // OPENFHE_CRYPTOCONTEXT_BINDINGS_H

+ 0 - 44
cpp/include/pke/serialization.hpp

@@ -1,44 +0,0 @@
-// BSD 2-Clause License
-
-// Copyright (c) 2023, OpenFHE
-
-// All rights reserved.
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef OPENFHE_SERIALIZATION_BINDINGS_H
-#define OPENFHE_SERIALIZATION_BINDINGS_H
-
-#include "openfhe.h"
-
-using namespace lbcrypto;
-
-template <typename ST>
-bool SerializeEvalMultKeyWrapper(const std::string& filename, const ST& sertype, std::string id);
-
-template <typename ST>
-bool SerializeEvalAutomorphismKeyWrapper(const std::string& filename, const ST& sertype, std::string id);
-
-template <typename ST>
-bool DeserializeEvalMultKeyWrapper(const std::string& filename, const ST& sertype);
-
-#endif // OPENFHE_SERIALIZATION_BINDINGS_H

+ 0 - 18
cpp/src/CMakeLists.txt

@@ -1,18 +0,0 @@
-set(LIBRARY_SOURCES
-    pke/cryptocontext_wrapper.cpp
-    pke/serialization.cpp
-    bindings.cpp
-)
-
-# Optionally, specify headers for IDEs
-set(LIBRARY_HEADERS
-    pke/cryptocontext_wrapper.hpp
-    pke/serialization.hpp
-    bindings.hpp
-)
-
-# Define the library
-add_library(openfhesys ${LIBRARY_SOURCES})
-
-# Specify include directories
-target_include_directories(openfhesys PUBLIC ../include)

+ 0 - 1573
cpp/src/bindings.cpp

@@ -1,1573 +0,0 @@
-#include <iostream>
-#include <map>
-#include "openfhe.h"
-#include "key/key-ser.h"
-#include "bindings.hpp"
-#include "pke/cryptocontext_wrapper.hpp"
-// #include "binfhe_bindings.h"
-// #include "cryptocontext_docs.h"
-// #include "cryptoparameters_docs.h"
-// #include "plaintext_docs.h"
-// #include "ciphertext_docs.h"
-#include "pke/scheme/bfvrns/gen-cryptocontext-bfvrns-params.h"
-#include "pke/serialization.hpp"
-#include "constants.h"
-
-using namespace lbcrypto;
-
-namespace {
-    struct ParamsHolder{
-           std::shared_ptr<Params> ptr;
-    };
-
-    struct CryptoContextImplHolder{
-           std::shared_ptr<CryptoContextImpl<DCRTPoly>> ptr;
-    };
-
-    struct PubkeyHolder{
-           std::shared_ptr<PublicKeyImpl<DCRTPoly>> ptr;
-    };
-
-    struct PrivkeyHolder{
-           std::shared_ptr<PrivateKeyImpl<DCRTPoly>> ptr;
-    };
-
-    struct KeyPairHolder{
-           std::shared_ptr<KeyPair<DCRTPoly>> ptr;
-    };
-
-    struct PlaintextHolder{
-           std::shared_ptr<PlaintextImpl> ptr;
-    };
-
-    struct CiphertextHolder{
-           std::shared_ptr<CiphertextImpl<DCRTPoly>> ptr;
-    };
-
-    struct ConstCiphertextHolder{
-           std::shared_ptr<const CiphertextImpl<DCRTPoly>> ptr;
-    };
-}
-
-FFIParams::FFIParams(){
-    params_ptr = reinterpret_cast<void*>(
-        new ParamsHolder{std::make_shared<Params>()});
-}
-
-FFIParams::FFIParams(FFISCHEME scheme){
-    params_ptr = reinterpret_cast<void*>(
-        new ParamsHolder{std::make_shared<Params>(lbcrypto::SCHEME(scheme))});
-}
-
-// getters
-
-FFIPlaintextModulus FFIParams::GetPlaintextModulus() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return FFISCHEME(cc_params->GetPlaintextModulus());
-}
-
-FFISCHEME FFIParams::GetScheme() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return FFISCHEME(cc_params->GetScheme());
-}
-
-usint FFIParams::GetDigitSize() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetDigitSize();
-}
-
-float FFIParams::GetStandardDeviation() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetStandardDeviation();
-}
-
-FFISecretKeyDist FFIParams::GetSecretKeyDist() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return FFISecretKeyDist(cc_params->GetSecretKeyDist());
-}
-
-usint FFIParams::GetMaxRelinSkDeg() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetMaxRelinSkDeg();
-}
-
-lbcrypto::ProxyReEncryptionMode FFIParams::GetPREMode() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetPREMode();
-}
-
-lbcrypto::MultipartyMode FFIParams::GetMultipartyMode() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetMultipartyMode();
-}
-
-lbcrypto::ExecutionMode FFIParams::GetExecutionMode() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetExecutionMode();
-}
-
-lbcrypto::DecryptionNoiseMode FFIParams::GetDecryptionNoiseMode() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetDecryptionNoiseMode();
-}
-
-double FFIParams::GetNoiseEstimate() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetNoiseEstimate();
-}
-
-double FFIParams::GetDesiredPrecision() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetDesiredPrecision();
-}
-
-double FFIParams::GetStatisticalSecurity() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetStatisticalSecurity();
-}
-
-double FFIParams::GetNumAdversarialQueries() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetNumAdversarialQueries();
-}
-
-usint FFIParams::GetThresholdNumOfParties() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetThresholdNumOfParties();
-}
-
-lbcrypto::KeySwitchTechnique FFIParams::GetKeySwitchTechnique() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetKeySwitchTechnique();
-}
-
-lbcrypto::ScalingTechnique FFIParams::GetScalingTechnique() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetScalingTechnique();
-}
-
-usint FFIParams::GetBatchSize() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetBatchSize();
-}
-
-usint FFIParams::GetFirstModSize() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetFirstModSize();
-}
-
-uint32_t FFIParams::GetNumLargeDigits() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return static_cast<uint32_t>(cc_params->GetNumLargeDigits());
-}
-
-usint FFIParams::GetMultiplicativeDepth() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return static_cast<usint>(cc_params->GetMultiplicativeDepth());
-}
-
-usint FFIParams::GetScalingModSize() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return static_cast<usint>(cc_params->GetScalingModSize());
-}
-
-FFISecurityLevel FFIParams::GetSecurityLevel() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return FFISecurityLevel(cc_params->GetSecurityLevel());
-}
-
-usint FFIParams::GetRingDim() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetRingDim();
-}
-
-usint FFIParams::GetEvalAddCount() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetEvalAddCount();
-}
-
-usint FFIParams::GetKeySwitchCount() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetKeySwitchCount();
-}
-
-lbcrypto::EncryptionTechnique FFIParams::GetEncryptionTechnique() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetEncryptionTechnique();
-}
-
-lbcrypto::MultiplicationTechnique FFIParams::GetMultiplicationTechnique() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetMultiplicationTechnique();
-}
-
-usint FFIParams::GetMultiHopModSize() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetMultiHopModSize();
-}
-
-lbcrypto::COMPRESSION_LEVEL FFIParams::GetInteractiveBootCompressionLevel() const{
-    std::shared_ptr<const Params> cc_params =
-        reinterpret_cast<const ParamsHolder*>(params_ptr)->ptr;
-    return cc_params->GetInteractiveBootCompressionLevel();
-}
-
-// setters
-
-void FFIParams::SetPlaintextModulus(FFIPlaintextModulus ptModulus){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetPlaintextModulus(ptModulus);
-}
-
-void FFIParams::SetDigitSize(usint digitSize){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetDigitSize(digitSize);
-}
-
-void FFIParams::SetStandardDeviation(float standardDeviation){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetStandardDeviation(standardDeviation);
-}
-
-void FFIParams::SetSecretKeyDist(FFISecretKeyDist secretKeyDist){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetSecretKeyDist(lbcrypto::SecretKeyDist(secretKeyDist));
-}
-
-void FFIParams::SetMaxRelinSkDeg(usint maxRelinSkDeg){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetMaxRelinSkDeg(maxRelinSkDeg);
-}
-
-void FFIParams::SetPREMode(lbcrypto::ProxyReEncryptionMode preMode){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetPREMode(preMode);
-}
-
-void FFIParams::SetMultipartyMode(lbcrypto::MultipartyMode multipartyMode){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetMultipartyMode(multipartyMode);
-}
-
-void FFIParams::SetExecutionMode(lbcrypto::ExecutionMode executionMode){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetExecutionMode(executionMode);
-}
-
-void FFIParams::SetDecryptionNoiseMode(lbcrypto::DecryptionNoiseMode decryptionNoiseMode){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetDecryptionNoiseMode(decryptionNoiseMode);
-}
-
-void FFIParams::SetNoiseEstimate(double noiseEstimate){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetNoiseEstimate(noiseEstimate);
-}
-
-void FFIParams::SetDesiredPrecision(double desiredPrecision){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetDesiredPrecision(desiredPrecision);
-}
-
-void FFIParams::SetStatisticalSecurity(uint32_t statisticalSecurity){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetStatisticalSecurity(statisticalSecurity);
-}
-
-void FFIParams::SetNumAdversarialQueries(uint32_t numAdversarialQueries){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetNumAdversarialQueries(numAdversarialQueries);
-}
-
-void FFIParams::SetThresholdNumOfParties(uint32_t thresholdNumOfParties){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetThresholdNumOfParties(thresholdNumOfParties);
-}
-
-void FFIParams::SetKeySwitchTechnique(lbcrypto::KeySwitchTechnique keySwitchTechnique){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetKeySwitchTechnique(keySwitchTechnique);
-}
-
-void FFIParams::SetScalingTechnique(lbcrypto::ScalingTechnique scalingTechnique){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetScalingTechnique(scalingTechnique);
-}
-
-void FFIParams::SetBatchSize(usint batchSize){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetBatchSize(batchSize);
-}
-
-void FFIParams::SetFirstModSize(usint firstModSize){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetFirstModSize(firstModSize);
-}
-
-void FFIParams::SetNumLargeDigits(usint numLargeDigits){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetNumLargeDigits(numLargeDigits);
-}
-
-void FFIParams::SetMultiplicativeDepth(usint multiplicativeDepth){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetMultiplicativeDepth(multiplicativeDepth);
-}
-
-void FFIParams::SetScalingModSize(usint scalingModSize){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetScalingModSize(scalingModSize);
-}
-
-void FFIParams::SetSecurityLevel(FFISecurityLevel securityLevel){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetSecurityLevel(lbcrypto::SecurityLevel(securityLevel));
-}
-
-void FFIParams::SetRingDim(usint ringDim){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetRingDim(ringDim);
-}
-
-void FFIParams::SetEvalAddCount(usint evalAddCount){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetEvalAddCount(evalAddCount);
-}
-
-void FFIParams::SetKeySwitchCount(usint keySwitchCount){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetKeySwitchCount(keySwitchCount);
-}
-
-void FFIParams::SetEncryptionTechnique(lbcrypto::EncryptionTechnique encryptionTechnique){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetEncryptionTechnique(encryptionTechnique);
-}
-
-void FFIParams::SetMultiplicationTechnique(lbcrypto::MultiplicationTechnique multiplicationTechnique){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetMultiplicationTechnique(multiplicationTechnique);
-}
-
-void FFIParams::SetMultiHopModSize(usint multiHopModSize){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetMultiHopModSize(multiHopModSize);
-}
-
-void FFIParams::SetInteractiveBootCompressionLevel(lbcrypto::COMPRESSION_LEVEL interactiveBootCompressionLevel){
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params_ptr)->ptr;
-    cc_params->SetInteractiveBootCompressionLevel(interactiveBootCompressionLevel);
-}
-
-FFICryptoContextImpl::FFICryptoContextImpl(){
-    cc_ptr = reinterpret_cast<void*>(
-        new CryptoContextImplHolder{std::make_shared<CryptoContextImpl<DCRTPoly>>()});
-}
-
-std::size_t FFICryptoContextImpl::GetKeyGenLevel() const{
-    std::shared_ptr<const CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return cc->GetKeyGenLevel();
-}
-
-void FFICryptoContextImpl::SetKeyGenLevel(std::size_t level){
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<CryptoContextImplHolder*>(cc_ptr)->ptr;
-    cc->SetKeyGenLevel(level);
-}
-
-usint FFICryptoContextImpl::GetRingDimension() const{
-    std::shared_ptr<const CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return cc->GetRingDimension();
-}
-
-FFIPlaintextModulus FFICryptoContextImpl::GetPlaintextModulus() const{
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return FFIPlaintextModulus(GetPlaintextModulusWrapper(cc));
-}
-
-double FFICryptoContextImpl::GetModulus() const {
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return GetModulusWrapper(cc);
-}
-
-const uint64_t FFICryptoContextImpl::GetModulusCKKS() const{
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return GetModulusCKKSWrapper(cc);
-}
-
-double FFICryptoContextImpl::GetScalingFactorReal(uint32_t level) const{
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return GetScalingFactorRealWrapper(cc, level);
-}
-
-lbcrypto::ScalingTechnique FFICryptoContextImpl::GetScalingTechnique() const{
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return GetScalingTechniqueWrapper(cc);
-}
-
-usint FFICryptoContextImpl::GetDigitSize() const{
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return GetDigitSizeWrapper(cc);
-}
-
-usint FFICryptoContextImpl::GetCyclotomicOrder() const{
-    std::shared_ptr<const CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    return cc->GetCyclotomicOrder();
-}
-
-void FFICryptoContextImpl::Enable(lbcrypto::PKESchemeFeature feature) {
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<CryptoContextImplHolder*>(cc_ptr)->ptr;
-    cc->Enable(PKESchemeFeature(feature));
-}
-
-FFIKeyPair FFICryptoContextImpl::KeyGen() const{
-    std::shared_ptr<const CryptoContextImpl<DCRTPoly>> cc =
-    // std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<CryptoContextImplHolder*>(cc_ptr)->ptr;
-    cc->KeyGen();
-    void* keypair_ptr = reinterpret_cast<void*>(
-        new KeyPairHolder{std::make_shared<KeyPair<DCRTPoly>>(cc->KeyGen())});
-    
-    return FFIKeyPair(keypair_ptr);
-}
-
-void FFICryptoContextImpl::EvalMultKeyGen(const FFIPrivateKeyImpl key){
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<CryptoContextImplHolder*>(cc_ptr)->ptr;
-    const std::shared_ptr<PrivateKeyImpl<DCRTPoly>> cc_key = 
-        reinterpret_cast<PrivkeyHolder*>(key.privkey_ptr)->ptr;
-    cc->EvalMultKeyGen(cc_key);
-}
-
-void FFICryptoContextImpl::EvalMultKeysGen(const FFIPrivateKeyImpl key){
-    std::shared_ptr<CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<CryptoContextImplHolder*>(cc_ptr)->ptr;
-    const std::shared_ptr<PrivateKeyImpl<DCRTPoly>> cc_key = 
-        reinterpret_cast<PrivkeyHolder*>(key.privkey_ptr)->ptr;
-    cc->EvalMultKeysGen(cc_key);
-}
-
-FFICiphertext FFICryptoContextImpl::EvalRotate(const FFICiphertext ciphertext, std::int32_t index) const{
-    std::shared_ptr<const CryptoContextImpl<DCRTPoly>> cc =
-        reinterpret_cast<const CryptoContextImplHolder*>(cc_ptr)->ptr;
-    const std::shared_ptr<const CiphertextImpl<DCRTPoly>> cc_ciphertext = 
-        reinterpret_cast<const ConstCiphertextHolder*>(ciphertext.ciphertext_ptr)->ptr;
-    void* ciphertext_ptr = reinterpret_cast<void*>(
-        new CiphertextHolder{cc->EvalRotate(cc_ciphertext, index)});
-    return FFICiphertext(ciphertext_ptr);
-}
-
-// void bind_crypto_context(py::module &m)
-// {
-//     py::class_<CryptoContextImpl<DCRTPoly>, std::shared_ptr<CryptoContextImpl<DCRTPoly>>>(m, "CryptoContext")
-//         .def("EvalRotateKeyGen", &CryptoContextImpl<DCRTPoly>::EvalRotateKeyGen,
-//              cc_EvalRotateKeyGen_docs,
-//              py::arg("privateKey"),
-//              py::arg("indexList"),
-//              py::arg("publicKey") = nullptr)
-//         .def("MakeStringPlaintext", &CryptoContextImpl<DCRTPoly>::MakeStringPlaintext,
-//              cc_MakeStringPlaintext_docs,
-//              py::arg("str"))
-//         .def("MakePackedPlaintext", &CryptoContextImpl<DCRTPoly>::MakePackedPlaintext,
-//              cc_MakePackedPlaintext_docs,
-//              py::arg("value"),
-//              py::arg("noiseScaleDeg") = 1,
-//              py::arg("level") = 0)
-//         .def("MakeCoefPackedPlaintext", &CryptoContextImpl<DCRTPoly>::MakeCoefPackedPlaintext,
-//             cc_MakeCoefPackedPlaintext_docs,
-//             py::arg("value"),
-//             py::arg("noiseScaleDeg ") = 1,
-//             py::arg("level") = 0)
-//         // TODO (Oliveira): allow user to specify different params values
-//         .def("MakeCKKSPackedPlaintext", static_cast<Plaintext (CryptoContextImpl<DCRTPoly>::*)(const std::vector<std::complex<double>> &, size_t, uint32_t, const std::shared_ptr<ParmType>, usint) const>(&CryptoContextImpl<DCRTPoly>::MakeCKKSPackedPlaintext), cc_MakeCKKSPackedPlaintextComplex_docs,
-//              py::arg("value"),
-//              py::arg("scaleDeg") = static_cast<size_t>(1),
-//              py::arg("level") = static_cast<uint32_t>(0),
-//              py::arg("params") = py::none(),
-//              py::arg("slots") = 0)
-//         .def("MakeCKKSPackedPlaintext", static_cast<Plaintext (CryptoContextImpl<DCRTPoly>::*)(const std::vector<double> &, size_t, uint32_t, const std::shared_ptr<ParmType>, usint) const>(&CryptoContextImpl<DCRTPoly>::MakeCKKSPackedPlaintext), cc_MakeCKKSPlaintextReal_docs,
-//              py::arg("value"),
-//              py::arg("scaleDeg") = static_cast<size_t>(1),
-//              py::arg("level") = static_cast<uint32_t>(0),
-//              py::arg("params") = py::none(),
-//              py::arg("slots") = 0)
-//         .def("EvalFastRotationPrecompute", &EvalFastRotationPrecomputeWrapper,
-//             cc_EvalFastRotationPreCompute_docs,
-//             py::arg("ciphertext"))
-//         .def("EvalFastRotation", &EvalFastRotationWrapper,
-//             cc_EvalFastRotation_docs,
-//             py::arg("ciphertext"),
-//             py::arg("index"),
-//             py::arg("m"),
-//             py::arg("digits"))
-//         .def("EvalFastRotationExt", &EvalFastRotationExtWrapper, 
-//             cc_EvalFastRotationExt_docs,
-//             py::arg("ciphertext"),
-//             py::arg("index"),
-//             py::arg("digits"),
-//             py::arg("addFirst"))
-//         .def("EvalAtIndexKeyGen", &CryptoContextImpl<DCRTPoly>::EvalAtIndexKeyGen,
-//             cc_EvalAtIndexKeyGen_docs,
-//             py::arg("privateKey"),
-//             py::arg("indexList"),
-//             py::arg("publicKey") = nullptr)
-//         .def("EvalAtIndex", &CryptoContextImpl<DCRTPoly>::EvalAtIndex,
-//             cc_EvalAtIndex_docs,
-//             py::arg("ciphertext"),
-//             py::arg("index"))
-//         .def("Encrypt", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(const PublicKey<DCRTPoly>, Plaintext) const>
-//             (&CryptoContextImpl<DCRTPoly>::Encrypt),
-//             cc_Encrypt_docs,
-//             py::arg("publicKey"),
-//             py::arg("plaintext"))
-//         .def("Decrypt", static_cast<Plaintext (*)(CryptoContext<DCRTPoly> &, const PrivateKey<DCRTPoly>, ConstCiphertext<DCRTPoly>)>
-//             (&DecryptWrapper), cc_Decrypt_docs,
-//             py::arg("privateKey"),
-//             py::arg("ciphertext"))
-//         .def("Decrypt", static_cast<Plaintext (*)(CryptoContext<DCRTPoly> &, ConstCiphertext<DCRTPoly>, const PrivateKey<DCRTPoly>)>
-//             (&DecryptWrapper), cc_Decrypt_docs,
-//             py::arg("ciphertext"),
-//             py::arg("privateKey"))
-//         .def("KeySwitchGen", &CryptoContextImpl<DCRTPoly>::KeySwitchGen,
-//             cc_KeySwitchGen_docs,
-//             py::arg("oldPrivateKey"),
-//             py::arg("newPrivateKey"))
-//         .def("EvalAdd", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAdd), 
-//             cc_EvalAdd_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalAdd", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAdd), 
-//             cc_EvalAddfloat_docs,
-//             py::arg("ciphertext"),
-//             py::arg("constant"))
-//         //inline Ciphertext<Element> EvalAdd(ConstCiphertext<Element> ciphertext, ConstPlaintext plaintext) const
-//         .def("EvalAdd", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAdd),
-//             cc_EvalAddPlaintext_docs,
-//             py::arg("ciphertext"),
-//             py::arg("plaintext"))
-//         .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAddInPlace),
-//             cc_EvalAddInPlace_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstPlaintext) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAddInPlace),
-//             cc_EvalAddInPlacePlaintext_docs,
-//             py::arg("ciphertext"),
-//             py::arg("plaintext"))
-//         .def("EvalAddInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, Ciphertext<DCRTPoly> &) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAddInPlace),
-//             "",
-//             py::arg("plaintext"),
-//             py::arg("ciphertext"))
-//         .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAddMutable),
-//             cc_EvalAddMutable_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAddMutable),
-//             cc_EvalAddMutablePlaintext_docs,
-//             py::arg("ciphertext"),
-//             py::arg("plaintext"))
-//         .def("EvalAddMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalAddMutable),
-//             "",
-//             py::arg("plaintext"),
-//             py::arg("ciphertext"))
-//         .def("EvalAddMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalAddMutableInPlace,
-//             cc_EvalAddMutableInPlace_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSub),
-//             cc_EvalSub_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSub),
-//             cc_EvalSubfloat_docs,
-//             py::arg("ciphertext"),
-//             py::arg("constant"))
-//         .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(double, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSub),
-//             "",
-//             py::arg("constant"),
-//             py::arg("ciphertext"))
-//         .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSub),
-//             cc_EvalSubPlaintext_docs,
-//             py::arg("ciphertext"),
-//             py::arg("plaintext"))
-//         .def("EvalSub", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSub),
-//             "",
-//             py::arg("plaintext"),
-//             py::arg("ciphertext"))
-//         .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSubInPlace),
-//             cc_EvalSubInPlace_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, double) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSubInPlace),
-//             cc_EvalSubInPlacefloat_docs,
-//             py::arg("ciphertext"),
-//             py::arg("constant"))
-//         .def("EvalSubInPlace", static_cast<void (CryptoContextImpl<DCRTPoly>::*)(double, Ciphertext<DCRTPoly> &) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSubInPlace),
-//             "",
-//             py::arg("constant"),
-//             py::arg("ciphertext"))
-//         .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSubMutable),
-//             cc_EvalSubMutable_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSubMutable),
-//             cc_EvalSubMutablePlaintext_docs,
-//             py::arg("ciphertext"),
-//             py::arg("plaintext"))
-//         .def("EvalSubMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalSubMutable),
-//             "",
-//             py::arg("plaintext"),
-//             py::arg("ciphertext"))
-//IAMHERE:         .def("EvalSubMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalSubMutableInPlace,
-//             cc_EvalSubMutableInPlace_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalMult),
-//             cc_EvalMult_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, double) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalMult),
-//             cc_EvalMultfloat_docs,
-//             py::arg("ciphertext"),
-//             py::arg("constant"))
-//         .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalMult),
-//             cc_EvalMultPlaintext_docs,
-//             py::arg("ciphertext"),
-//             py::arg("plaintext"))
-//         .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstPlaintext, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalMult),
-//             "",
-//             py::arg("plaintext"),
-//             py::arg("ciphertext"))
-//         .def("EvalMult", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(double, ConstCiphertext<DCRTPoly>) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalMult),
-//             "",
-//             py::arg("constant"),
-//             py::arg("ciphertext"))
-//         .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Ciphertext<DCRTPoly> &) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalMultMutable),
-//             cc_EvalMultMutable_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Ciphertext<DCRTPoly> &, Plaintext) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalMultMutable),
-//             cc_EvalMultMutablePlaintext_docs,
-//             py::arg("ciphertext"),
-//             py::arg("plaintext"))
-//         .def("EvalMultMutable", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(Plaintext, Ciphertext<DCRTPoly> &) const>
-//             (&CryptoContextImpl<DCRTPoly>::EvalMultMutable),
-//             "",
-//             py::arg("plaintext"),
-//             py::arg("ciphertext"))
-//         .def("EvalMultMutableInPlace", &CryptoContextImpl<DCRTPoly>::EvalMultMutableInPlace,
-//             cc_EvalMultMutableInPlace_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalSquare", &CryptoContextImpl<DCRTPoly>::EvalSquare,
-//             cc_EvalSquare_docs,
-//             py::arg("ciphertext"))
-//         .def("EvalSquareMutable", &CryptoContextImpl<DCRTPoly>::EvalSquareMutable,
-//             cc_EvalSquareMutable_docs,
-//             py::arg("ciphertext"))
-//         .def("EvalSquareInPlace", &CryptoContextImpl<DCRTPoly>::EvalSquareInPlace,
-//             cc_EvalSquareInPlace_docs,
-//             py::arg("ciphertext"))
-//         .def("EvalMultNoRelin", &CryptoContextImpl<DCRTPoly>::EvalMultNoRelin,
-//             cc_EvalMultNoRelin_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("Relinearize", &CryptoContextImpl<DCRTPoly>::Relinearize,
-//             cc_Relinearize_docs,
-//             py::arg("ciphertext"))
-//         .def("RelinearizeInPlace", &CryptoContextImpl<DCRTPoly>::RelinearizeInPlace,
-//             cc_RelinearizeInPlace_docs,
-//             py::arg("ciphertext"))
-//         .def("EvalMultAndRelinearize", &CryptoContextImpl<DCRTPoly>::EvalMultAndRelinearize,
-//             cc_EvalMultAndRelinearize_docs,
-//             py::arg("ciphertext1"),
-//             py::arg("ciphertext2"))
-//         .def("EvalNegate", &CryptoContextImpl<DCRTPoly>::EvalNegate,
-//             cc_EvalNegate_docs,
-//             py::arg("ciphertext"))
-//         .def("EvalNegateInPlace", &CryptoContextImpl<DCRTPoly>::EvalNegateInPlace,
-//             cc_EvalNegateInPlace_docs,
-//             py::arg("ciphertext"))
-//         .def("EvalLogistic", &CryptoContextImpl<DCRTPoly>::EvalLogistic,
-//             cc_EvalLogistic_docs,
-//             py::arg("ciphertext"),
-//             py::arg("a"),
-//             py::arg("b"),
-//             py::arg("degree"))
-//         .def("EvalChebyshevSeries", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeries,
-//             cc_EvalChebyshevSeries_docs,
-//             py::arg("ciphertext"),
-//             py::arg("coefficients"),
-//             py::arg("a"),
-//             py::arg("b"))
-//         .def("EvalChebyshevSeriesLinear", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeriesLinear,
-//             cc_EvalChebyshevSeriesLinear_docs,
-//             py::arg("ciphertext"),
-//             py::arg("coefficients"),
-//             py::arg("a"),
-//             py::arg("b"))
-//         .def("EvalChebyshevSeriesPS", &CryptoContextImpl<DCRTPoly>::EvalChebyshevSeriesPS,
-//             cc_EvalChebyshevSeriesPS_docs,
-//             py::arg("ciphertext"),
-//             py::arg("coefficients"),
-//             py::arg("a"),
-//             py::arg("b"))
-//         .def("EvalChebyshevFunction", &CryptoContextImpl<DCRTPoly>::EvalChebyshevFunction,
-//             cc_EvalChebyshevFunction_docs,
-//              py::arg("func"),
-//              py::arg("ciphertext"),
-//              py::arg("a"),
-//              py::arg("b"),
-//              py::arg("degree"))
-//         .def("EvalSin", &CryptoContextImpl<DCRTPoly>::EvalSin,
-//              cc_EvalSin_docs,
-//              py::arg("ciphertext"),
-//              py::arg("a"),
-//              py::arg("b"),
-//              py::arg("degree"))
-//         .def("EvalCos", &CryptoContextImpl<DCRTPoly>::EvalCos,
-//              cc_EvalCos_docs,
-//              py::arg("ciphertext"),
-//              py::arg("a"),
-//              py::arg("b"),
-//              py::arg("degree"))
-//         .def("EvalDivide", &CryptoContextImpl<DCRTPoly>::EvalDivide,
-//              cc_EvalDivide_docs,
-//              py::arg("ciphertext"),
-//              py::arg("a"),
-//              py::arg("b"),
-//              py::arg("degree"))
-//         .def("EvalSumKeyGen", &CryptoContextImpl<DCRTPoly>::EvalSumKeyGen,
-//              cc_EvalSumKeyGen_docs,
-//              py::arg("privateKey"),
-//              py::arg("publicKey") = py::none())
-//         //TODO (Oliveira, R.): Solve pointer handling bug when dealing with EvalKeyMap object for the next functions 
-//         .def("EvalSumRowsKeyGen", &CryptoContextImpl<DCRTPoly>::EvalSumRowsKeyGen,
-//              cc_EvalSumRowsKeyGen_docs,
-//              py::arg("privateKey"),
-//              py::arg("publicKey") = py::none(),
-//              py::arg("rowSize") = 0,
-//              py::arg("subringDim") = 0)
-//         .def("EvalSumColsKeyGen", &CryptoContextImpl<DCRTPoly>::EvalSumColsKeyGen,
-//              cc_EvalSumColsKeyGen_docs,
-//              py::arg("privateKey"),
-//              py::arg("publicKey") = py::none())
-//         .def("EvalSum", &CryptoContextImpl<DCRTPoly>::EvalSum,
-//              cc_EvalSum_docs,
-//              py::arg("ciphertext"),
-//              py::arg("batchSize"))
-//         .def("EvalSumRows", &CryptoContextImpl<DCRTPoly>::EvalSumRows,
-//              cc_EvalSumRows_docs,
-//              py::arg("ciphertext"),
-//              py::arg("rowSize"),
-//              py::arg("evalSumKeyMap"),
-//              py::arg("subringDim") = 0)
-//         .def("EvalSumCols", &CryptoContextImpl<DCRTPoly>::EvalSumCols,
-//              cc_EvalSumCols_docs,
-//              py::arg("ciphertext"),
-//              py::arg("rowSize"),
-//              py::arg("evalSumKeyMap"))
-//         .def("EvalInnerProduct", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstCiphertext<DCRTPoly>, usint) const>(&CryptoContextImpl<DCRTPoly>::EvalInnerProduct),
-//              cc_EvalInnerProduct_docs,
-//              py::arg("ciphertext1"),
-//              py::arg("ciphertext2"),
-//              py::arg("batchSize"))
-//         .def("EvalInnerProduct", static_cast<Ciphertext<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(ConstCiphertext<DCRTPoly>, ConstPlaintext, usint) const>(&CryptoContextImpl<DCRTPoly>::EvalInnerProduct),
-//              cc_EvalInnerProductPlaintext_docs,
-//              py::arg("ciphertext"),
-//              py::arg("plaintext"),
-//              py::arg("batchSize"))
-//         .def("MultipartyKeyGen", static_cast<KeyPair<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(const PublicKey<DCRTPoly>, bool, bool)>(&CryptoContextImpl<DCRTPoly>::MultipartyKeyGen),
-//              cc_MultipartyKeyGen_docs,
-//              py::arg("publicKey"),
-//              py::arg("makeSparse") = false,
-//              py::arg("fresh") = false)
-//         .def("MultipartyKeyGen", static_cast<KeyPair<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(const std::vector<PrivateKey<DCRTPoly>> &)>(&CryptoContextImpl<DCRTPoly>::MultipartyKeyGen),
-//              cc_MultipartyKeyGen_vector_docs,
-//              py::arg("privateKeyVec"))
-//         .def("MultipartyDecryptLead", &CryptoContextImpl<DCRTPoly>::MultipartyDecryptLead,
-//              cc_MultipartyDecryptLead_docs,
-//              py::arg("ciphertextVec"),
-//              py::arg("privateKey"))
-//         .def("MultipartyDecryptMain", &CryptoContextImpl<DCRTPoly>::MultipartyDecryptMain,
-//             cc_MultipartyDecryptMain_docs,
-//             py::arg("ciphertextVec"),
-//             py::arg("privateKey"))
-//         .def("MultipartyDecryptFusion", &MultipartyDecryptFusionWrapper,
-//             cc_MultipartyDecryptFusion_docs,
-//             py::arg("ciphertextVec"))
-//         .def("MultiKeySwitchGen", &CryptoContextImpl<DCRTPoly>::MultiKeySwitchGen,
-//              cc_MultiKeySwitchGen_docs,
-//              py::arg("originalPrivateKey"),
-//              py::arg("newPrivateKey"),
-//              py::arg("evalKey"))
-//         .def("MultiEvalSumKeyGen", &CryptoContextImpl<DCRTPoly>::MultiEvalSumKeyGen,
-//              cc_MultiEvalSumKeyGen_docs,
-//              py::arg("privateKey"),
-//              py::arg("evalKeyMap"),
-//              py::arg("keyId") = "")
-//         .def("MultiAddEvalKeys", &CryptoContextImpl<DCRTPoly>::MultiAddEvalKeys,
-//              cc_MultiAddEvalKeys_docs,
-//              py::arg("evalKey1"),
-//              py::arg("evalKey2"),
-//              py::arg("keyId") = "")
-//         .def("MultiAddEvalMultKeys", &CryptoContextImpl<DCRTPoly>::MultiAddEvalMultKeys,
-//              cc_MultiAddEvalMultKeys_docs,
-//              py::arg("evalKey1"),
-//              py::arg("evalKey2"),
-//              py::arg("keyId") = "")
-//         .def("IntMPBootAdjustScale",&CryptoContextImpl<DCRTPoly>::IntMPBootAdjustScale,
-//              cc_IntMPBootAdjustScale_docs,
-//              py::arg("ciphertext"))
-//         .def("IntMPBootRandomElementGen", &CryptoContextImpl<DCRTPoly>::IntMPBootRandomElementGen,
-//              cc_IntMPBootRandomElementGen_docs,
-//              py::arg("publicKey"))
-//         .def("IntMPBootDecrypt", &CryptoContextImpl<DCRTPoly>::IntMPBootDecrypt,
-//              cc_IntMPBootDecrypt_docs,
-//              py::arg("privateKey"),
-//              py::arg("ciphertext"),
-//              py::arg("a"))
-//         .def("IntMPBootAdd", &CryptoContextImpl<DCRTPoly>::IntMPBootAdd,
-//              cc_IntMPBootAdd_docs,
-//              py::arg("sharePairVec"))
-//         .def("IntMPBootEncrypt", &CryptoContextImpl<DCRTPoly>::IntMPBootEncrypt,
-//              cc_IntMPBootEncrypt_docs,
-//              py::arg("publicKey"),
-//              py::arg("sharePair"),
-//              py::arg("a"),
-//              py::arg("ciphertext"))             
-//         .def("MultiMultEvalKey", &CryptoContextImpl<DCRTPoly>::MultiMultEvalKey,
-//              cc_MultiMultEvalKey_docs,
-//              py::arg("privateKey"),
-//              py::arg("evalKey"),
-//              py::arg("keyId") = "")
-//         .def("MultiAddEvalSumKeys", &CryptoContextImpl<DCRTPoly>::MultiAddEvalSumKeys,
-//              cc_MultiAddEvalSumKeys_docs,
-//              py::arg("evalKeyMap1"),
-//              py::arg("evalKeyMap2"),
-//              py::arg("keyId") = "")
-//         .def("EvalMerge", &CryptoContextImpl<DCRTPoly>::EvalMerge,
-//              cc_EvalMerge_docs,
-//              py::arg("ciphertextVec"))
-//              // use static_cast: inline EvalKey<Element> ReKeyGen(const PrivateKey<Element> oldPrivateKey, const PublicKey<Element> newPublicKey) const;
-//         .def("ReKeyGen", static_cast<EvalKey<DCRTPoly> (CryptoContextImpl<DCRTPoly>::*)(const PrivateKey<DCRTPoly>, const PublicKey<DCRTPoly>) const>(&CryptoContextImpl<DCRTPoly>::ReKeyGen),
-//              cc_ReKeyGen_docs,
-//              py::arg("oldPrivateKey"),
-//              py::arg("newPublicKey"))
-//         .def("ReEncrypt", &CryptoContextImpl<DCRTPoly>::ReEncrypt,
-//              cc_ReEncrypt_docs,
-//              py::arg("ciphertext"),
-//              py::arg("evalKey"),
-//              py::arg("publicKey") = nullptr)
-//         .def("EvalPoly", &CryptoContextImpl<DCRTPoly>::EvalPoly,
-//              cc_EvalPoly_docs,
-//              py::arg("ciphertext"),
-//              py::arg("coefficients"))
-//         .def("EvalPolyLinear", &CryptoContextImpl<DCRTPoly>::EvalPolyLinear,
-//              cc_EvalPolyLinear_docs,
-//              py::arg("ciphertext"),
-//              py::arg("coefficients"))
-//         .def("EvalPolyPS", &CryptoContextImpl<DCRTPoly>::EvalPolyPS,
-//              cc_EvalPolyPS_docs,
-//              py::arg("ciphertext"),
-//              py::arg("coefficients"))
-//         .def("Rescale", &CryptoContextImpl<DCRTPoly>::Rescale,
-//              cc_Rescale_docs,
-//              py::arg("ciphertext"))
-//         .def("RescaleInPlace", &CryptoContextImpl<DCRTPoly>::RescaleInPlace,
-//              cc_RescaleInPlace_docs,
-//              py::arg("ciphertext"))
-//         .def("ModReduce", &CryptoContextImpl<DCRTPoly>::ModReduce,
-//              cc_ModReduce_docs,
-//              py::arg("ciphertext"))
-//         .def("ModReduceInPlace", &CryptoContextImpl<DCRTPoly>::ModReduceInPlace,
-//              cc_ModReduceInPlace_docs,
-//              py::arg("ciphertext"))
-//         .def("EvalBootstrapSetup", &CryptoContextImpl<DCRTPoly>::EvalBootstrapSetup,
-//              cc_EvalBootstrapSetup_docs,
-//              py::arg("levelBudget") = std::vector<uint32_t>({5, 4}),
-//              py::arg("dim1") = std::vector<uint32_t>({0, 0}),
-//              py::arg("slots") = 0,
-//              py::arg("correctionFactor") = 0,
-//              py::arg("precompute")= true)
-//         .def("EvalBootstrapKeyGen", &CryptoContextImpl<DCRTPoly>::EvalBootstrapKeyGen,
-//              cc_EvalBootstrapKeyGen_docs,
-//              py::arg("privateKey"),
-//              py::arg("slots"))
-//         .def("EvalBootstrap", &CryptoContextImpl<DCRTPoly>::EvalBootstrap,
-//              cc_EvalBootstrap_docs,
-//              py::arg("ciphertext"),
-//              py::arg("numIterations") = 1,
-//              py::arg("precision") = 0)
-//         .def("EvalCKKStoFHEWSetup", &CryptoContextImpl<DCRTPoly>::EvalCKKStoFHEWSetup,
-//             cc_EvalCKKStoFHEWSetup_docs,
-//             py::arg("schswchparams"))
-//         .def("EvalCKKStoFHEWKeyGen", &CryptoContextImpl<DCRTPoly>::EvalCKKStoFHEWKeyGen,
-//              cc_EvalCKKStoFHEWKeyGen_docs,
-//              py::arg("keyPair"),
-//              py::arg("lwesk"))
-//         .def("EvalCKKStoFHEWPrecompute", &CryptoContextImpl<DCRTPoly>::EvalCKKStoFHEWPrecompute,
-//              cc_EvalCKKStoFHEWPrecompute_docs,
-//              py::arg("scale") = 1.0)
-//         .def("EvalCKKStoFHEW", &CryptoContextImpl<DCRTPoly>::EvalCKKStoFHEW,
-//              cc_EvalCKKStoFHEW_docs,
-//              py::arg("ciphertext"),
-//              py::arg("numCtxts") = 0)
-//         .def("EvalFHEWtoCKKSSetup", &CryptoContextImpl<DCRTPoly>::EvalFHEWtoCKKSSetup,
-//              cc_EvalFHEWtoCKKSSetup_docs,
-//              py::arg("ccLWE"),
-//              py::arg("numSlotsCKKS") = 0,
-//              py::arg("logQ") = 25)
-//         .def("EvalFHEWtoCKKSKeyGen", &CryptoContextImpl<DCRTPoly>::EvalFHEWtoCKKSKeyGen,
-//              cc_EvalFHEWtoCKKSKeyGen_docs,
-//              py::arg("keyPair"),
-//              py::arg("lwesk"),
-//              py::arg("numSlots") = 0,
-//              py::arg("numCtxts") = 0,
-//              py::arg("dim1") = 0,
-//              py::arg("L") = 0)
-//         .def("EvalFHEWtoCKKS", &CryptoContextImpl<DCRTPoly>::EvalFHEWtoCKKS,
-//              cc_EvalFHEWtoCKKS_docs,
-//              py::arg("LWECiphertexts"),
-//              py::arg("numCtxts") = 0,
-//              py::arg("numSlots") = 0,
-//              py::arg("p") = 4,
-//              py::arg("pmin") = 0.0,
-//              py::arg("pmax") = 2.0,
-//              py::arg("dim1") = 0)
-//         .def("EvalSchemeSwitchingSetup", &CryptoContextImpl<DCRTPoly>::EvalSchemeSwitchingSetup,
-//              cc_EvalSchemeSwitchingSetup_docs,
-//              py::arg("schswchparams"))
-//         //void EvalSchemeSwitchingKeyGen(const KeyPair<Element> &keyPair, ConstLWEPrivateKey &lwesk, uint32_t numValues = 0, bool oneHot = true, bool alt = false, uint32_t dim1CF = 0, uint32_t dim1FC = 0, uint32_t LCF = 1, uint32_t LFC = 0)
-//         .def("EvalSchemeSwitchingKeyGen", &CryptoContextImpl<DCRTPoly>::EvalSchemeSwitchingKeyGen,
-//              cc_EvalSchemeSwitchingKeyGen_docs,
-//              py::arg("keyPair"),
-//              py::arg("lwesk"))
-//         .def("EvalCompareSwitchPrecompute", &CryptoContextImpl<DCRTPoly>::EvalCompareSwitchPrecompute,
-//              cc_EvalCompareSwitchPrecompute_docs,
-//              py::arg("pLWE") = 0,
-//              py::arg("scaleSign") = 1.0,
-//              py::arg("unit") = false)
-//         .def("EvalCompareSchemeSwitching", &CryptoContextImpl<DCRTPoly>::EvalCompareSchemeSwitching,
-//              cc_EvalCompareSchemeSwitching_docs,
-//              py::arg("ciphertext1"),
-//              py::arg("ciphertext2"),
-//              py::arg("numCtxts") = 0,
-//              py::arg("numSlots") = 0,
-//              py::arg("pLWE") = 0,
-//              py::arg("scaleSign") = 1.0,
-//              py::arg("unit") = false)
-//         .def("EvalMinSchemeSwitching", &CryptoContextImpl<DCRTPoly>::EvalMinSchemeSwitching,
-//              cc_EvalMinSchemeSwitching_docs,
-//              py::arg("ciphertext"),
-//              py::arg("publicKey"),
-//              py::arg("numValues") = 0,
-//              py::arg("numSlots") = 0,
-//              py::arg("pLWE") = 0,
-//              py::arg("scaleSign") = 1.0)
-//         .def("EvalMinSchemeSwitchingAlt", &CryptoContextImpl<DCRTPoly>::EvalMinSchemeSwitchingAlt,
-//              cc_EvalMinSchemeSwitchingAlt_docs,
-//              py::arg("ciphertext"),
-//              py::arg("publicKey"),
-//              py::arg("numValues") = 0,
-//              py::arg("numSlots") = 0,
-//              py::arg("pLWE") = 0,
-//              py::arg("scaleSign") = 1.0)
-//         .def("EvalMaxSchemeSwitching", &CryptoContextImpl<DCRTPoly>::EvalMaxSchemeSwitching,
-//              cc_EvalMaxSchemeSwitching_docs,
-//              py::arg("ciphertext"),
-//              py::arg("publicKey"),
-//              py::arg("numValues") = 0,
-//              py::arg("numSlots") = 0,
-//              py::arg("pLWE") = 0,
-//              py::arg("scaleSign") = 1.0)
-//         .def("EvalMaxSchemeSwitchingAlt", &CryptoContextImpl<DCRTPoly>::EvalMaxSchemeSwitchingAlt,
-//              cc_EvalMaxSchemeSwitchingAlt_docs,
-//              py::arg("ciphertext"),
-//              py::arg("publicKey"),
-//              py::arg("numValues") = 0,
-//              py::arg("numSlots") = 0,
-//              py::arg("pLWE") = 0,
-//              py::arg("scaleSign") = 1.0)
-//         //TODO (Oliveira, R.): Solve pointer handling bug when returning EvalKeyMap objects for the next functions
-//         .def("EvalAutomorphismKeyGen", &EvalAutomorphismKeyGenWrapper, 
-//             cc_EvalAutomorphismKeyGen_docs,
-//             py::arg("privateKey"),
-//             py::arg("indexList"),
-//             py::return_value_policy::reference_internal)
-//         .def("FindAutomorphismIndex", &CryptoContextImpl<DCRTPoly>::FindAutomorphismIndex,
-//             cc_FindAutomorphismIndex_docs,
-//             py::arg("idx"))
-//         .def("FindAutomorphismIndices", &CryptoContextImpl<DCRTPoly>::FindAutomorphismIndices,
-//             cc_FindAutomorphismIndices_docs,
-//             py::arg("idxList"))
-//         .def_static(
-//             "ClearEvalMultKeys", []()
-//             { CryptoContextImpl<DCRTPoly>::ClearEvalMultKeys(); },
-//             cc_ClearEvalMultKeys_docs)
-//         .def_static(
-//             "InsertEvalSumKey", &CryptoContextImpl<DCRTPoly>::InsertEvalSumKey,
-//             cc_InsertEvalSumKey_docs,
-//             py::arg("evalKeyMap"),
-//             py::arg("keyTag") = "")
-//         .def_static(
-//             "InsertEvalMultKey", &CryptoContextImpl<DCRTPoly>::InsertEvalMultKey,
-//             cc_InsertEvalMultKey_docs,
-//             py::arg("evalKeyVec"))
-//         .def_static(
-//             "ClearEvalAutomorphismKeys", []()
-//             { CryptoContextImpl<DCRTPoly>::ClearEvalAutomorphismKeys(); },
-//             cc_ClearEvalAutomorphismKeys_docs)
-//         .def("GetEvalSumKeyMap", &GetEvalSumKeyMapWrapper,
-//             cc_GetEvalSumKeyMap_docs,
-//             py::return_value_policy::reference)
-//         .def("GetBinCCForSchemeSwitch", &CryptoContextImpl<DCRTPoly>::GetBinCCForSchemeSwitch,
-//         		py::return_value_policy::reference_internal)
-//         .def_static(
-//             "SerializeEvalMultKey", [](const std::string &filename, const SerType::SERBINARY &sertype, std::string id = "")
-//             {
-//                 std::ofstream outfile(filename,std::ios::out | std::ios::binary);
-//                 bool res;
-//                 res = CryptoContextImpl<DCRTPoly>::SerializeEvalMultKey<SerType::SERBINARY>(outfile, sertype, id);
-//                 outfile.close();
-//                 return res; },
-//             cc_SerializeEvalMultKey_docs,
-//             py::arg("filename"), py::arg("sertype"), py::arg("id") = "")
-//         .def_static( // SerializeEvalMultKey - JSON
-//             "SerializeEvalMultKey", [](const std::string &filename, const SerType::SERJSON &sertype, std::string id = "")
-//             {
-//                 std::ofstream outfile(filename,std::ios::out | std::ios::binary);
-//                 bool res;
-//                 res = CryptoContextImpl<DCRTPoly>::SerializeEvalMultKey<SerType::SERJSON>(outfile, sertype, id);
-//                 outfile.close();
-//                 return res; },
-//             cc_SerializeEvalMultKey_docs,
-//             py::arg("filename"), py::arg("sertype"), py::arg("id") = "")
-//         .def_static( // SerializeEvalAutomorphismKey - Binary
-//             "SerializeEvalAutomorphismKey", [](const std::string &filename, const SerType::SERBINARY &sertype, std::string id = "")
-//             {
-//                 std::ofstream outfile(filename,std::ios::out | std::ios::binary);
-//                 bool res;
-//                 res = CryptoContextImpl<DCRTPoly>::SerializeEvalAutomorphismKey<SerType::SERBINARY>(outfile, sertype, id);
-//                 outfile.close();
-//                 return res; },
-//             cc_SerializeEvalAutomorphismKey_docs,
-//             py::arg("filename"), py::arg("sertype"), py::arg("id") = "")
-//         .def_static( // SerializeEvalAutomorphismKey - JSON
-//             "SerializeEvalAutomorphismKey", [](const std::string &filename, const SerType::SERJSON &sertype, std::string id = "")
-//             {
-//                 std::ofstream outfile(filename,std::ios::out | std::ios::binary);
-//                 bool res;
-//                 res = CryptoContextImpl<DCRTPoly>::SerializeEvalAutomorphismKey<SerType::SERJSON>(outfile, sertype, id);
-//                 outfile.close();
-//                 return res; },
-//             cc_SerializeEvalAutomorphismKey_docs,
-//             py::arg("filename"), py::arg("sertype"), py::arg("id") = "")
-//         .def_static("DeserializeEvalMultKey", // DeserializeEvalMultKey - Binary
-//         [](const std::string &filename, const SerType::SERBINARY &sertype)
-//                     {
-//                         std::ifstream emkeys(filename, std::ios::in | std::ios::binary);
-//                          if (!emkeys.is_open()) {
-//                             std::cerr << "I cannot read serialization from " << filename << std::endl;
-//                          }
-//                         bool res;
-//                         res = CryptoContextImpl<DCRTPoly>::DeserializeEvalMultKey<SerType::SERBINARY>(emkeys, sertype);
-//                         return res; 
-                        
-//                         },
-//                         cc_DeserializeEvalMultKey_docs,
-//                         py::arg("filename"), py::arg("sertype"))
-//         .def_static("DeserializeEvalMultKey", // DeserializeEvalMultKey - JSON
-//         [](const std::string &filename, const SerType::SERJSON &sertype)
-//                     {
-//                         std::ifstream emkeys(filename, std::ios::in | std::ios::binary);
-//                          if (!emkeys.is_open()) {
-//                             std::cerr << "I cannot read serialization from " << filename << std::endl;
-//                          }
-//                         bool res;
-//                         res = CryptoContextImpl<DCRTPoly>::DeserializeEvalMultKey<SerType::SERJSON>(emkeys, sertype);
-//                         return res; },
-//                         cc_DeserializeEvalMultKey_docs,
-//                         py::arg("filename"), py::arg("sertype"))
-//         .def_static("DeserializeEvalAutomorphismKey", // DeserializeEvalAutomorphismKey - Binary
-//         [](const std::string &filename, const SerType::SERBINARY &sertype)
-//                     {
-//                         std::ifstream erkeys(filename, std::ios::in | std::ios::binary);
-//                          if (!erkeys.is_open()) {
-//                             std::cerr << "I cannot read serialization from " << filename << std::endl;
-//                          }
-//                         bool res;
-//                         res = CryptoContextImpl<DCRTPoly>::DeserializeEvalAutomorphismKey<SerType::SERBINARY>(erkeys, sertype);
-//                         return res; },
-//                         cc_DeserializeEvalAutomorphismKey_docs,
-//                         py::arg("filename"), py::arg("sertype"))
-//         .def_static("DeserializeEvalAutomorphismKey", // DeserializeEvalAutomorphismKey - JSON
-//         [](const std::string &filename, const SerType::SERJSON &sertype)
-//                     {
-//                         std::ifstream erkeys(filename, std::ios::in | std::ios::binary);
-//                          if (!erkeys.is_open()) {
-//                             std::cerr << "I cannot read serialization from " << filename << std::endl;
-//                          }
-//                         bool res;
-//                         res = CryptoContextImpl<DCRTPoly>::DeserializeEvalAutomorphismKey<SerType::SERJSON>(erkeys, sertype);
-//                         return res; },
-//                         cc_DeserializeEvalAutomorphismKey_docs,
-//                         py::arg("filename"), py::arg("sertype"));
-
-FFICryptoContextImpl GenCryptoContext(FFIParams params){
-    FFISCHEME scheme = params.GetScheme();
-    std::shared_ptr<Params> cc_params =
-        reinterpret_cast<ParamsHolder*>(params.params_ptr)->ptr;
-
-    FFICryptoContextImpl cc;
-
-    switch(scheme){
-        case FFISCHEME::BFVRNS_SCHEME:{
-            CCParams<CryptoContextBFVRNS> bfv_cc_params_instance = CCParams<CryptoContextBFVRNS>(*cc_params);
-
-            cc.cc_ptr = reinterpret_cast<void*>(
-                new CryptoContextImplHolder{GenCryptoContext<CryptoContextBFVRNS>(
-                    bfv_cc_params_instance)});
-            break;
-        }
-        case FFISCHEME::BGVRNS_SCHEME:{
-            CCParams<CryptoContextBGVRNS> bgv_cc_params_instance = CCParams<CryptoContextBGVRNS>(*cc_params);
-
-            cc.cc_ptr = reinterpret_cast<void*>(
-                new CryptoContextImplHolder{GenCryptoContext<CryptoContextBGVRNS>(
-                    bgv_cc_params_instance)});
-            break;
-        }
-        case FFISCHEME::CKKSRNS_SCHEME:{
-            CCParams<CryptoContextCKKSRNS> ckks_cc_params_instance = CCParams<CryptoContextCKKSRNS>(*cc_params);
-
-            cc.cc_ptr = reinterpret_cast<void*>(
-                new CryptoContextImplHolder{GenCryptoContext<CryptoContextCKKSRNS>(
-                    ckks_cc_params_instance)});
-            break;
-        }
-        case FFISCHEME::INVALID_SCHEME:
-        default:
-            throw std::invalid_argument("Invalid scheme");
-    }
-
-    return cc;
-}
-
-// int get_native_int(){
-//     #if NATIVEINT == 128 && !defined(__EMSCRIPTEN__)
-//         return 128;
-//     #else
-//         return 64;    
-//     #endif
-// }
-
-// void bind_enums_and_constants(py::module &m)
-// {
-//     /* ---- PKE enums ---- */ 
-//     // Plaintext enums
-//     py::enum_<Format>(m, "Format")
-//         .value("EVALUATION", Format::EVALUATION)
-//         .value("COEFFICIENT", Format::COEFFICIENT);
-//     m.attr("EVALUATION") = py::cast(Format::EVALUATION);
-//     m.attr("COEFFICIENT") = py::cast(Format::COEFFICIENT);
-//     // Serialization Types
-//     py::class_<SerType::SERJSON>(m, "SERJSON");
-//     py::class_<SerType::SERBINARY>(m, "SERBINARY");
-//     m.attr("JSON") = py::cast(SerType::JSON);
-//     m.attr("BINARY") = py::cast(SerType::BINARY);
-
-//     /* ---- CORE enums ---- */     
-//     //Parameters Type
-//     /*TODO (Oliveira): If we expose Poly's and ParmType, this block will go somewhere else */
-//     using ParmType = typename DCRTPoly::Params;
-//     py::class_<ParmType, std::shared_ptr<ParmType>>(m, "ParmType");
-
-//     //NATIVEINT function
-//     m.def("get_native_int", &get_native_int);
-  
-    
-// }
-
-FFIPublicKeyImpl::FFIPublicKeyImpl(){
-    pubkey_ptr = reinterpret_cast<void*>(
-        new PubkeyHolder{std::make_shared<PublicKeyImpl<DCRTPoly>>()});
-}
-
-FFIPublicKeyImpl::FFIPublicKeyImpl(void * newpubkey_ptr){
-    pubkey_ptr = newpubkey_ptr;
-}
-
-void FFIPublicKeyImpl::SetKeyTag(const char*& tag){
-    std::shared_ptr<PublicKeyImpl<DCRTPoly>> pubkey =
-        reinterpret_cast<PubkeyHolder*>(pubkey_ptr)->ptr;
-    pubkey->SetKeyTag(tag);
-}
-
-const char* FFIPublicKeyImpl::GetKeyTag() const{
-    std::shared_ptr<const PublicKeyImpl<DCRTPoly>> pubkey =
-        reinterpret_cast<PubkeyHolder*>(pubkey_ptr)->ptr;
-    return pubkey->GetKeyTag().c_str();
-}
-
-FFIPrivateKeyImpl::FFIPrivateKeyImpl(){
-    privkey_ptr = reinterpret_cast<void*>(
-        new PrivkeyHolder{std::make_shared<PrivateKeyImpl<DCRTPoly>>()});
-}
-
-FFIPrivateKeyImpl::FFIPrivateKeyImpl(void * newprivkey_ptr){
-    privkey_ptr = newprivkey_ptr;
-}
-
-void FFIPrivateKeyImpl::SetKeyTag(const char*& tag){
-    std::shared_ptr<PrivateKeyImpl<DCRTPoly>> privkey =
-        reinterpret_cast<PrivkeyHolder*>(privkey_ptr)->ptr;
-    privkey->SetKeyTag(tag);
-}
-
-const char* FFIPrivateKeyImpl::GetKeyTag() const{
-    std::shared_ptr<const PrivateKeyImpl<DCRTPoly>> privkey =
-        reinterpret_cast<PrivkeyHolder*>(privkey_ptr)->ptr;
-    return privkey->GetKeyTag().c_str();
-}
-
-FFIKeyPair::FFIKeyPair(){
-    keypair_ptr = reinterpret_cast<void*>(
-        new KeyPairHolder{std::make_shared<KeyPair<DCRTPoly>>()});
-}
-
-FFIKeyPair::FFIKeyPair(const FFIPublicKeyImpl& pubkey, const FFIPrivateKeyImpl& privkey){
-    keypair_ptr = reinterpret_cast<void*>(
-        new KeyPairHolder{std::make_shared<KeyPair<DCRTPoly>>(
-            reinterpret_cast<PubkeyHolder*>(pubkey.pubkey_ptr)->ptr,
-            reinterpret_cast<PrivkeyHolder*>(privkey.privkey_ptr)->ptr)});
-}
-
-bool FFIKeyPair::is_allocated() const{
-    std::shared_ptr<const KeyPair<DCRTPoly>> keypair =
-        reinterpret_cast<KeyPairHolder*>(keypair_ptr)->ptr;
-    return keypair->is_allocated();
-}
-
-FFIPublicKeyImpl FFIKeyPair::GetPublicKey() const{
-    std::shared_ptr<const KeyPair<DCRTPoly>> keypair =
-        reinterpret_cast<KeyPairHolder*>(keypair_ptr)->ptr;
-
-    void* pubkey_ptr = 
-        reinterpret_cast<void*>(
-            new PubkeyHolder{std::make_shared<PublicKeyImpl<DCRTPoly>>(*(keypair->publicKey))});
-    return FFIPublicKeyImpl{pubkey_ptr};
-}
-
-FFIPrivateKeyImpl FFIKeyPair::GetPrivateKey() const{
-    std::shared_ptr<const KeyPair<DCRTPoly>> keypair =
-        reinterpret_cast<KeyPairHolder*>(keypair_ptr)->ptr;
-
-    void* privkey_ptr = 
-        reinterpret_cast<void*>(
-            new PrivkeyHolder{std::make_shared<PrivateKeyImpl<DCRTPoly>>(*(keypair->secretKey))});
-    return FFIPrivateKeyImpl{privkey_ptr};
-}
-
-// void bind_keys(py::module &m)
-// {
-//     py::class_<EvalKeyImpl<DCRTPoly>, std::shared_ptr<EvalKeyImpl<DCRTPoly>>>(m, "EvalKey")
-//     .def(py::init<>())
-//         .def("GetKeyTag", &EvalKeyImpl<DCRTPoly>::GetKeyTag)
-//         .def("SetKeyTag", &EvalKeyImpl<DCRTPoly>::SetKeyTag);
-//     py::class_<std::map<usint, EvalKey<DCRTPoly>>, std::shared_ptr<std::map<usint, EvalKey<DCRTPoly>>>>(m, "EvalKeyMap")
-//         .def(py::init<>());
-// }
-
-double FFIPlaintext::GetScalingFactor() const{
-    std::shared_ptr<const PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    return plaintext->GetScalingFactor();
-}
-
-void FFIPlaintext::SetScalingFactor(double sf){
-    std::shared_ptr<PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    plaintext->SetScalingFactor(sf);
-}
-
-FFISCHEME FFIPlaintext::GetSchemeID() const{
-    std::shared_ptr<const PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    return FFISCHEME(plaintext->GetSchemeID());
-}
-
-std::size_t FFIPlaintext::GetLength() const{
-    std::shared_ptr<const PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    return plaintext->GetLength();
-}
-
-void FFIPlaintext::SetLength(std::size_t newSize){
-    std::shared_ptr<PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    plaintext->SetLength(newSize);
-}
-
-bool FFIPlaintext::IsEncoded() const{
-    std::shared_ptr<const PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    return plaintext->IsEncoded();
-}
-
-double FFIPlaintext::GetLogPrecision() const{
-    std::shared_ptr<const PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    return plaintext->GetLogPrecision();
-}
-
-void FFIPlaintext::Encode(){
-    std::shared_ptr<PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    plaintext->Encode();
-}
-
-void FFIPlaintext::Decode(){
-    std::shared_ptr<PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    plaintext->Decode();
-}
-
-std::int64_t FFIPlaintext::LowBound() const{
-    std::shared_ptr<const PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    return plaintext->LowBound();
-}
-
-std::int64_t FFIPlaintext::HighBound() const{
-    std::shared_ptr<const PlaintextImpl> plaintext =
-        reinterpret_cast<PlaintextHolder*>(plaintext_ptr)->ptr;
-    return plaintext->HighBound();
-}
-
-// void bind_encodings(py::module &m)
-// {
-//     py::class_<PlaintextImpl, std::shared_ptr<PlaintextImpl>>(m, "Plaintext")
-//         .def("SetFormat", &PlaintextImpl::SetFormat,
-//             ptx_SetFormat_docs,
-//             py::arg("fmt"))
-//         .def("GetPackedValue", &PlaintextImpl::GetPackedValue)
-//         .def("GetCKKSPackedValue", &PlaintextImpl::GetCKKSPackedValue,
-//             ptx_GetCKKSPackedValue_docs)
-//         .def("GetRealPackedValue", &PlaintextImpl::GetRealPackedValue,
-//             ptx_GetRealPackedValue_docs)
-//         .def("GetLevel", &PlaintextImpl::GetLevel)
-//         .def("SetLevel", &PlaintextImpl::SetLevel)
-//         .def("GetNoiseScaleDeg", &PlaintextImpl::GetNoiseScaleDeg)
-//         .def("SetNoiseScaleDeg", &PlaintextImpl::SetNoiseScaleDeg)
-//         .def("GetSlots", &PlaintextImpl::GetSlots)
-//         .def("SetSlots", &PlaintextImpl::SetSlots)
-//         .def("GetLogError", &PlaintextImpl::GetLogError)
-//         .def("GetLogPrecision", &PlaintextImpl::GetLogPrecision)
-//         .def("GetStringValue", &PlaintextImpl::GetStringValue)
-//         .def("SetStringValue", &PlaintextImpl::SetStringValue)
-//         .def("SetIntVectorValue", &PlaintextImpl::SetIntVectorValue)
-//         .def("__repr__", [](const PlaintextImpl &p)
-//              {
-//         std::stringstream ss;
-//         ss << "<Plaintext Object: ";
-//         p.PrintValue(ss);
-//         ss << ">";
-//         return ss.str(); })
-//         .def("__str__", [](const PlaintextImpl &p)
-//              {
-//         std::stringstream ss;
-//         p.PrintValue(ss);
-//         return ss.str(); });
-// }
-
-FFICiphertext::FFICiphertext(){
-    ciphertext_ptr = reinterpret_cast<void*>(
-        new CiphertextHolder{std::make_shared<CiphertextImpl<DCRTPoly>>()});
-}
-
-std::size_t FFICiphertext::GetLevel() const{
-    std::shared_ptr<const CiphertextImpl<DCRTPoly>> ciphertext =
-        reinterpret_cast<CiphertextHolder*>(ciphertext_ptr)->ptr;
-    return ciphertext->GetLevel();
-}
-
-void FFICiphertext::SetLevel(std::size_t level){
-    std::shared_ptr<CiphertextImpl<DCRTPoly>> ciphertext =
-        reinterpret_cast<CiphertextHolder*>(ciphertext_ptr)->ptr;
-    ciphertext->SetLevel(level);
-}
-
-FFICiphertext FFICiphertext::Clone() const{
-    std::shared_ptr<CiphertextImpl<DCRTPoly>> ciphertext =
-        reinterpret_cast<CiphertextHolder*>(ciphertext_ptr)->ptr;
-    void* new_ciphertext_ptr =
-        reinterpret_cast<void*>(
-            new CiphertextHolder{ciphertext->Clone()});
-    return FFICiphertext{new_ciphertext_ptr};
-}
-
-std::size_t FFICiphertext::GetSlots() const{
-    std::shared_ptr<const CiphertextImpl<DCRTPoly>> ciphertext =
-        reinterpret_cast<CiphertextHolder*>(ciphertext_ptr)->ptr;
-    return ciphertext->GetSlots();
-}
-
-void FFICiphertext::SetSlots(std::size_t slots){
-    std::shared_ptr<CiphertextImpl<DCRTPoly>> ciphertext =
-        reinterpret_cast<CiphertextHolder*>(ciphertext_ptr)->ptr;
-    ciphertext->SetSlots(slots);
-}
-
-// void bind_schemes(py::module &m){
-//     /*Bind schemes specific functionalities like bootstrapping functions and multiparty*/
-//     py::class_<FHECKKSRNS>(m, "FHECKKSRNS")
-//         .def(py::init<>())
-//         //.def_static("GetBootstrapDepth", &FHECKKSRNS::GetBootstrapDepth)
-//         .def_static("GetBootstrapDepth", static_cast<uint32_t (*)(uint32_t, const std::vector<uint32_t>&, SecretKeyDist)>(&FHECKKSRNS::GetBootstrapDepth))
-//         .def_static("GetBootstrapDepth", static_cast<uint32_t (*)(const std::vector<uint32_t>&, SecretKeyDist)>(&FHECKKSRNS::GetBootstrapDepth));                               
-    
-// }
-
-// void bind_sch_swch_params(py::module &m)
-// {
-//     py::class_<SchSwchParams>(m, "SchSwchParams")
-//         .def(py::init<>())
-//         .def("GetSecurityLevelCKKS", &SchSwchParams::GetSecurityLevelCKKS)
-//         .def("GetSecurityLevelFHEW", &SchSwchParams::GetSecurityLevelFHEW)
-//         .def("GetArbitraryFunctionEvaluation", &SchSwchParams::GetArbitraryFunctionEvaluation)
-//         .def("GetUseDynamicModeFHEW", &SchSwchParams::GetUseDynamicModeFHEW)
-//         .def("GetComputeArgmin", &SchSwchParams::GetComputeArgmin)
-//         .def("GetOneHotEncoding", &SchSwchParams::GetOneHotEncoding)
-//         .def("GetUseAltArgmin", &SchSwchParams::GetUseAltArgmin)
-//         .def("GetNumSlotsCKKS", &SchSwchParams::GetNumSlotsCKKS)
-//         .def("GetNumValues", &SchSwchParams::GetNumValues)
-//         .def("GetCtxtModSizeFHEWLargePrec", &SchSwchParams::GetCtxtModSizeFHEWLargePrec)
-//         .def("GetCtxtModSizeFHEWIntermedSwch", &SchSwchParams::GetCtxtModSizeFHEWIntermedSwch)
-//         .def("GetBStepLTrCKKStoFHEW", &SchSwchParams::GetBStepLTrCKKStoFHEW)
-//         .def("GetBStepLTrFHEWtoCKKS", &SchSwchParams::GetBStepLTrFHEWtoCKKS)
-//         .def("GetLevelLTrCKKStoFHEW", &SchSwchParams::GetLevelLTrCKKStoFHEW)
-//         .def("GetLevelLTrFHEWtoCKKS", &SchSwchParams::GetLevelLTrFHEWtoCKKS)
-//         .def("GetInitialCKKSModulus", &SchSwchParams::GetInitialCKKSModulus)
-//         .def("GetRingDimension", &SchSwchParams::GetRingDimension)
-//         .def("GetScalingModSize", &SchSwchParams::GetScalingModSize)
-//         .def("GetBatchSize", &SchSwchParams::GetBatchSize)
-//         .def("SetSecurityLevelCKKS", &SchSwchParams::SetSecurityLevelCKKS)
-//         .def("SetSecurityLevelFHEW", &SchSwchParams::SetSecurityLevelFHEW)
-//         .def("SetArbitraryFunctionEvaluation", &SchSwchParams::SetArbitraryFunctionEvaluation)
-//         .def("SetUseDynamicModeFHEW", &SchSwchParams::SetUseDynamicModeFHEW)
-//         .def("SetComputeArgmin", &SchSwchParams::SetComputeArgmin)
-//         .def("SetOneHotEncoding", &SchSwchParams::SetOneHotEncoding)
-//         .def("SetUseAltArgmin", &SchSwchParams::SetUseAltArgmin)
-//         .def("SetNumSlotsCKKS", &SchSwchParams::SetNumSlotsCKKS)
-//         .def("SetNumValues", &SchSwchParams::SetNumValues)
-//         .def("SetCtxtModSizeFHEWLargePrec", &SchSwchParams::SetCtxtModSizeFHEWLargePrec)
-//         .def("SetCtxtModSizeFHEWIntermedSwch", &SchSwchParams::SetCtxtModSizeFHEWIntermedSwch)
-//         .def("SetBStepLTrCKKStoFHEW", &SchSwchParams::SetBStepLTrCKKStoFHEW)
-//         .def("SetBStepLTrFHEWtoCKKS", &SchSwchParams::SetBStepLTrFHEWtoCKKS)
-//         .def("SetLevelLTrCKKStoFHEW", &SchSwchParams::SetLevelLTrCKKStoFHEW)
-//         .def("SetLevelLTrFHEWtoCKKS", &SchSwchParams::SetLevelLTrFHEWtoCKKS)
-//         .def("SetInitialCKKSModulus", &SchSwchParams::SetInitialCKKSModulus)
-//         .def("SetRingDimension", &SchSwchParams::SetRingDimension)
-//         .def("SetScalingModSize", &SchSwchParams::SetScalingModSize)
-//         .def("SetBatchSize", &SchSwchParams::SetBatchSize)
-//         .def("__str__",[](const SchSwchParams &params) {
-//             std::stringstream stream;
-//             stream << params;
-//             return stream.str();
-//         });
-// }

+ 0 - 149
cpp/src/pke/cryptocontext_wrapper.cpp

@@ -1,149 +0,0 @@
-// BSD 2-Clause License
-
-// Copyright (c) 2023, OpenFHE
-
-// All rights reserved.
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <openfhe.h>
-#include <vector>
-#include <algorithm>
-#include <complex> 
-#include "pke/cryptocontext_wrapper.hpp"
-
-using namespace lbcrypto;
-
-Ciphertext<DCRTPoly> EvalFastRotationPrecomputeWrapper(CryptoContext<DCRTPoly> &self,ConstCiphertext<DCRTPoly> ciphertext) {
-    std::shared_ptr<std::vector<DCRTPoly>> precomp = self->EvalFastRotationPrecompute(ciphertext);
-    std::vector<DCRTPoly> elements = *(precomp.get());
-    CiphertextImpl<DCRTPoly> cipherdigits = CiphertextImpl<DCRTPoly>(self);
-    std::shared_ptr<CiphertextImpl<DCRTPoly>> cipherdigitsPtr = std::make_shared<CiphertextImpl<DCRTPoly>>(cipherdigits);
-    cipherdigitsPtr->SetElements(elements);
-    return cipherdigitsPtr;
-}
-Ciphertext<DCRTPoly> EvalFastRotationWrapper(CryptoContext<DCRTPoly>& self,ConstCiphertext<DCRTPoly> ciphertext, const usint index, const usint m,ConstCiphertext<DCRTPoly> digits) {
-    
-        std::vector<DCRTPoly> digitsElements = digits->GetElements();
-        std::shared_ptr<std::vector<DCRTPoly>> digitsElementsPtr = std::make_shared<std::vector<DCRTPoly>>(digitsElements);
-        return self->EvalFastRotation(ciphertext, index, m, digitsElementsPtr);
-    }
-
-Ciphertext<DCRTPoly> EvalFastRotationExtWrapper(CryptoContext<DCRTPoly>& self,ConstCiphertext<DCRTPoly> ciphertext, const usint index, ConstCiphertext<DCRTPoly> digits, bool addFirst) {
-    std::vector<DCRTPoly> digitsElements = digits->GetElements();
-    std::shared_ptr<std::vector<DCRTPoly>> digitsElementsPtr = std::make_shared<std::vector<DCRTPoly>>(digitsElements);
-    return self->EvalFastRotationExt(ciphertext, index, digitsElementsPtr, addFirst);
-}
-
-
-Plaintext DecryptWrapper(CryptoContext<DCRTPoly>& self,ConstCiphertext<DCRTPoly> ciphertext,const PrivateKey<DCRTPoly> privateKey){
-    Plaintext plaintextDecResult;
-    self->Decrypt(privateKey, ciphertext,&plaintextDecResult);
-    return plaintextDecResult;
-}
-Plaintext DecryptWrapper(CryptoContext<DCRTPoly>& self,const PrivateKey<DCRTPoly> privateKey,ConstCiphertext<DCRTPoly> ciphertext){
-    Plaintext plaintextDecResult;
-    self->Decrypt(privateKey, ciphertext,&plaintextDecResult);
-    return plaintextDecResult;
-}
-
-Plaintext MultipartyDecryptFusionWrapper(CryptoContext<DCRTPoly>& self,const std::vector<Ciphertext<DCRTPoly>>& partialCiphertextVec){
-    Plaintext plaintextDecResult;
-    self->MultipartyDecryptFusion(partialCiphertextVec,&plaintextDecResult);
-    return plaintextDecResult;
-}
-
-const std::map<usint, EvalKey<DCRTPoly>> EvalAutomorphismKeyGenWrapper(CryptoContext<DCRTPoly>& self,const PrivateKey<DCRTPoly> privateKey,const std::vector<usint> &indexList){
-    return *(self->EvalAutomorphismKeyGen(privateKey, indexList));
-}
-
-const std::shared_ptr<std::map<usint, EvalKey<DCRTPoly>>> GetEvalSumKeyMapWrapper(CryptoContext<DCRTPoly>& self,const std::string &id){
-    auto evalSumKeyMap = 
-        std::make_shared<std::map<usint, EvalKey<DCRTPoly>>>(self->GetEvalSumKeyMap(id));
-    return evalSumKeyMap;
-}
-
-const PlaintextModulus GetPlaintextModulusWrapper(CryptoContext<DCRTPoly>& self){
-    return self->GetCryptoParameters()->GetPlaintextModulus();
-}
-
-const double GetModulusWrapper(CryptoContext<DCRTPoly>& self){
-    return self->GetCryptoParameters()->GetElementParams()->GetModulus().ConvertToDouble();
-}
-
-void RemoveElementWrapper(Ciphertext<DCRTPoly> &self, usint index){
-    self->GetElements().erase(self->GetElements().begin()+index);
-}
-const usint GetDigitSizeWrapper(CryptoContext<DCRTPoly>& self){
-    return self->GetCryptoParameters()->GetDigitSize();
-}
-
-const double GetScalingFactorRealWrapper(CryptoContext<DCRTPoly>& self, uint32_t l){
-    if(self->getSchemeId()==SCHEME::CKKSRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersCKKSRNS>(self->GetCryptoParameters());
-        double scFactor = cryptoParams->GetScalingFactorReal(l);
-        return scFactor;
-    }
-    else if(self->getSchemeId()==SCHEME::BFVRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersBFVRNS>(self->GetCryptoParameters());
-        double scFactor = cryptoParams->GetScalingFactorReal(l);
-        return scFactor;
-    }
-    else if(self->getSchemeId()==SCHEME::BGVRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersBGVRNS>(self->GetCryptoParameters());
-        double scFactor = cryptoParams->GetScalingFactorReal(l);
-        return scFactor;
-    }
-    else{
-        OPENFHE_THROW(not_available_error, "GetScalingFactorRealWrapper: Invalid scheme");
-        return 0;
-    }
-}
-
-const uint64_t GetModulusCKKSWrapper(CryptoContext<DCRTPoly> &self)
-{
-
-    const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersCKKSRNS>(self->GetCryptoParameters());
-    ILDCRTParams<DCRTPoly::Integer> elementParams = *(cryptoParams->GetElementParams());
-    auto paramsQ = elementParams.GetParams();
-    uint64_t modulus_CKKS_from = paramsQ[0]->GetModulus().ConvertToInt<uint64_t>();
-    return modulus_CKKS_from;
-}
-
-const ScalingTechnique GetScalingTechniqueWrapper(CryptoContext<DCRTPoly> & self){
-    if(self->getSchemeId()==SCHEME::CKKSRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersCKKSRNS>(self->GetCryptoParameters());
-        return cryptoParams->GetScalingTechnique();
-    }
-    else if(self->getSchemeId()==SCHEME::BFVRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersBFVRNS>(self->GetCryptoParameters());
-        return cryptoParams->GetScalingTechnique();
-    }
-    else if(self->getSchemeId()==SCHEME::BGVRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersBGVRNS>(self->GetCryptoParameters());
-        return cryptoParams->GetScalingTechnique();
-    }
-    else{
-        OPENFHE_THROW(not_available_error, "GetScalingTechniqueWrapper: Invalid scheme");
-    }
-
-}

+ 0 - 85
cpp/src/pke/serialization.cpp

@@ -1,85 +0,0 @@
-// BSD 2-Clause License
-
-// Copyright (c) 2023, OpenFHE
-
-// All rights reserved.
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "openfhe.h"
-#include "utils/exception.h"
-// header files needed for serialization
-#include "pke/serialization.hpp"
-#include "metadata-ser.h"
-#include "ciphertext-ser.h"
-#include "cryptocontext-ser.h"
-#include "key/key-ser.h"
-#include "scheme/bfvrns/bfvrns-ser.h"
-#include "scheme/bgvrns/bgvrns-ser.h"
-#include "scheme/ckksrns/ckksrns-ser.h"
-
-using namespace lbcrypto;
-
-template <typename ST>
-bool SerializeEvalMultKeyWrapper(const std::string &filename, const ST &sertype, std::string id)
-{
-    std::ofstream outfile(filename, std::ios::out | std::ios::binary);
-    bool res;
-    res = CryptoContextImpl<DCRTPoly>::SerializeEvalMultKey<ST>(outfile, sertype, id);
-    outfile.close();
-    return res;
-}
-
-template <typename ST>
-bool SerializeEvalAutomorphismKeyWrapper(const std::string& filename, const ST& sertype, std::string id)
-{
-    std::ofstream outfile(filename, std::ios::out | std::ios::binary);
-    bool res;
-    res = CryptoContextImpl<DCRTPoly>::SerializeEvalAutomorphismKey<ST>(outfile, sertype, id);
-    outfile.close();
-    return res;
-}
-
-template <typename ST>
-bool DeserializeEvalMultKeyWrapper(const std::string &filename, const ST &sertype)
-{
-    std::ifstream emkeys(filename, std::ios::in | std::ios::binary);
-    if (!emkeys.is_open())
-    {
-        std::cerr << "I cannot read serialization from " << filename << std::endl;
-    }
-    bool res;
-    res = CryptoContextImpl<DCRTPoly>::DeserializeEvalMultKey<ST>(emkeys, sertype);
-    return res; }
-
-template <typename T, typename ST>
-std::tuple<T, bool> DeserializeFromFileWrapper(const std::string& filename, const ST& sertype) {
-    T newob;
-    bool result = Serial::DeserializeFromFile<T>(filename, newob, sertype);
-    return std::make_tuple(newob, result);
-}
-template <typename ST>
-std::tuple<CryptoContext<DCRTPoly>, bool> DeserializeCCWrapper(const std::string& filename, const ST& sertype) {
-    CryptoContext<DCRTPoly> newob;
-    bool result = Serial::DeserializeFromFile<DCRTPoly>(filename, newob, sertype);
-    return std::make_tuple(newob, result);
-}

+ 9 - 0
src/direct.cc

@@ -0,0 +1,9 @@
+#include "direct.hpp"
+
+namespace openfhe_rs_dev
+{
+
+// TODO: implementations
+
+} // openfhe_rs_dev
+

+ 258 - 0
src/direct.hpp

@@ -0,0 +1,258 @@
+#pragma once
+
+#include <memory>
+#include <sstream>
+#include "rust/cxx.h" // rust::String
+
+#include "openfhe/pke/scheme/gen-cryptocontext-params.h"
+#include "openfhe/pke/scheme/bfvrns/gen-cryptocontext-bfvrns-params.h"
+#include "openfhe/pke/scheme/bgvrns/gen-cryptocontext-bgvrns-params.h"
+#include "openfhe/pke/scheme/ckksrns/gen-cryptocontext-ckksrns-params.h"
+
+#include "openfhe/pke/gen-cryptocontext.h"
+#include "openfhe/pke/scheme/bfvrns/gen-cryptocontext-bfvrns.h"
+#include "openfhe/pke/scheme/bgvrns/gen-cryptocontext-bgvrns.h"
+#include "openfhe/pke/scheme/ckksrns/gen-cryptocontext-ckksrns.h"
+
+#include "openfhe/pke/scheme/scheme-id.h" // enums
+#include "openfhe/core/lattice/constants-lattice.h" // enums
+#include "openfhe/pke/constants-fwd.h" // enumss
+#include "openfhe/core/lattice/stdlatticeparms.h" // enums
+#include "openfhe/pke/key/keypair.h"
+#include "openfhe/core/utils/inttypes.h"
+
+#include "openfhe/pke/key/keypair.h"
+#include "openfhe/pke/key/privatekey.h"
+#include "openfhe/pke/key/publickey.h"
+
+#include "openfhe/pke/ciphertext.h"
+#include "openfhe/pke/encoding/plaintext.h"
+#include "openfhe/pke/schemebase/decrypt-result.h"
+
+namespace openfhe_rs_dev
+{
+    // Parameter related stuff
+    using ParamsBFVRNS = lbcrypto::CCParams<lbcrypto::CryptoContextBFVRNS>;
+    using ParamsBGVRNS = lbcrypto::CCParams<lbcrypto::CryptoContextBGVRNS>;
+    using ParamsCKKSRNS = lbcrypto::CCParams<lbcrypto::CryptoContextCKKSRNS>;
+    using params = lbcrypto::Params;
+    using SCHEME = lbcrypto::SCHEME;
+    using SecretKeyDist = lbcrypto::SecretKeyDist;
+    using ProxyReEncryptionMode = lbcrypto::ProxyReEncryptionMode;
+    using MultipartyMode = lbcrypto::MultipartyMode;
+    using ExecutionMode = lbcrypto::ExecutionMode;
+    using DecryptionNoiseMode = lbcrypto::DecryptionNoiseMode;
+    using KeySwitchTechnique = lbcrypto::KeySwitchTechnique;
+    using ScalingTechnique = lbcrypto::ScalingTechnique;
+    using SecurityLevel = lbcrypto::SecurityLevel;
+    using EncryptionTechnique = lbcrypto::EncryptionTechnique;
+    using MultiplicationTechnique = lbcrypto::MultiplicationTechnique;
+    using COMPRESSION_LEVEL = lbcrypto::COMPRESSION_LEVEL;
+    using PKESchemeFeature = lbcrypto::PKESchemeFeature;
+    std::unique_ptr<params> GetParamsByScheme(const SCHEME scheme)
+    {
+        return std::make_unique<params>(scheme);
+    }
+    std::unique_ptr<params> GetParamsByVectorOfString(const std::vector<std::string>& vals)
+    {
+        return std::make_unique<params>(vals);
+    }
+    std::unique_ptr<ParamsBFVRNS> GetParamsBFVRNS()
+    {
+        return std::make_unique<ParamsBFVRNS>();
+    }
+    std::unique_ptr<ParamsBFVRNS> GetParamsBFVRNSbyVectorOfString(const std::vector<std::string>& vals)
+    {
+        return std::make_unique<ParamsBFVRNS>(vals);
+    }
+    std::unique_ptr<ParamsBGVRNS> GetParamsBGVRNS()
+    {
+        return std::make_unique<ParamsBGVRNS>();
+    }
+    std::unique_ptr<ParamsBGVRNS> GetParamsBGVRNSbyVectorOfString(const std::vector<std::string>& vals)
+    {
+        return std::make_unique<ParamsBGVRNS>(vals);
+    }
+    std::unique_ptr<ParamsCKKSRNS> GetParamsCKKSRNS()
+    {
+        return std::make_unique<ParamsCKKSRNS>();
+    }
+    std::unique_ptr<ParamsCKKSRNS> GetParamsCKKSRNSbyVectorOfString(const std::vector<std::string>& vals)
+    {
+        return std::make_unique<ParamsCKKSRNS>(vals);
+    }
+
+    // CryptContext related stuff
+    // using PublicKey = std::shared_ptr<PublicKeyImpl<Element>>;
+    // using PrivateKey = std::shared_ptr<PrivateKeyImpl<Element>>;
+
+    using PublicKeyImpl = lbcrypto::PublicKeyImpl<lbcrypto::DCRTPoly>;
+    using PrivateKeyImpl = lbcrypto::PrivateKeyImpl<lbcrypto::DCRTPoly>;
+
+    class KeyPairDCRTPoly final
+    {
+    private:
+        std::shared_ptr<PublicKeyImpl> m_publicKey;
+        std::shared_ptr<PrivateKeyImpl> m_privateKey;
+
+    public:
+        // TODO: think about all special functions of class
+        explicit KeyPairDCRTPoly(lbcrypto::KeyPair<lbcrypto::DCRTPoly> keyPair)
+            : m_publicKey(keyPair.publicKey)
+            , m_privateKey(keyPair.secretKey)
+        { }
+        std::shared_ptr<PublicKeyImpl> GetPublicKey() const
+        {
+            return m_publicKey;
+        }
+        std::shared_ptr<PrivateKeyImpl> GetPrivateKey() const
+        {
+            return m_privateKey;
+        }
+        // TODO: implement necessary member functions
+    };
+
+    using PlaintextImpl = lbcrypto::PlaintextImpl;
+    class Plaintext final
+    {
+    private:
+        std::shared_ptr<lbcrypto::PlaintextImpl> m_plaintext;
+
+    public:
+        // TODO: think about all special functions of class
+        explicit Plaintext() = default;
+        explicit Plaintext(std::shared_ptr<lbcrypto::PlaintextImpl> plaintext)
+            : m_plaintext(plaintext)
+        { }
+        Plaintext& operator=(std::shared_ptr<lbcrypto::PlaintextImpl> plaintext)
+        {
+            m_plaintext = plaintext;
+            return *this;
+        }
+        std::shared_ptr<lbcrypto::PlaintextImpl> GetPlainText() const
+        {
+            return m_plaintext;
+        }
+        void SetLength(const size_t newSize) const
+        {
+            if (m_plaintext)
+            {
+                m_plaintext->SetLength(newSize);
+            }
+        }
+        rust::String GetString() const
+        {
+            if (m_plaintext)
+            {
+                std::stringstream stream;
+                stream << *m_plaintext;
+                return rust::String(stream.str());
+            }
+            return rust::String();
+        }
+        // TODO: implement necessary member functions
+    };
+
+    std::unique_ptr<Plaintext> GenEmptyPlainText()
+    {
+        return std::make_unique<Plaintext>();
+    }
+
+    using CiphertextImpl = lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>;
+    class CiphertextDCRTPoly final
+    {
+    private:
+        std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> m_ciphertext;
+
+    public:
+        // TODO: think about all special functions of class
+        explicit CiphertextDCRTPoly(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> ciphertext)
+            : m_ciphertext(ciphertext)
+        { }
+        std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> GetCipherText() const
+        {
+            return m_ciphertext;
+        }
+        // TODO: implement necessary member functions
+    };
+
+    using DecryptResult = lbcrypto::DecryptResult;
+    class CryptoContextDCRTPoly final
+    {
+    private:
+        std::shared_ptr<lbcrypto::CryptoContextImpl<lbcrypto::DCRTPoly>> m_cryptoContextImplSharedPtr;
+
+    public:
+        // TODO: think about all special functions of class
+        explicit CryptoContextDCRTPoly(const ParamsBFVRNS& params)
+            : m_cryptoContextImplSharedPtr(lbcrypto::GenCryptoContext(params))
+        { }
+        explicit CryptoContextDCRTPoly(const ParamsBGVRNS& params)
+            : m_cryptoContextImplSharedPtr(lbcrypto::GenCryptoContext(params))
+        { }
+        explicit CryptoContextDCRTPoly(const ParamsCKKSRNS& params)
+            : m_cryptoContextImplSharedPtr(lbcrypto::GenCryptoContext(params))
+        { }
+        void Enable(const PKESchemeFeature feature) const
+        {
+            m_cryptoContextImplSharedPtr->Enable(feature);
+        }
+        std::unique_ptr<KeyPairDCRTPoly> KeyGen() const
+        {
+            return std::make_unique<KeyPairDCRTPoly>(m_cryptoContextImplSharedPtr->KeyGen());
+        }
+        void EvalMultKeyGen(const std::shared_ptr<lbcrypto::PrivateKeyImpl<lbcrypto::DCRTPoly>> key) const
+        {
+            m_cryptoContextImplSharedPtr->EvalMultKeyGen(key);
+        }
+        void EvalRotateKeyGen(const std::shared_ptr<lbcrypto::PrivateKeyImpl<lbcrypto::DCRTPoly>> privateKey, const std::vector<int32_t>& indexList,
+							                const std::shared_ptr<lbcrypto::PublicKeyImpl<lbcrypto::DCRTPoly>> publicKey) const // publicKey = nullptr in original. Rust don't support default args.
+        {
+            m_cryptoContextImplSharedPtr->EvalRotateKeyGen(privateKey, indexList, publicKey);
+        }
+        std::unique_ptr<Plaintext> MakePackedPlaintext(const std::vector<int64_t>& value, const size_t noiseScaleDeg, const uint32_t level) const // noiseScaleDeg = 1, level = 0
+        {
+            return std::make_unique<Plaintext>(m_cryptoContextImplSharedPtr->MakePackedPlaintext(value, noiseScaleDeg, level));
+        }
+        std::unique_ptr<CiphertextDCRTPoly> Encrypt(const std::shared_ptr<lbcrypto::PublicKeyImpl<lbcrypto::DCRTPoly>> publicKey, std::shared_ptr<lbcrypto::PlaintextImpl> plaintext) const
+        {
+            return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->Encrypt(publicKey, plaintext));
+        }
+        std::unique_ptr<CiphertextDCRTPoly> EvalAdd(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> ciphertext1,
+                                                    std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> ciphertext2) const
+        {
+            return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAdd(ciphertext1, ciphertext2));
+        }
+        std::unique_ptr<CiphertextDCRTPoly> EvalMult(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> ciphertext1,
+                                                     std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> ciphertext2) const
+        {
+            return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMult(ciphertext1, ciphertext2));
+        }
+        std::unique_ptr<CiphertextDCRTPoly> EvalRotate(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> ciphertext, const int32_t index) const
+        {
+            return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalRotate(ciphertext, index));
+        }
+        std::unique_ptr<DecryptResult> Decrypt(const std::shared_ptr<lbcrypto::PrivateKeyImpl<lbcrypto::DCRTPoly>> privateKey,
+                                               std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPoly>> ciphertext, Plaintext& plaintext) const
+        {
+            std::shared_ptr<lbcrypto::PlaintextImpl> res;
+            std::unique_ptr<DecryptResult> result = std::make_unique<DecryptResult>(m_cryptoContextImplSharedPtr->Decrypt(privateKey, ciphertext, &res));
+            plaintext = res;
+            return result;
+        }
+    };
+
+    std::unique_ptr<CryptoContextDCRTPoly> GenCryptoContextByParamsBFVRNS(const ParamsBFVRNS& params)
+    {
+        return std::make_unique<CryptoContextDCRTPoly>(params);
+    }
+    std::unique_ptr<CryptoContextDCRTPoly> GenCryptoContextByParamsBGVRNS(const ParamsBGVRNS& params)
+    {
+        return std::make_unique<CryptoContextDCRTPoly>(params);
+    }
+    std::unique_ptr<CryptoContextDCRTPoly> GenCryptoContextByParamsCKKSRNS(const ParamsCKKSRNS& params)
+    {
+        return std::make_unique<CryptoContextDCRTPoly>(params);
+    }
+} // openfhe_rs_dev
+

+ 0 - 37
src/lib.rs

@@ -1,37 +0,0 @@
-#![allow(non_upper_case_globals)]
-#![allow(non_camel_case_types)]
-#![allow(non_snake_case)]
-
-include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
-
-#[cfg(test)]
-mod tests {
-    use super::*;
-
-    #[test]
-    fn testCryptoContextBFVRNSCCParams() {
-        unsafe {
-            let ccparams = FFIParams::new1(FFISCHEME_CKKSRNS_SCHEME);
-
-            let mut ccontext = GenCryptoContext(ccparams);
-
-            ccontext.Enable(lbcrypto_PKESchemeFeature_PKE);
-            ccontext.Enable(lbcrypto_PKESchemeFeature_KEYSWITCH);
-            ccontext.Enable(lbcrypto_PKESchemeFeature_LEVELEDSHE);
-
-            let key_pair = ccontext.KeyGen();
-
-            println!("keypair is_allocated: {:?}", key_pair.is_allocated());
-             
-            ccontext.EvalMultKeyGen(key_pair.GetPrivateKey());
-        }
-    }
-
-    #[test]
-    fn testKeyPair() {
-        unsafe {
-            let key_pair = FFIKeyPair::new();
-            println!("keypair is_allocated: {:?}", key_pair.is_allocated());
-        }
-    }
-}

+ 570 - 0
src/main.rs

@@ -0,0 +1,570 @@
+#![allow(non_snake_case)]
+#![allow(dead_code)]
+
+use cxx::{CxxVector, SharedPtr};
+
+#[cxx::bridge(namespace = "openfhe_rs_dev")]
+mod ffi
+{
+    #[repr(i32)]
+    enum SCHEME
+    {
+        INVALID_SCHEME = 0,
+        CKKSRNS_SCHEME,
+        BFVRNS_SCHEME,
+        BGVRNS_SCHEME,
+    }
+    #[repr(i32)]
+    enum SecretKeyDist
+    {
+        GAUSSIAN        = 0,
+        UNIFORM_TERNARY = 1,
+        SPARSE_TERNARY  = 2,
+    }
+    #[repr(i32)]
+    enum ProxyReEncryptionMode
+    {
+        NOT_SET = 0,
+        INDCPA,
+        FIXED_NOISE_HRA,
+        NOISE_FLOODING_HRA,
+        DIVIDE_AND_ROUND_HRA,
+    }
+    #[repr(i32)]
+    enum MultipartyMode
+    {
+        INVALID_MULTIPARTY_MODE = 0,
+        FIXED_NOISE_MULTIPARTY,
+        NOISE_FLOODING_MULTIPARTY,
+    }
+    #[repr(i32)]
+    enum ExecutionMode
+    {
+        EXEC_EVALUATION = 0,
+        EXEC_NOISE_ESTIMATION,
+    }
+    #[repr(i32)]
+    enum DecryptionNoiseMode
+    {
+        FIXED_NOISE_DECRYPT = 0,
+        NOISE_FLOODING_DECRYPT,
+    }
+    #[repr(i32)]    
+    enum KeySwitchTechnique
+    {
+        INVALID_KS_TECH = 0,
+        BV,
+        HYBRID,
+    }
+    #[repr(i32)]
+    enum ScalingTechnique
+    {
+        FIXEDMANUAL = 0,
+        FIXEDAUTO,
+        FLEXIBLEAUTO,
+        FLEXIBLEAUTOEXT,
+        NORESCALE,
+        INVALID_RS_TECHNIQUE,
+    }
+    #[repr(i32)]
+    enum SecurityLevel
+    {
+        HEStd_128_classic,
+        HEStd_192_classic,
+        HEStd_256_classic,
+        HEStd_128_quantum,
+        HEStd_192_quantum,
+        HEStd_256_quantum,
+        HEStd_NotSet,
+    }
+    #[repr(i32)]
+    enum EncryptionTechnique
+    {
+        STANDARD = 0,
+        EXTENDED,
+    }
+    #[repr(i32)]
+    enum MultiplicationTechnique
+    {
+        BEHZ = 0,
+        HPS,
+        HPSPOVERQ,
+        HPSPOVERQLEVELED,
+    }
+    #[repr(i32)]
+    enum COMPRESSION_LEVEL
+    {
+        COMPACT = 2,
+        SLACK   = 3,
+    }
+    #[repr(i32)]
+    enum PKESchemeFeature
+    {
+        PKE          = 0x01,
+        KEYSWITCH    = 0x02,
+        PRE          = 0x04,
+        LEVELEDSHE   = 0x08,
+        ADVANCEDSHE  = 0x10,
+        MULTIPARTY   = 0x20,
+        FHE          = 0x40,
+        SCHEMESWITCH = 0x80,
+    }
+
+    // lbcrypto::Params
+    unsafe extern "C++"
+    {
+        include!("openfhe_rs_dev/src/direct.hpp");
+        type SCHEME;
+        type params;
+        fn GetParamsByScheme(scheme: SCHEME) -> UniquePtr<params>;
+        fn GetParamsByVectorOfString(vals: &CxxVector<CxxString>) -> UniquePtr<params>;
+
+        // getters
+        fn GetScheme(self: &params) -> SCHEME;
+        fn GetPlaintextModulus(self: &params) -> u64; // PlaintextModulus
+        fn GetDigitSize(self: &params) -> u32; // usint
+        fn GetStandardDeviation(self: &params) -> f32;
+        type SecretKeyDist;
+        fn GetSecretKeyDist(self: &params) -> SecretKeyDist;
+        fn GetMaxRelinSkDeg(self: &params) -> u32;
+        type ProxyReEncryptionMode;
+        fn GetPREMode(self: &params) -> ProxyReEncryptionMode;
+        type MultipartyMode;
+        fn GetMultipartyMode(self: &params) -> MultipartyMode;
+        type ExecutionMode;
+        fn GetExecutionMode(self: &params) -> ExecutionMode;
+        type DecryptionNoiseMode;
+        fn GetDecryptionNoiseMode(self: &params) -> DecryptionNoiseMode;
+        fn GetNoiseEstimate(self: &params) -> f64;
+        fn GetDesiredPrecision(self: &params) -> f64;
+        fn GetStatisticalSecurity(self: &params) -> f64;
+        fn GetNumAdversarialQueries(self: &params) -> f64;
+        fn GetThresholdNumOfParties(self: &params) -> u32;
+        type KeySwitchTechnique;
+        fn GetKeySwitchTechnique(self: &params) -> KeySwitchTechnique;
+        type ScalingTechnique;
+        fn GetScalingTechnique(self: &params) -> ScalingTechnique;
+        fn GetBatchSize(self: &params) -> u32;
+        fn GetFirstModSize(self: &params) -> u32;
+        fn GetNumLargeDigits(self: &params) -> u32;
+        fn GetMultiplicativeDepth(self: &params) -> u32;
+        fn GetScalingModSize(self: &params) -> u32;
+        type SecurityLevel;
+        fn GetSecurityLevel(self: &params) -> SecurityLevel;
+        fn GetRingDim(self: &params) -> u32;
+        fn GetEvalAddCount(self: &params) -> u32;
+        fn GetKeySwitchCount(self: &params) -> u32;
+        type EncryptionTechnique;
+        fn GetEncryptionTechnique(self: &params) -> EncryptionTechnique;
+        type MultiplicationTechnique;
+        fn GetMultiplicationTechnique(self: &params) -> MultiplicationTechnique;
+        fn GetMultiHopModSize(self: &params) -> u32;
+        type COMPRESSION_LEVEL;
+        fn GetInteractiveBootCompressionLevel(self: &params) -> COMPRESSION_LEVEL;
+
+        // setters
+        fn SetPlaintextModulus(self: Pin<&mut params>, ptModulus0: u64); // PlaintextModulus
+        fn SetDigitSize(self: Pin<&mut params>, digitSize0: u32);
+        fn SetStandardDeviation(self: Pin<&mut params>, standardDeviation0: f32);
+        fn SetSecretKeyDist(self: Pin<&mut params>, secretKeyDist0: SecretKeyDist);
+        fn SetMaxRelinSkDeg(self: Pin<&mut params>, maxRelinSkDeg0: u32);
+        fn SetPREMode(self: Pin<&mut params>, PREMode0: ProxyReEncryptionMode);
+        fn SetMultipartyMode(self: Pin<&mut params>, multipartyMode0: MultipartyMode);
+        fn SetExecutionMode(self: Pin<&mut params>, executionMode0: ExecutionMode);
+        fn SetDecryptionNoiseMode(self: Pin<&mut params>, decryptionNoiseMode0: DecryptionNoiseMode);
+        fn SetNoiseEstimate(self: Pin<&mut params>, noiseEstimate0: f64);
+        fn SetDesiredPrecision(self: Pin<&mut params>, desiredPrecision0: f64);
+        fn SetStatisticalSecurity(self: Pin<&mut params>, statisticalSecurity0: u32);
+        fn SetNumAdversarialQueries(self: Pin<&mut params>, numAdversarialQueries0: u32);
+        fn SetThresholdNumOfParties(self: Pin<&mut params>, thresholdNumOfParties0: u32);
+        fn SetKeySwitchTechnique(self: Pin<&mut params>, ksTech0: KeySwitchTechnique);
+        fn SetScalingTechnique(self: Pin<&mut params>, scalTech0: ScalingTechnique);
+        fn SetBatchSize(self: Pin<&mut params>, batchSize0: u32);
+        fn SetFirstModSize(self: Pin<&mut params>, firstModSize0: u32);
+        fn SetNumLargeDigits(self: Pin<&mut params>, numLargeDigits0: u32);
+        fn SetMultiplicativeDepth(self: Pin<&mut params>, multiplicativeDepth0: u32);
+        fn SetScalingModSize(self: Pin<&mut params>, scalingModSize0: u32);
+        fn SetSecurityLevel(self: Pin<&mut params>, securityLevel0: SecurityLevel);
+        fn SetRingDim(self: Pin<&mut params>, ringDim0: u32);
+        fn SetEvalAddCount(self: Pin<&mut params>, evalAddCount0: u32);
+        fn SetKeySwitchCount(self: Pin<&mut params>, keySwitchCount0: u32);
+        fn SetEncryptionTechnique(self: Pin<&mut params>, encryptionTechnique0: EncryptionTechnique);
+        fn SetMultiplicationTechnique(self: Pin<&mut params>, multiplicationTechnique0: MultiplicationTechnique);
+        fn SetMultiHopModSize(self: Pin<&mut params>, multiHopModSize0: u32);
+        fn SetInteractiveBootCompressionLevel(self: Pin<&mut params>, interactiveBootCompressionLevel0: COMPRESSION_LEVEL);
+    }
+
+    // lbcrypto::CCParams<lbcrypto::CryptoContextBFVRNS>
+    unsafe extern "C++"
+    {
+        //include!("openfhe_rs_dev/src/direct.hpp");
+        type ParamsBFVRNS;
+        fn GetParamsBFVRNS() -> UniquePtr<ParamsBFVRNS>;
+        fn GetParamsBFVRNSbyVectorOfString(vals: &CxxVector<CxxString>) -> UniquePtr<ParamsBFVRNS>;
+
+        // getters
+        fn GetScheme(self: &ParamsBFVRNS) -> SCHEME;
+        fn GetPlaintextModulus(self: &ParamsBFVRNS) -> u64; // PlaintextModulus
+        fn GetDigitSize(self: &ParamsBFVRNS) -> u32; // usint
+        fn GetStandardDeviation(self: &ParamsBFVRNS) -> f32;
+        fn GetSecretKeyDist(self: &ParamsBFVRNS) -> SecretKeyDist;
+        fn GetMaxRelinSkDeg(self: &ParamsBFVRNS) -> u32;
+        fn GetPREMode(self: &ParamsBFVRNS) -> ProxyReEncryptionMode;
+        fn GetMultipartyMode(self: &ParamsBFVRNS) -> MultipartyMode;
+        fn GetExecutionMode(self: &ParamsBFVRNS) -> ExecutionMode;
+        fn GetDecryptionNoiseMode(self: &ParamsBFVRNS) -> DecryptionNoiseMode;
+        fn GetNoiseEstimate(self: &ParamsBFVRNS) -> f64;
+        fn GetDesiredPrecision(self: &ParamsBFVRNS) -> f64;
+        fn GetStatisticalSecurity(self: &ParamsBFVRNS) -> f64;
+        fn GetNumAdversarialQueries(self: &ParamsBFVRNS) -> f64;
+        fn GetThresholdNumOfParties(self: &ParamsBFVRNS) -> u32;
+        fn GetKeySwitchTechnique(self: &ParamsBFVRNS) -> KeySwitchTechnique;
+        fn GetScalingTechnique(self: &ParamsBFVRNS) -> ScalingTechnique;
+        fn GetBatchSize(self: &ParamsBFVRNS) -> u32;
+        fn GetFirstModSize(self: &ParamsBFVRNS) -> u32;
+        fn GetNumLargeDigits(self: &ParamsBFVRNS) -> u32;
+        fn GetMultiplicativeDepth(self: &ParamsBFVRNS) -> u32;
+        fn GetScalingModSize(self: &ParamsBFVRNS) -> u32;
+        fn GetSecurityLevel(self: &ParamsBFVRNS) -> SecurityLevel;
+        fn GetRingDim(self: &ParamsBFVRNS) -> u32;
+        fn GetEvalAddCount(self: &ParamsBFVRNS) -> u32;
+        fn GetKeySwitchCount(self: &ParamsBFVRNS) -> u32;
+        fn GetEncryptionTechnique(self: &ParamsBFVRNS) -> EncryptionTechnique;
+        fn GetMultiplicationTechnique(self: &ParamsBFVRNS) -> MultiplicationTechnique;
+        fn GetMultiHopModSize(self: &ParamsBFVRNS) -> u32;
+        fn GetInteractiveBootCompressionLevel(self: &ParamsBFVRNS) -> COMPRESSION_LEVEL;
+
+        // setters
+        fn SetPlaintextModulus(self: Pin<&mut ParamsBFVRNS>, ptModulus0: u64); // PlaintextModulus
+        fn SetDigitSize(self: Pin<&mut ParamsBFVRNS>, digitSize0: u32);
+        fn SetStandardDeviation(self: Pin<&mut ParamsBFVRNS>, standardDeviation0: f32);
+        fn SetSecretKeyDist(self: Pin<&mut ParamsBFVRNS>, secretKeyDist0: SecretKeyDist);
+        fn SetMaxRelinSkDeg(self: Pin<&mut ParamsBFVRNS>, maxRelinSkDeg0: u32);
+        fn SetPREMode(self: Pin<&mut ParamsBFVRNS>, PREMode0: ProxyReEncryptionMode);
+        fn SetMultipartyMode(self: Pin<&mut ParamsBFVRNS>, multipartyMode0: MultipartyMode);
+        fn SetExecutionMode(self: Pin<&mut ParamsBFVRNS>, executionMode0: ExecutionMode);
+        fn SetDecryptionNoiseMode(self: Pin<&mut ParamsBFVRNS>, decryptionNoiseMode0: DecryptionNoiseMode);
+        fn SetNoiseEstimate(self: Pin<&mut ParamsBFVRNS>, noiseEstimate0: f64);
+        fn SetDesiredPrecision(self: Pin<&mut ParamsBFVRNS>, desiredPrecision0: f64);
+        fn SetStatisticalSecurity(self: Pin<&mut ParamsBFVRNS>, statisticalSecurity0: u32);
+        fn SetNumAdversarialQueries(self: Pin<&mut ParamsBFVRNS>, numAdversarialQueries0: u32);
+        fn SetThresholdNumOfParties(self: Pin<&mut ParamsBFVRNS>, thresholdNumOfParties0: u32);
+        fn SetKeySwitchTechnique(self: Pin<&mut ParamsBFVRNS>, ksTech0: KeySwitchTechnique);
+        fn SetScalingTechnique(self: Pin<&mut ParamsBFVRNS>, scalTech0: ScalingTechnique);
+        fn SetBatchSize(self: Pin<&mut ParamsBFVRNS>, batchSize0: u32);
+        fn SetFirstModSize(self: Pin<&mut ParamsBFVRNS>, firstModSize0: u32);
+        fn SetNumLargeDigits(self: Pin<&mut ParamsBFVRNS>, numLargeDigits0: u32);
+        fn SetMultiplicativeDepth(self: Pin<&mut ParamsBFVRNS>, multiplicativeDepth0: u32);
+        fn SetScalingModSize(self: Pin<&mut ParamsBFVRNS>, scalingModSize0: u32);
+        fn SetSecurityLevel(self: Pin<&mut ParamsBFVRNS>, securityLevel0: SecurityLevel);
+        fn SetRingDim(self: Pin<&mut ParamsBFVRNS>, ringDim0: u32);
+        fn SetEvalAddCount(self: Pin<&mut ParamsBFVRNS>, evalAddCount0: u32);
+        fn SetKeySwitchCount(self: Pin<&mut ParamsBFVRNS>, keySwitchCount0: u32);
+        fn SetEncryptionTechnique(self: Pin<&mut ParamsBFVRNS>, encryptionTechnique0: EncryptionTechnique);
+        fn SetMultiplicationTechnique(self: Pin<&mut ParamsBFVRNS>, multiplicationTechnique0: MultiplicationTechnique);
+        fn SetMultiHopModSize(self: Pin<&mut ParamsBFVRNS>, multiHopModSize0: u32);
+        fn SetInteractiveBootCompressionLevel(self: Pin<&mut ParamsBFVRNS>, interactiveBootCompressionLevel0: COMPRESSION_LEVEL);
+    }
+
+    // lbcrypto::CCParams<lbcrypto::CryptoContextBGVRNS>
+    unsafe extern "C++"
+    {
+        //include!("openfhe_rs_dev/src/direct.hpp");
+        type ParamsBGVRNS;
+        fn GetParamsBGVRNS() -> UniquePtr<ParamsBGVRNS>;
+        fn GetParamsBGVRNSbyVectorOfString(vals: &CxxVector<CxxString>) -> UniquePtr<ParamsBGVRNS>;
+
+        // getters
+        fn GetScheme(self: &ParamsBGVRNS) -> SCHEME;
+        fn GetPlaintextModulus(self: &ParamsBGVRNS) -> u64; // PlaintextModulus
+        fn GetDigitSize(self: &ParamsBGVRNS) -> u32; // usint
+        fn GetStandardDeviation(self: &ParamsBGVRNS) -> f32;
+        fn GetSecretKeyDist(self: &ParamsBGVRNS) -> SecretKeyDist;
+        fn GetMaxRelinSkDeg(self: &ParamsBGVRNS) -> u32;
+        fn GetPREMode(self: &ParamsBGVRNS) -> ProxyReEncryptionMode;
+        fn GetMultipartyMode(self: &ParamsBGVRNS) -> MultipartyMode;
+        fn GetExecutionMode(self: &ParamsBGVRNS) -> ExecutionMode;
+        fn GetDecryptionNoiseMode(self: &ParamsBGVRNS) -> DecryptionNoiseMode;
+        fn GetNoiseEstimate(self: &ParamsBGVRNS) -> f64;
+        fn GetDesiredPrecision(self: &ParamsBGVRNS) -> f64;
+        fn GetStatisticalSecurity(self: &ParamsBGVRNS) -> f64;
+        fn GetNumAdversarialQueries(self: &ParamsBGVRNS) -> f64;
+        fn GetThresholdNumOfParties(self: &ParamsBGVRNS) -> u32;
+        fn GetKeySwitchTechnique(self: &ParamsBGVRNS) -> KeySwitchTechnique;
+        fn GetScalingTechnique(self: &ParamsBGVRNS) -> ScalingTechnique;
+        fn GetBatchSize(self: &ParamsBGVRNS) -> u32;
+        fn GetFirstModSize(self: &ParamsBGVRNS) -> u32;
+        fn GetNumLargeDigits(self: &ParamsBGVRNS) -> u32;
+        fn GetMultiplicativeDepth(self: &ParamsBGVRNS) -> u32;
+        fn GetScalingModSize(self: &ParamsBGVRNS) -> u32;
+        fn GetSecurityLevel(self: &ParamsBGVRNS) -> SecurityLevel;
+        fn GetRingDim(self: &ParamsBGVRNS) -> u32;
+        fn GetEvalAddCount(self: &ParamsBGVRNS) -> u32;
+        fn GetKeySwitchCount(self: &ParamsBGVRNS) -> u32;
+        fn GetEncryptionTechnique(self: &ParamsBGVRNS) -> EncryptionTechnique;
+        fn GetMultiplicationTechnique(self: &ParamsBGVRNS) -> MultiplicationTechnique;
+        fn GetMultiHopModSize(self: &ParamsBGVRNS) -> u32;
+        fn GetInteractiveBootCompressionLevel(self: &ParamsBGVRNS) -> COMPRESSION_LEVEL;
+
+        // setters
+        fn SetPlaintextModulus(self: Pin<&mut ParamsBGVRNS>, ptModulus0: u64); // PlaintextModulus
+        fn SetDigitSize(self: Pin<&mut ParamsBGVRNS>, digitSize0: u32);
+        fn SetStandardDeviation(self: Pin<&mut ParamsBGVRNS>, standardDeviation0: f32);
+        fn SetSecretKeyDist(self: Pin<&mut ParamsBGVRNS>, secretKeyDist0: SecretKeyDist);
+        fn SetMaxRelinSkDeg(self: Pin<&mut ParamsBGVRNS>, maxRelinSkDeg0: u32);
+        fn SetPREMode(self: Pin<&mut ParamsBGVRNS>, PREMode0: ProxyReEncryptionMode);
+        fn SetMultipartyMode(self: Pin<&mut ParamsBGVRNS>, multipartyMode0: MultipartyMode);
+        fn SetExecutionMode(self: Pin<&mut ParamsBGVRNS>, executionMode0: ExecutionMode);
+        fn SetDecryptionNoiseMode(self: Pin<&mut ParamsBGVRNS>, decryptionNoiseMode0: DecryptionNoiseMode);
+        fn SetNoiseEstimate(self: Pin<&mut ParamsBGVRNS>, noiseEstimate0: f64);
+        fn SetDesiredPrecision(self: Pin<&mut ParamsBGVRNS>, desiredPrecision0: f64);
+        fn SetStatisticalSecurity(self: Pin<&mut ParamsBGVRNS>, statisticalSecurity0: u32);
+        fn SetNumAdversarialQueries(self: Pin<&mut ParamsBGVRNS>, numAdversarialQueries0: u32);
+        fn SetThresholdNumOfParties(self: Pin<&mut ParamsBGVRNS>, thresholdNumOfParties0: u32);
+        fn SetKeySwitchTechnique(self: Pin<&mut ParamsBGVRNS>, ksTech0: KeySwitchTechnique);
+        fn SetScalingTechnique(self: Pin<&mut ParamsBGVRNS>, scalTech0: ScalingTechnique);
+        fn SetBatchSize(self: Pin<&mut ParamsBGVRNS>, batchSize0: u32);
+        fn SetFirstModSize(self: Pin<&mut ParamsBGVRNS>, firstModSize0: u32);
+        fn SetNumLargeDigits(self: Pin<&mut ParamsBGVRNS>, numLargeDigits0: u32);
+        fn SetMultiplicativeDepth(self: Pin<&mut ParamsBGVRNS>, multiplicativeDepth0: u32);
+        fn SetScalingModSize(self: Pin<&mut ParamsBGVRNS>, scalingModSize0: u32);
+        fn SetSecurityLevel(self: Pin<&mut ParamsBGVRNS>, securityLevel0: SecurityLevel);
+        fn SetRingDim(self: Pin<&mut ParamsBGVRNS>, ringDim0: u32);
+        fn SetEvalAddCount(self: Pin<&mut ParamsBGVRNS>, evalAddCount0: u32);
+        fn SetKeySwitchCount(self: Pin<&mut ParamsBGVRNS>, keySwitchCount0: u32);
+        fn SetEncryptionTechnique(self: Pin<&mut ParamsBGVRNS>, encryptionTechnique0: EncryptionTechnique);
+        fn SetMultiplicationTechnique(self: Pin<&mut ParamsBGVRNS>, multiplicationTechnique0: MultiplicationTechnique);
+        fn SetMultiHopModSize(self: Pin<&mut ParamsBGVRNS>, multiHopModSize0: u32);
+        fn SetInteractiveBootCompressionLevel(self: Pin<&mut ParamsBGVRNS>, interactiveBootCompressionLevel0: COMPRESSION_LEVEL);
+    }
+
+    // lbcrypto::CCParams<lbcrypto::CryptoContextCKKSRNS>
+    unsafe extern "C++"
+    {
+        //include!("openfhe_rs_dev/src/direct.hpp");
+        type ParamsCKKSRNS;
+        fn GetParamsCKKSRNS() -> UniquePtr<ParamsCKKSRNS>;
+        fn GetParamsCKKSRNSbyVectorOfString(vals: &CxxVector<CxxString>) -> UniquePtr<ParamsCKKSRNS>;
+
+        // getters
+        fn GetScheme(self: &ParamsCKKSRNS) -> SCHEME;
+        fn GetPlaintextModulus(self: &ParamsCKKSRNS) -> u64; // PlaintextModulus
+        fn GetDigitSize(self: &ParamsCKKSRNS) -> u32; // usint
+        fn GetStandardDeviation(self: &ParamsCKKSRNS) -> f32;
+        fn GetSecretKeyDist(self: &ParamsCKKSRNS) -> SecretKeyDist;
+        fn GetMaxRelinSkDeg(self: &ParamsCKKSRNS) -> u32;
+        fn GetPREMode(self: &ParamsCKKSRNS) -> ProxyReEncryptionMode;
+        fn GetMultipartyMode(self: &ParamsCKKSRNS) -> MultipartyMode;
+        fn GetExecutionMode(self: &ParamsCKKSRNS) -> ExecutionMode;
+        fn GetDecryptionNoiseMode(self: &ParamsCKKSRNS) -> DecryptionNoiseMode;
+        fn GetNoiseEstimate(self: &ParamsCKKSRNS) -> f64;
+        fn GetDesiredPrecision(self: &ParamsCKKSRNS) -> f64;
+        fn GetStatisticalSecurity(self: &ParamsCKKSRNS) -> f64;
+        fn GetNumAdversarialQueries(self: &ParamsCKKSRNS) -> f64;
+        fn GetThresholdNumOfParties(self: &ParamsCKKSRNS) -> u32;
+        fn GetKeySwitchTechnique(self: &ParamsCKKSRNS) -> KeySwitchTechnique;
+        fn GetScalingTechnique(self: &ParamsCKKSRNS) -> ScalingTechnique;
+        fn GetBatchSize(self: &ParamsCKKSRNS) -> u32;
+        fn GetFirstModSize(self: &ParamsCKKSRNS) -> u32;
+        fn GetNumLargeDigits(self: &ParamsCKKSRNS) -> u32;
+        fn GetMultiplicativeDepth(self: &ParamsCKKSRNS) -> u32;
+        fn GetScalingModSize(self: &ParamsCKKSRNS) -> u32;
+        fn GetSecurityLevel(self: &ParamsCKKSRNS) -> SecurityLevel;
+        fn GetRingDim(self: &ParamsCKKSRNS) -> u32;
+        fn GetEvalAddCount(self: &ParamsCKKSRNS) -> u32;
+        fn GetKeySwitchCount(self: &ParamsCKKSRNS) -> u32;
+        fn GetEncryptionTechnique(self: &ParamsCKKSRNS) -> EncryptionTechnique;
+        fn GetMultiplicationTechnique(self: &ParamsCKKSRNS) -> MultiplicationTechnique;
+        fn GetMultiHopModSize(self: &ParamsCKKSRNS) -> u32;
+        fn GetInteractiveBootCompressionLevel(self: &ParamsCKKSRNS) -> COMPRESSION_LEVEL;
+
+        // setters
+        fn SetPlaintextModulus(self: Pin<&mut ParamsCKKSRNS>, ptModulus0: u64); // PlaintextModulus
+        fn SetDigitSize(self: Pin<&mut ParamsCKKSRNS>, digitSize0: u32);
+        fn SetStandardDeviation(self: Pin<&mut ParamsCKKSRNS>, standardDeviation0: f32);
+        fn SetSecretKeyDist(self: Pin<&mut ParamsCKKSRNS>, secretKeyDist0: SecretKeyDist);
+        fn SetMaxRelinSkDeg(self: Pin<&mut ParamsCKKSRNS>, maxRelinSkDeg0: u32);
+        fn SetPREMode(self: Pin<&mut ParamsCKKSRNS>, PREMode0: ProxyReEncryptionMode);
+        fn SetMultipartyMode(self: Pin<&mut ParamsCKKSRNS>, multipartyMode0: MultipartyMode);
+        fn SetExecutionMode(self: Pin<&mut ParamsCKKSRNS>, executionMode0: ExecutionMode);
+        fn SetDecryptionNoiseMode(self: Pin<&mut ParamsCKKSRNS>, decryptionNoiseMode0: DecryptionNoiseMode);
+        fn SetNoiseEstimate(self: Pin<&mut ParamsCKKSRNS>, noiseEstimate0: f64);
+        fn SetDesiredPrecision(self: Pin<&mut ParamsCKKSRNS>, desiredPrecision0: f64);
+        fn SetStatisticalSecurity(self: Pin<&mut ParamsCKKSRNS>, statisticalSecurity0: u32);
+        fn SetNumAdversarialQueries(self: Pin<&mut ParamsCKKSRNS>, numAdversarialQueries0: u32);
+        fn SetThresholdNumOfParties(self: Pin<&mut ParamsCKKSRNS>, thresholdNumOfParties0: u32);
+        fn SetKeySwitchTechnique(self: Pin<&mut ParamsCKKSRNS>, ksTech0: KeySwitchTechnique);
+        fn SetScalingTechnique(self: Pin<&mut ParamsCKKSRNS>, scalTech0: ScalingTechnique);
+        fn SetBatchSize(self: Pin<&mut ParamsCKKSRNS>, batchSize0: u32);
+        fn SetFirstModSize(self: Pin<&mut ParamsCKKSRNS>, firstModSize0: u32);
+        fn SetNumLargeDigits(self: Pin<&mut ParamsCKKSRNS>, numLargeDigits0: u32);
+        fn SetMultiplicativeDepth(self: Pin<&mut ParamsCKKSRNS>, multiplicativeDepth0: u32);
+        fn SetScalingModSize(self: Pin<&mut ParamsCKKSRNS>, scalingModSize0: u32);
+        fn SetSecurityLevel(self: Pin<&mut ParamsCKKSRNS>, securityLevel0: SecurityLevel);
+        fn SetRingDim(self: Pin<&mut ParamsCKKSRNS>, ringDim0: u32);
+        fn SetEvalAddCount(self: Pin<&mut ParamsCKKSRNS>, evalAddCount0: u32);
+        fn SetKeySwitchCount(self: Pin<&mut ParamsCKKSRNS>, keySwitchCount0: u32);
+        fn SetEncryptionTechnique(self: Pin<&mut ParamsCKKSRNS>, encryptionTechnique0: EncryptionTechnique);
+        fn SetMultiplicationTechnique(self: Pin<&mut ParamsCKKSRNS>, multiplicationTechnique0: MultiplicationTechnique);
+        fn SetMultiHopModSize(self: Pin<&mut ParamsCKKSRNS>, multiHopModSize0: u32);
+        fn SetInteractiveBootCompressionLevel(self: Pin<&mut ParamsCKKSRNS>, interactiveBootCompressionLevel0: COMPRESSION_LEVEL);
+    }
+
+    // lbcrypto::CryptoContextImpl<lbcrypto::DCRTPoly>
+    unsafe extern "C++"
+    {
+        //include!("openfhe_rs_dev/src/direct.hpp");
+        type CryptoContextDCRTPoly;
+        fn GenCryptoContextByParamsBFVRNS(params: &ParamsBFVRNS) -> UniquePtr<CryptoContextDCRTPoly>;
+        fn GenCryptoContextByParamsBGVRNS(params: &ParamsBGVRNS) -> UniquePtr<CryptoContextDCRTPoly>;
+        fn GenCryptoContextByParamsCKKSRNS(params: &ParamsCKKSRNS) -> UniquePtr<CryptoContextDCRTPoly>;
+        type PKESchemeFeature;
+        fn Enable(self: &CryptoContextDCRTPoly, feature: PKESchemeFeature);
+
+        type KeyPairDCRTPoly;
+        fn KeyGen(self: &CryptoContextDCRTPoly) -> UniquePtr<KeyPairDCRTPoly>;
+        type PrivateKeyImpl;
+        fn GetPrivateKey(self: &KeyPairDCRTPoly) -> SharedPtr<PrivateKeyImpl>;
+        type PublicKeyImpl;
+        fn GetPublicKey(self: &KeyPairDCRTPoly) -> SharedPtr<PublicKeyImpl>;
+
+        fn EvalMultKeyGen(self: &CryptoContextDCRTPoly, key: SharedPtr<PrivateKeyImpl>);
+        fn EvalRotateKeyGen(self: &CryptoContextDCRTPoly, privateKey: SharedPtr<PrivateKeyImpl>, indexList: &CxxVector<i32>, publicKey: SharedPtr<PublicKeyImpl>);
+        
+        type PlaintextImpl;
+        type Plaintext;
+        fn GenEmptyPlainText() -> UniquePtr<Plaintext>;
+        fn GetPlainText(self: &Plaintext) -> SharedPtr<PlaintextImpl>;
+        fn MakePackedPlaintext(self: &CryptoContextDCRTPoly, value: &CxxVector<i64>, noiseScaleDeg: usize, level: u32) -> UniquePtr<Plaintext>; // noiseScaleDeg = 1, level = 0
+        fn SetLength(self: &Plaintext, newSize: usize);
+        fn GetString(self: &Plaintext) -> String;
+
+        type CiphertextImpl;
+        type CiphertextDCRTPoly;
+        fn GetCipherText(self: &CiphertextDCRTPoly) -> SharedPtr<CiphertextImpl>;
+        fn Encrypt(self: &CryptoContextDCRTPoly, publicKey: SharedPtr<PublicKeyImpl>, plaintext: SharedPtr<PlaintextImpl>) -> UniquePtr<CiphertextDCRTPoly>;
+        fn EvalAdd(self: &CryptoContextDCRTPoly, ciphertext1: SharedPtr<CiphertextImpl>, ciphertext2: SharedPtr<CiphertextImpl>) -> UniquePtr<CiphertextDCRTPoly>;
+        fn EvalMult(self: &CryptoContextDCRTPoly, ciphertext1: SharedPtr<CiphertextImpl>, ciphertext2: SharedPtr<CiphertextImpl>) -> UniquePtr<CiphertextDCRTPoly>;
+        fn EvalRotate(self: &CryptoContextDCRTPoly, ciphertext: SharedPtr<CiphertextImpl>, index: i32) -> UniquePtr<CiphertextDCRTPoly>;
+                
+        type DecryptResult;
+        fn Decrypt(self: &CryptoContextDCRTPoly, privateKey: SharedPtr<PrivateKeyImpl>, ciphertext: SharedPtr<CiphertextImpl>, plaintext: Pin<&mut Plaintext>) -> UniquePtr<DecryptResult>;
+    }
+}
+
+fn SimpleIntegersExample()
+{
+    let mut _cc_params_bfvrns = ffi::GetParamsBFVRNS();
+    _cc_params_bfvrns.pin_mut().SetPlaintextModulus(65537);
+    _cc_params_bfvrns.pin_mut().SetMultiplicativeDepth(2);
+
+    let mut _cc = ffi::GenCryptoContextByParamsBFVRNS(&_cc_params_bfvrns);
+    _cc.Enable(ffi::PKESchemeFeature::PKE);
+    _cc.Enable(ffi::PKESchemeFeature::KEYSWITCH);
+    _cc.Enable(ffi::PKESchemeFeature::LEVELEDSHE);
+    
+    let mut _key_pair = _cc.KeyGen();
+    _cc.EvalMultKeyGen(_key_pair.GetPrivateKey());
+    
+    let mut _index_list = CxxVector::<i32>::new();
+    _index_list.pin_mut().push(1);
+    _index_list.pin_mut().push(2);
+    _index_list.pin_mut().push(-1);
+    _index_list.pin_mut().push(-2);    
+    _cc.EvalRotateKeyGen(_key_pair.GetPrivateKey(), &_index_list, SharedPtr::<ffi::PublicKeyImpl>::null());
+    
+    let mut _vector_of_ints_1 = CxxVector::<i64>::new();
+    _vector_of_ints_1.pin_mut().push(1);
+    _vector_of_ints_1.pin_mut().push(2);
+    _vector_of_ints_1.pin_mut().push(3);
+    _vector_of_ints_1.pin_mut().push(4);
+    _vector_of_ints_1.pin_mut().push(5);
+    _vector_of_ints_1.pin_mut().push(6);    
+    _vector_of_ints_1.pin_mut().push(7);
+    _vector_of_ints_1.pin_mut().push(8);
+    _vector_of_ints_1.pin_mut().push(9);
+    _vector_of_ints_1.pin_mut().push(10);
+    _vector_of_ints_1.pin_mut().push(11);
+    _vector_of_ints_1.pin_mut().push(12);    
+    let mut _plain_text_1 = _cc.MakePackedPlaintext(&_vector_of_ints_1, 1, 0);
+    
+    let mut _vector_of_ints_2 = CxxVector::<i64>::new();
+    _vector_of_ints_2.pin_mut().push(3);
+    _vector_of_ints_2.pin_mut().push(2);
+    _vector_of_ints_2.pin_mut().push(1);
+    _vector_of_ints_2.pin_mut().push(4);
+    _vector_of_ints_2.pin_mut().push(5);
+    _vector_of_ints_2.pin_mut().push(6);    
+    _vector_of_ints_2.pin_mut().push(7);
+    _vector_of_ints_2.pin_mut().push(8);
+    _vector_of_ints_2.pin_mut().push(9);
+    _vector_of_ints_2.pin_mut().push(10);
+    _vector_of_ints_2.pin_mut().push(11);
+    _vector_of_ints_2.pin_mut().push(12);    
+    let mut _plain_text_2 = _cc.MakePackedPlaintext(&_vector_of_ints_2, 1, 0); 
+    
+    let mut _vector_of_ints_3 = CxxVector::<i64>::new();
+    _vector_of_ints_3.pin_mut().push(1);
+    _vector_of_ints_3.pin_mut().push(2);
+    _vector_of_ints_3.pin_mut().push(5);
+    _vector_of_ints_3.pin_mut().push(2);
+    _vector_of_ints_3.pin_mut().push(5);
+    _vector_of_ints_3.pin_mut().push(6);    
+    _vector_of_ints_3.pin_mut().push(7);
+    _vector_of_ints_3.pin_mut().push(8);
+    _vector_of_ints_3.pin_mut().push(9);
+    _vector_of_ints_3.pin_mut().push(10);
+    _vector_of_ints_3.pin_mut().push(11);
+    _vector_of_ints_3.pin_mut().push(12);    
+    let mut _plain_text_3 = _cc.MakePackedPlaintext(&_vector_of_ints_3, 1, 0);
+
+    let mut _cipher_text_1 = _cc.Encrypt(_key_pair.GetPublicKey(), _plain_text_1.GetPlainText());
+    let mut _cipher_text_2 = _cc.Encrypt(_key_pair.GetPublicKey(), _plain_text_2.GetPlainText());
+    let mut _cipher_text_3 = _cc.Encrypt(_key_pair.GetPublicKey(), _plain_text_3.GetPlainText());    
+
+    let mut _cipher_text_add_1_2 = _cc.EvalAdd(_cipher_text_1.GetCipherText(), _cipher_text_2.GetCipherText());
+    let mut _cipher_text_add_result = _cc.EvalAdd(_cipher_text_add_1_2.GetCipherText(), _cipher_text_3.GetCipherText());
+
+    let mut _cipher_text_mul_1_2 = _cc.EvalMult(_cipher_text_1.GetCipherText(), _cipher_text_2.GetCipherText());
+    let mut _cipher_text_mult_result = _cc.EvalMult(_cipher_text_mul_1_2.GetCipherText(), _cipher_text_3.GetCipherText());
+    
+    let mut _cipher_text_rot_1 = _cc.EvalRotate(_cipher_text_1.GetCipherText(), 1);
+    let mut _cipher_text_rot_2 = _cc.EvalRotate(_cipher_text_1.GetCipherText(), 2);
+    let mut _cipher_text_rot_3 = _cc.EvalRotate(_cipher_text_1.GetCipherText(), -1);
+    let mut _cipher_text_rot_4 = _cc.EvalRotate(_cipher_text_1.GetCipherText(), -2);
+    
+    let mut _plain_text_add_result = ffi::GenEmptyPlainText();
+    _cc.Decrypt(_key_pair.GetPrivateKey(), _cipher_text_add_result.GetCipherText(), _plain_text_add_result.pin_mut());
+    let mut _plain_text_mult_result = ffi::GenEmptyPlainText();
+    _cc.Decrypt(_key_pair.GetPrivateKey(), _cipher_text_mult_result.GetCipherText(), _plain_text_mult_result.pin_mut());
+    let mut _plain_text_rot_1 = ffi::GenEmptyPlainText();
+    _cc.Decrypt(_key_pair.GetPrivateKey(), _cipher_text_rot_1.GetCipherText(), _plain_text_rot_1.pin_mut());
+    let mut _plain_text_rot_2 = ffi::GenEmptyPlainText();
+    _cc.Decrypt(_key_pair.GetPrivateKey(), _cipher_text_rot_2.GetCipherText(), _plain_text_rot_2.pin_mut()); 
+    let mut _plain_text_rot_3 = ffi::GenEmptyPlainText();
+    _cc.Decrypt(_key_pair.GetPrivateKey(), _cipher_text_rot_3.GetCipherText(), _plain_text_rot_3.pin_mut());     
+    let mut _plain_text_rot_4 = ffi::GenEmptyPlainText();
+    _cc.Decrypt(_key_pair.GetPrivateKey(), _cipher_text_rot_4.GetCipherText(), _plain_text_rot_4.pin_mut());     
+
+    _plain_text_rot_1.SetLength(_vector_of_ints_1.len());
+    _plain_text_rot_2.SetLength(_vector_of_ints_1.len());
+    _plain_text_rot_3.SetLength(_vector_of_ints_1.len());
+    _plain_text_rot_4.SetLength(_vector_of_ints_1.len());
+
+    println!("Plaintext #1: {}", _plain_text_1.GetString());
+    println!("Plaintext #2: {}", _plain_text_2.GetString());
+    println!("Plaintext #3: {}", _plain_text_3.GetString());
+
+    println!("\nResults of homomorphic computations");
+    println!("#1 + #2 + #3: {}", _plain_text_add_result.GetString());
+    println!("#1 * #2 * #3: {}", _plain_text_mult_result.GetString());
+    println!("Left rotation of #1 by 1: {}", _plain_text_rot_1.GetString());
+    println!("Left rotation of #1 by 2: {}", _plain_text_rot_2.GetString());
+    println!("Right rotation of #1 by -1: {}", _plain_text_rot_3.GetString());
+    println!("Right rotation of #1 by -2: {}", _plain_text_rot_4.GetString());	
+}
+
+fn main()
+{
+    SimpleIntegersExample();
+}