# CKKS-Threshold, Setting up a client and a server

**URL:** <https://openfhe.discourse.group/t/ckks-threshold-setting-up-a-client-and-a-server/414>\
**Category:** FHE Use Cases\
**Created:** [March 15, 2023, 10:44pm UTC](https://openfhe.discourse.group/t/ckks-threshold-setting-up-a-client-and-a-server/414 "2023-03-15T22:44:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stylianos\_x](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@stylianos\_x](https://openfhe.discourse.group/u/stylianos_x)\
**Post date:** [March 15, 2023, 10:44pm UTC](https://openfhe.discourse.group/t/ckks-threshold-setting-up-a-client-and-a-server/414/1 "2023-03-15T22:44:00Z")

</div>

Hello, I’m trying to setup a server and clients with socket programming using [select](https://man7.org/linux/man-pages/man2/select.2.html). I want to encrypt the plaintext in the clients, perform a sum in the server and return the result to the clients and decrypt it.

I understand that I have to KeyGen in the server, then pass the public key to the clients, use MultipartyKeyGen to generate a key pair for the client and then perform encryption and send back the encrypted data with the public key of the client, is that right?

I’m trying to find a way to pass the server’s public key to the client but so far I’ve seen suggestions such as serialization however I’m not sure if this the correct way to proceed.

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [March 16, 2023, 12:05am UTC](https://openfhe.discourse.group/t/ckks-threshold-setting-up-a-client-and-a-server/414/2 "2023-03-16T00:05:17Z")

</div>

I don’t know enough to answer your first question, but with regards to

> I’m trying to find a way to pass the server’s public key to the client but so far I’ve seen suggestions such as serialization however I’m not sure if this the correct way to proceed.

Yes, serialization is the right way to pass around the keys. See the various examples here: [PALISADE-serial-examples](https://gitlab.com/palisade/palisade-serial-examples). See this relevant thread too: [What's the best way to use openFHE on two sides?](https://openfhe.discourse.group/t/whats-the-best-way-to-use-openfhe-on-two-sides/380)

---

<div class="post-metadata">

**Author:** ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)\
**Post date:** [June 19, 2023, 1:36pm UTC](https://openfhe.discourse.group/t/ckks-threshold-setting-up-a-client-and-a-server/414/3 "2023-06-19T13:36:26Z")

</div>

A newer version of [PALISADE / PALISADE serial examples · GitLab](https://gitlab.com/palisade/palisade-serial-examples) is going to be released shortly that uses grpc. the earlier version that @iquah refers to does use a simple socket approach.
