Creating an array of Ciphertexts in Microsoft SEAL using C++

100 views Asked by At

I want to create an array of packed ciphertexts using the BFV homomorphic encryption scheme in Microsft SEAL, C++.

If I have 8192 slots in one packed BFV ciphertext, I want to create an array of 10 such ciphertexts to perform various operations on them. I am not very good with assigning memory and using pointers which would probably be part of the solution but I am not sure. Could anyone please help me with this? Thank you so much!

I tried using pointers but since "Ciphertext" is a unique datatype to Microsoft SEAL I came across a few errors which probably means I didnt do it right.

1

There are 1 answers

0
PiaBa On

Consider using vectors from the std library instead of native C++ arrays. It makes handling the contained data much easier. You can create a vector that will fit 10 SEAL Ciphertext as follows:

vector<Ciphertext> vec;
vec.reserve(10);

Handling the data will feel like a mixture of arrays and lists. You can utilize the []operator to perform operatation of a ciphertext. For example, if you want to perform the function dyn_array().size() on the first vector element, you can execute the following:

size_t cipher_size = vec[0].dyn_array().size();

For more infos consider the doku.