|
@@ -35,6 +35,10 @@ namespace {
|
|
|
struct KeyPairHolder{
|
|
|
std::shared_ptr<KeyPair<DCRTPoly>> ptr;
|
|
|
};
|
|
|
+
|
|
|
+ struct CiphertextHolder{
|
|
|
+ std::shared_ptr<CiphertextImpl<DCRTPoly>> ptr;
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
FFIParams::FFIParams(){
|
|
@@ -1424,29 +1428,43 @@ FFIPrivateKeyImpl FFIKeyPair::GetPrivateKey() const{
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+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);
|
|
|
+}
|
|
|
|
|
|
|
|
|
|