Serialization: Overview

Hello everyone,

I have question regarding serialization of OpenFHE objects. We (@tomfi, @sloede ) are currently implementing serialization in SecureArithmetic.jl / Openfhe.jl. But our current implementation seems unnecessarily complex and feels a bit like a workaround[1].

Our use case is this: We want to set up a multi-party remote processing suite (i.e. RPC) in Julia for SecureArithmetic Objects (which are wrappers around OpenFHE objects). The user / client should not have to know anything about the inner workings of OpenFHE, especially how serialization works. This means, when a user wants to execute code, it is required that all necessary Eval Keys (Mult, Sum, Automorphism) are serialized and sent to the server without their manual intervention.

An overview of serialization in OpenFHE as I understand it:

For CryptoContext, Ciphertext, PublicKey, PrivateKey:

SerializeToFile (SERJSON)
DeserializeFromFile (SERJSON)
SerializeToFile (SERBINARY)
DeserializeFromFile (SERBINARY)
SerializeToString
DeserializeFromString

Additionally:

SerializeEvalAutomorphismKey
SerializeEvalMultKey
SerializeEvalSumKey

Is this how serialization is intended to be used for OpenFHE objects or am I missing something? Do we have to serialize Eval Keys in addition to the CryptoContext or is there another way? And why is there this mismatch between serialization for CryptoContext, Ciphertext, PublicKey, PrivateKey and serialization for EvalKeys?

Thanks in advance.


  1. I cannot post links as a new user. See github hpsc-lab/openfhe-julia/blob/main/src/serial.cpp and hpsc-lab/SecureArithmetic.jl/blob/main/src/openfhe.jl#L698-L907 ↩︎

@ypolyakov would you have any insights for us? Thank you kindly.

Thank you for bumping this up. Evaluation keys are required for homomorphic operations such as multiplication and rotation. We often need multiple (rotation) keys and they take most of the communication size. These keys are stored separately from the cryptocontext. Conceptually all such keys can be serialized/deserialized using EvalAutomorphism and EvalMult key methods. EvalSum keys are composed of automorphism keys - so, you do not need to separately serialize/deserialize them. In terms of working with the keys in a simpler manner, I recommend looking at the issue for v1.6 Add API for serializing bootstrapping keys · Issue #353 · openfheorg/openfhe-development · GitHub (not in main yet as v1.6 has not been released, it is only in dev right now).