KeySwitch key serialization

I suggest reading this thread: What's the best way to use openFHE on two sides?. It should contain answers to your questions.