I am trying to run the following code, which tries to re-encrypt a decrypted plaintext, but it throws an OpenFHEException in a recursive call from the second Encrypt
. Where am I going wrong?
#include <openfhe.h>
using namespace lbcrypto;
int main()
{
CCParams<CryptoContextBGVRNS> params;
params.SetPlaintextModulus(65537);
CryptoContext<DCRTPoly> cc = GenCryptoContext(params);
cc->Enable(PKE | LEVELEDSHE);
KeyPair<DCRTPoly> kp = cc->KeyGen();
std::vector<int64_t> vec(10, 1L);
Plaintext plain = cc->MakePackedPlaintext(vec);
Ciphertext<DCRTPoly> cipher = cc->Encrypt(kp.publicKey, plain);
cc->Decrypt(kp.secretKey, cipher, &plain);
cipher = cc->Encrypt(kp.publicKey, plain);
}
More specifically, I am getting the following exception:
terminate called after throwing an instance of 'lbcrypto::OpenFHEException'
what(): openfhe-development/src/core/include/lattice/hal/default/dcrtpoly-impl.h:l.705:DropLastElements(): DropLastElements: Too few towers in input.