Template Class HEKeyGenerator< Scheme::CKKS >

Class Documentation

template<>
class HEKeyGenerator<Scheme::CKKS>

HEKeyGenerator is responsible for generating various keys used in homomorphic encryption, such as secret keys, public keys, relinearization keys, Galois keys, and switch keys.

The HEKeyGenerator class is initialized with encryption parameters and provides methods to generate the keys required for different homomorphic encryption schemes. It helps facilitate the encryption, decryption, and key switching operations.

Additionally, the class supports multiparty computation (MPC) by implementing key generation protocols for collaborative schemes. These include the generation of multiparty public keys, relinearization keys, and Galois keys. The implementation is based on the techniques described in the paper “Multiparty Homomorphic Encryption from

Ring-Learning-With-Errors”.

Public Functions

HEKeyGenerator(HEContext<Scheme::CKKS> context)

Constructs a new HEKeyGenerator object with specified parameters.

Parameters:

context – Reference to the Parameters object that sets the encryption parameters.

void generate_secret_key(Secretkey<Scheme::CKKS> &sk, const ExecutionOptions &options = ExecutionOptions())

Generates a secret key.

Parameters:

sk – Reference to the Secretkey object where the generated secret key will be stored.

void generate_secret_key_v2(Secretkey<Scheme::CKKS> &sk, const ExecutionOptions &options = ExecutionOptions())
void generate_public_key(Publickey<Scheme::CKKS> &pk, Secretkey<Scheme::CKKS> &sk, const ExecutionOptions &options = ExecutionOptions())

Generates a public key using a secret key.

Parameters:
  • pk – Reference to the Publickey object where the generated public key will be stored.

  • sk – Reference to the Secretkey object used to generate the public key.

inline void generate_relin_key(Relinkey<Scheme::CKKS> &rk, Secretkey<Scheme::CKKS> &sk, const ExecutionOptions &options = ExecutionOptions())

Generates a relinearization key using a secret key.

Parameters:
  • rk – Reference to the Relinkey object where the generated relinearization key will be stored.

  • sk – Reference to the Secretkey object used to generate the relinearization key.

inline void generate_galois_key(Galoiskey<Scheme::CKKS> &gk, Secretkey<Scheme::CKKS> &sk, const ExecutionOptions &options = ExecutionOptions())

Generates a Galois key using a secret key.

Parameters:
  • gk – Reference to the Galoiskey object where the generated Galois key will be stored.

  • sk – Reference to the Secretkey object used to generate the Galois key.

inline void generate_switch_key(Switchkey<Scheme::CKKS> &swk, Secretkey<Scheme::CKKS> &new_sk, Secretkey<Scheme::CKKS> &old_sk, const ExecutionOptions &options = ExecutionOptions())

Generates a switch key for key switching between two secret keys.

Parameters:
  • swk – Reference to the Switchkey object where the generated switch key will be stored.

  • new_sk – Reference to the new Secretkey object to switch to.

  • old_sk – Reference to the old Secretkey object to switch from.

inline int get_seed() const noexcept

Returns the seed of the key generator.

Returns:

int Seed of the key generator.

inline void set_seed(int new_seed)

Sets the seed of the key generator with new seed.

inline int get_offset() const noexcept

Returns the offset of the key generator(curand).

Returns:

int Offset of the key generator.

inline void set_offset(int new_offset)

Sets the offset of the key generator with new offset(curand).

HEKeyGenerator() = delete
HEKeyGenerator(const HEKeyGenerator &copy) = delete
HEKeyGenerator(HEKeyGenerator &&source) = delete
HEKeyGenerator &operator=(const HEKeyGenerator &assign) = delete
HEKeyGenerator &operator=(HEKeyGenerator &&assign) = delete