How to serialize the SchemeSwitching keys

Hi all,
I wanted to use schemeswitching to outsource the comparison. But I do not how to serialize the keys about schemeswitching. Because the bootstrapping keys are serialized as evalmult keys and rotation keys, I think the schemeswitching may be as evalkeys. I serialize the context and keys(only CKKS and FHEW), but the comparison do not work after reading the context and keys.

I want to know how to serialize the schemeswitching keys and extra information. Thanks for your help.

The error occurs in the slotsToCoeffs. The error is

ckksrns/ckksrns-schemeswitching.cpp:1041 Precomputations for 0 slots were not generated Need to call EvalCKKSToFHEWPrecompute to proceed

I do not understand the slots is 0.

Hi Cesare, the scheme switching serialization is quite complicated because of the different cryptocontexts and keys that are needed. The error you see signals that deserialization is not performed correctly in your code (the slots is not set, so it defaults to the value 0).

The full serialization functionality is currently in the dev branch, not in main. It will be merged in the next version. But you can check openfhe-development/src/pke/examples/scheme-switching-serial.cpp at dev · openfheorg/openfhe-development · GitHub to see an example of the scheme switching serialization.

Thanks for you reply.
I’m reading the source code and the papers right now, because I am not familiar to chimera and pegasus.
Looking forward to the relevant features being added.