Generate private key from a predefined value

Are there any ways in OpenFHE that I can generate a private key (in PKE mode) from a predefined value (an integer, bytestreams, etc.)?

Can you explain the use case you are trying to implement?
For example, are you trying to generate multiple copies of the same private keys at different sites based on a smaller seed that you distribute?

I am prototyping a scheme that allows multiple clients to perform the federated learning strategy, where there is an server takes the responsibility of taking care the aggregation of local updates. The homomorphic encryption can help us to do that by providing the encryption at local clients & homomorphic operations on the server. However, the clients need to have the same private keys (at least in my design).

I am thinking of a strategy like using a key exchange (like Burmeister-Desmedt Key Exchange) can work on the scenario. After the key exchange, clients can have the same secret values (in form of integer). From this integer, I am looking for implementation of a key deriviation function that can convert this same secret number into CKKS key.

You can serialize the cryptocontext and encryption keys and load them as many as you want.
Check the load and save methods in the CryptoContextImpl, PrivateKeyImpl, and PublicKeyImpl classes.

I suggest using Threshold FHE (the multiparty mode). In this case, each client will only have a secret share (no one will have a complete secret key). See https://www.pnas.org/doi/10.1073/pnas.2304415120 or Homomorphic Encryption for OpenFHE Users – OpenFHE.org for more details. Having multiple copies of the same secret key in many places is typically not recommended as it increases the attack surface.

1 Like
  1. In the multiparty part, is it true that if I have a large set of clients (like 100), I need to have the to combine the key of 100 clients right? I am targeting small devices so I am wonder that if it is really what I am expecting.
  2. About having multiple copies of the same secret key, I am at first working with honest-but-curious server (like it will compute everything right, but try to learn something from the data/key generation), and clients are honest (that they will follow the protocol but not messing up). With my description here, can you have advice about the attack surface you mentioned?
  3. I am curious on how OpenFHE generates the private key for the CKKS algorithm. Like I know there will be three distributions for the key are Ternary, Uniform or Sparse. But I haven’t found how OpenFHE generate these streams? Can you please suggest me the part of code for generating the key? I am thinking of using the same number as a feed for a cryptographic PRNG for the stream.

Thank you so much!

Here is the method that is used to sample the secret key following a ternary uniform distribution, and it is called from here. You could modify the code and set the secret key as you wish, at your own risk.

1 Like