Skip to content

Commit c1cb075

Browse files
committed
add create_serializable_galois_keys
1 parent eab16fb commit c1cb075

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/wrapper.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,15 @@ PYBIND11_MODULE(seal, m)
384384
})
385385
;
386386

387+
// serializable.h
388+
py::class_<Serializable<GaloisKeys>>(m, "Serializable<GaloisKeys>")
389+
.def("save", [](const Serializable<GaloisKeys> &gk, const std::string &path){
390+
std::ofstream out(path, std::ofstream::binary);
391+
gk.save(out);
392+
out.close();
393+
})
394+
;
395+
387396
// keygenerator.h
388397
py::class_<KeyGenerator>(m, "KeyGenerator")
389398
.def(py::init<const SEALContext &>())
@@ -407,7 +416,11 @@ PYBIND11_MODULE(seal, m)
407416
GaloisKeys gk;
408417
keygen.create_galois_keys(gk);
409418
return gk;
410-
});
419+
})
420+
.def("create_serializable_galois_keys", [](KeyGenerator &keygen){
421+
return keygen.create_galois_keys();
422+
})
423+
;
411424

412425
// encryptor.h
413426
py::class_<Encryptor>(m, "Encryptor")

0 commit comments

Comments
 (0)