|
@@ -5,7 +5,6 @@
|
|
using namespace lbcrypto;
|
|
using namespace lbcrypto;
|
|
namespace py = pybind11;
|
|
namespace py = pybind11;
|
|
|
|
|
|
-
|
|
|
|
void bind_parameters(py::module &m){
|
|
void bind_parameters(py::module &m){
|
|
py::class_<Params>(m, "Params");
|
|
py::class_<Params>(m, "Params");
|
|
py::class_<CCParams<CryptoContextBFVRNS>, Params>(m, "CCParamsBFVRNS")
|
|
py::class_<CCParams<CryptoContextBFVRNS>, Params>(m, "CCParamsBFVRNS")
|
|
@@ -28,7 +27,10 @@ void bind_crypto_context(py::module &m){
|
|
py::class_<CryptoContextImpl<DCRTPoly>,std::shared_ptr<CryptoContextImpl<DCRTPoly>>>(m,"CryptoContextDCRTPoly")
|
|
py::class_<CryptoContextImpl<DCRTPoly>,std::shared_ptr<CryptoContextImpl<DCRTPoly>>>(m,"CryptoContextDCRTPoly")
|
|
.def("GetKeyGenLevel",&CryptoContextImpl<DCRTPoly>::GetKeyGenLevel)
|
|
.def("GetKeyGenLevel",&CryptoContextImpl<DCRTPoly>::GetKeyGenLevel)
|
|
.def("SetKeyGenLevel",&CryptoContextImpl<DCRTPoly>::SetKeyGenLevel)
|
|
.def("SetKeyGenLevel",&CryptoContextImpl<DCRTPoly>::SetKeyGenLevel)
|
|
- .def("Enable",static_cast<void (CryptoContextImpl<DCRTPoly>::*)(PKESchemeFeature)>(&CryptoContextImpl<DCRTPoly>::Enable), "Enable a feature for the CryptoContext");
|
|
|
|
|
|
+ .def("Enable",static_cast<void (CryptoContextImpl<DCRTPoly>::*)(PKESchemeFeature)>(&CryptoContextImpl<DCRTPoly>::Enable), "Enable a feature for the CryptoContext")
|
|
|
|
+ .def("KeyGen",&CryptoContextImpl<DCRTPoly>::KeyGen)
|
|
|
|
+ .def("EvalMultKeyGen",&CryptoContextImpl<DCRTPoly>::EvalMultKeyGen);
|
|
|
|
+
|
|
// Generator Functions
|
|
// Generator Functions
|
|
m.def("GenCryptoContext", &GenCryptoContext<CryptoContextBFVRNS>);
|
|
m.def("GenCryptoContext", &GenCryptoContext<CryptoContextBFVRNS>);
|
|
m.def("GenCryptoContext", &GenCryptoContext<CryptoContextBGVRNS>);
|
|
m.def("GenCryptoContext", &GenCryptoContext<CryptoContextBGVRNS>);
|
|
@@ -36,6 +38,9 @@ void bind_crypto_context(py::module &m){
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
void bind_enums(py::module &m){
|
|
void bind_enums(py::module &m){
|
|
// Scheme Types
|
|
// Scheme Types
|
|
py::enum_<SCHEME>(m, "SCHEME")
|
|
py::enum_<SCHEME>(m, "SCHEME")
|
|
@@ -54,10 +59,19 @@ void bind_enums(py::module &m){
|
|
.value("FHE", PKESchemeFeature::FHE);
|
|
.value("FHE", PKESchemeFeature::FHE);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void bind_keys(py::module &m){
|
|
|
|
+ py::class_<PublicKeyImpl<DCRTPoly>,std::shared_ptr<PublicKeyImpl<DCRTPoly>>>(m,"PublicKey");
|
|
|
|
+ py::class_<PrivateKeyImpl<DCRTPoly>,std::shared_ptr<PrivateKeyImpl<DCRTPoly>>>(m,"PrivateKey");
|
|
|
|
+ py::class_<KeyPair<DCRTPoly>>(m,"KeyPair")
|
|
|
|
+ .def_readwrite("publicKey", &KeyPair<DCRTPoly>::publicKey)
|
|
|
|
+ .def_readwrite("secretKey", &KeyPair<DCRTPoly>::secretKey);
|
|
|
|
+}
|
|
|
|
+
|
|
PYBIND11_MODULE(openfhe, m) {
|
|
PYBIND11_MODULE(openfhe, m) {
|
|
m.doc() = "Open-Source Fully Homomorphic Encryption Library";
|
|
m.doc() = "Open-Source Fully Homomorphic Encryption Library";
|
|
bind_parameters(m);
|
|
bind_parameters(m);
|
|
bind_crypto_context(m);
|
|
bind_crypto_context(m);
|
|
bind_enums(m);
|
|
bind_enums(m);
|
|
|
|
+ bind_keys(m);
|
|
|
|
|
|
}
|
|
}
|