I found that if I generate two crypto contexts, then loading Eval{Mult,Sum} keys in one context also loads it in the other. Is that the expected behavior?
TEST(CryptoContext, loadKeys) {
// BFV Parameters
PlaintextModulus plaintextModulus{65537};
uint64_t multDepth{18};
uint64_t ringDim{32768};
uint64_t batchSize{ringDim};
lbcrypto::CCParams<lbcrypto::CryptoContextBFVRNS> parameters;
parameters.SetPlaintextModulus(plaintextModulus);
parameters.SetMultiplicativeDepth(multDepth);
parameters.SetSecurityLevel(lbcrypto::SecurityLevel::HEStd_128_quantum);
parameters.SetBatchSize(batchSize);
parameters.SetRingDim(ringDim);
auto cc1 = GenCryptoContext(parameters);
auto cc2 = GenCryptoContext(parameters);
ASSERT_EQ(cc1->GetAllEvalMultKeys().size(), 0)
<< "cc1 has no EvalMult key before loading cc2";
std::ifstream emkeyfile("testData/key-eval-mult.txt",
std::ios::in | std::ios::binary);
cc2->DeserializeEvalMultKey(emkeyfile, lbcrypto::SerType::BINARY);
emkeyfile.close();
ASSERT_EQ(cc1->GetAllEvalMultKeys().size(), 0)
<< "cc1 has an EvalMult key after loading cc2";
}
[ctest] Expected equality of these values:
[ctest] cc1->GetAllEvalMultKeys().size()
[ctest] Which is: 1
[ctest] 0
[ctest] cc1 has an EvalMult key after loading cc2