A scheme-switching computation needs a CKKS context with its public
key and evaluation keys, the FHEW context inside it with its
bootstrapping keys, the switching key from FHEW to CKKS, and the
ciphertext to work on. SchemeSwitchingDataSerializer writes all of
it to a directory, and SchemeSwitchingDataDeserializer reads it
back in another session, so that one party can set the computation
up and another can run it.
SchemeSwitchingDataSerializer(
crypto_context = NULL,
public_key = NULL,
raw_ciphertext = NULL,
ptr = NULL
)SchemeSwitchingDataDeserializer(ptr = NULL)
set_data_directory(x, dir)
serialize_scheme_switching_data(x)
deserialize_scheme_switching_data(x)
get_raw_ciphertext(x)
The constructors: an S7 object of the class, inheriting from
OpenFHEObject. get_raw_ciphertext(): a Ciphertext, or NULL
before the data has been read. The others: x, invisibly.
A CKKS CryptoContext on which scheme
switching has been set up and its keys generated
(eval_scheme_switching_setup(),
eval_scheme_switching_key_gen()).
The PublicKey of the context.
The Ciphertext to write.
External pointer (internal use).
A SchemeSwitchingDataSerializer or
SchemeSwitchingDataDeserializer.
Character string; the directory.
The writer is made from the context, the public key and the
ciphertext. set_data_directory() names the directory, which must
exist, and serialize_scheme_switching_data() writes the files
(binary format, fixed file names). The multiplication and
automorphism keys written are all those in the key registries.
The reader is made empty. After set_data_directory(),
deserialize_scheme_switching_data() reads the files, registers the
evaluation keys, and puts the FHEW context and the switching key
into the CKKS context. get_crypto_context(), get_public_key()
and get_raw_ciphertext() then return the three objects.
The C++ classes default the directory to demoData under the
working directory. The R functions do not: reading or writing before
set_data_directory() is an error.