Hello everyone, I am trying to serialize and deserialize a CKKSRNS Context and keys.
I am able to do it with the context like this:
if (!Serial::SerializeToFile("crypto-context.txt", cryptoContext, SerType::BINARY)) {
std::cerr << "Error writing serialization of the crypto context to crypto-context.txt" << std::endl;
}
and later, deserializing like this:
CryptoContext<DCRTPoly> cryptoContext;
if (!Serial::DeserializeFromFile("crypto-context.txt", cryptoContext, SerType::BINARY)) {
cerr << "I cannot read serialization from " << "cryptocontext.txt" << endl;
}
I can do it with keys, too:
if (!Serial::SerializeToFile("key-public.txt", keyPair.publicKey, SerType::BINARY)) {
std::cerr << "Error writing serialization of public key to key-public.txt" << std::endl;
}
Deserialization:
PublicKeyImpl<DCRTPoly> pk;
if (!Serial::DeserializeFromFile("key-public.txt", pk, SerType::BINARY)) {
cerr << "Could not read public key" << endl;
}
But in documentations (Here), it says that there are various functions like DeserializePublicKey
, DeserializeSecretKey
and so on, but I am unable to find them.
Is my code correct?
Thank you!