Template Class MultipartyBase

Template Parameter Order

  1. class Element

Class Documentation

template<class Element>
class lbcrypto::MultipartyBase

Abstract interface class for LBC Multiparty algorithms based on threshold FHE. A version of this multiparty scheme built on the BGV scheme is seen here:

  • Asharov G., Jain A., López-Alt A., Tromer E., Vaikuntanathan V., Wichs D. (2012) Multiparty Computation with Low Communication, Computation and Interaction via Threshold FHE. In: Pointcheval D., Johansson T. (eds) Advances in Cryptology – EUROCRYPT 2012. EUROCRYPT 2012. Lecture Notes in Computer Science, vol 7237. Springer, Berlin, Heidelberg

During offline key generation, this multiparty scheme relies on the clients coordinating their public key generation. To do this, a single client generates a public-secret key pair. This public key is shared with other keys which use an element in the public key to generate their own public keys. The clients generate a shared key pair using a scheme-specific approach, then generate re-encryption keys. Re-encryption keys are uploaded to the server. Clients encrypt data with their public keys and send the encrypted data server. The data is re-encrypted. Computations are then run on the data. The result is sent to each of the clients. One client runs a “Leader” multiparty decryption operation with its own secret key. All other clients run a regular “Main” multiparty decryption with their own secret key. The resulting partially decrypted ciphertext are then fully decrypted with the decryption fusion algorithms.

Template Parameters

Element – a ring element.

Public Functions

inline virtual ~MultipartyBase()
virtual KeyPair<Element> MultipartyKeyGen(CryptoContext<Element> cc, const std::vector<PrivateKey<Element>> &privateKeyVec, bool makeSparse)

Threshold FHE: Generates a public key from a vector of secret shares. ONLY FOR DEBUGGIN PURPOSES. SHOULD NOT BE USED IN PRODUCTION.

Parameters
  • cc – cryptocontext for the keys to be generated.

  • secretkeys – secrete key shares.

  • makeSparse – set to true if ring reduce by a factor of 2 is to be used. NOT SUPPORTED BY ANY SCHEME ANYMORE.

Returns

key pair including the private for the current party and joined public key

virtual KeyPair<Element> MultipartyKeyGen(CryptoContext<Element> cc, const PublicKey<Element> publicKey, bool makeSparse, bool fresh)

Threshold FHE: Generation of a public key derived from a previous joined public key (for prior secret shares) and the secret key share of the current party.

Parameters
  • cc – cryptocontext for the keys to be generated.

  • pk1 – joined public key from prior parties.

  • makeSparse – set to true if ring reduce by a factor of 2 is to be used. NOT SUPPORTED BY ANY SCHEME ANYMORE.

  • fresh – set to true if proxy re-encryption is used in the multi-party protocol or star topology is used

Returns

key pair including the secret share for the current party and joined public key

virtual EvalKey<Element> MultiKeySwitchGen(const PrivateKey<Element> oldPrivateKey, const PrivateKey<Element> newPrivateKey, const EvalKey<Element> evalKey) const

Threshold FHE: Generates a joined evaluation key from the current secret share and a prior joined evaluation key

Parameters
  • originalPrivateKey – secret key transformed from.

  • newPrivateKey – secret key transformed to.

  • ek – the prior joined evaluation key.

Returns

the new joined evaluation key.

virtual std::shared_ptr<std::map<usint, EvalKey<Element>>> MultiEvalAutomorphismKeyGen(const PrivateKey<Element> privateKey, const std::shared_ptr<std::map<usint, EvalKey<Element>>> evalKeyMap, const std::vector<usint> &indexVec) const

Threshold FHE: Generates joined automorphism keys from the current secret share and prior joined automorphism keys

Parameters
  • privateKey – secret key share.

  • evalKeyMap – a dictionary with prior joined automorphism keys.

  • &indexVec – a vector of automorphism indices.

Returns

a dictionary with new joined automorphism keys.

virtual std::shared_ptr<std::map<usint, EvalKey<Element>>> MultiEvalAtIndexKeyGen(const PrivateKey<Element> privateKey, const std::shared_ptr<std::map<usint, EvalKey<Element>>> evalKeyMap, const std::vector<int32_t> &indexVec) const

Threshold FHE: Generates evaluation keys for a list of indices for a multi-party setting Currently works only for power-of-two and cyclic-group cyclotomics

Parameters
  • privateKey – secret share

  • evalKeyMap – evaluation key set from other party (parties)

  • indexVec – list of indices to be computed

Returns

returns the joined evaluation keys

virtual std::shared_ptr<std::map<usint, EvalKey<Element>>> MultiEvalSumKeyGen(const PrivateKey<Element> privateKey, const std::shared_ptr<std::map<usint, EvalKey<Element>>> evalKeyMap) const

Threshold FHE: Generates joined summation evaluation keys from the current secret share and prior joined summation keys

Parameters
  • privateKey – secret key share.

  • evalKeyMap – a dictionary with prior joined summation keys.

Returns

new joined summation keys.

virtual Ciphertext<Element> MultipartyDecryptMain(ConstCiphertext<Element> ciphertext, const PrivateKey<Element> privateKey) const

Threshold FHE: “Partial” decryption computed by all parties except for the lead one

Parameters
  • ciphertext – ciphertext that is being decrypted.

  • privateKey – secret key share used for decryption.

virtual Ciphertext<Element> MultipartyDecryptLead(ConstCiphertext<Element> ciphertext, const PrivateKey<Element> privateKey) const

Threshold FHE: Method for decryption operation run by the lead decryption client

Parameters
  • ciphertext – ciphertext id decrypted.

  • privateKey – secret key share used for decryption.

virtual DecryptResult MultipartyDecryptFusion(const std::vector<Ciphertext<Element>> &ciphertextVec, NativePoly *plaintext) const

Threshold FHE: Method for combining the partially decrypted ciphertexts and getting the final decryption in the clear as a NativePoly.

Parameters
  • &ciphertextVec – vector of “partial” decryptions.

  • *plaintext – the plaintext output as a NativePoly.

Returns

the decoding result.

inline virtual DecryptResult MultipartyDecryptFusion(const std::vector<Ciphertext<Element>> &ciphertextVec, Poly *plaintext) const

Threshold FHE: Method for combining the partially decrypted ciphertexts and getting the final decryption in the clear as a Poly.

Parameters
  • &ciphertextVec – vector of “partial” decryptions.

  • *plaintext – the plaintext output as a Poly.

Returns

the decoding result.

virtual PublicKey<Element> MultiAddPubKeys(PublicKey<Element> publicKey1, PublicKey<Element> publicKey2) const

Threshold FHE: Adds two prior public keys

Parameters
  • evalKey1 – first public key.

  • evalKey2 – second public key.

Returns

the new joined key.

virtual EvalKey<Element> MultiAddEvalKeys(EvalKey<Element> evalKey1, EvalKey<Element> evalKey2) const

Threshold FHE: Adds two prior evaluation keys

Parameters
  • evalKey1 – first evaluation key.

  • evalKey2 – second evaluation key.

Returns

the new joined key.

virtual EvalKey<Element> MultiAddEvalMultKeys(EvalKey<Element> evalKey1, EvalKey<Element> evalKey2) const

Threshold FHE: Adds two partial evaluation keys for multiplication

Parameters
  • evalKey1 – first evaluation key.

  • evalKey2 – second evaluation key.

Returns

the new joined key.

virtual EvalKey<Element> MultiMultEvalKey(PrivateKey<Element> privateKey, EvalKey<Element> evalKey) const

Threshold FHE: Generates a partial evaluation key for homomorphic multiplication based on the current secret share and an existing partial evaluation key

Parameters
  • privateKey – current secret share.

  • evalKey – prior evaluation key.

Returns

the new joined key.

virtual std::shared_ptr<std::map<usint, EvalKey<Element>>> MultiAddEvalAutomorphismKeys(const std::shared_ptr<std::map<usint, EvalKey<Element>>> evalKeyMap1, const std::shared_ptr<std::map<usint, EvalKey<Element>>> evalKeyMap2) const

Threshold FHE: Adds two prior evaluation key sets for automorphisms

Parameters
  • evalKeyMap1 – first automorphism key set.

  • evalKeyMap2 – second automorphism key set.

Returns

the new joined key set for summation.

virtual std::shared_ptr<std::map<usint, EvalKey<Element>>> MultiAddEvalSumKeys(const std::shared_ptr<std::map<usint, EvalKey<Element>>> evalKeyMap1, const std::shared_ptr<std::map<usint, EvalKey<Element>>> evalKeyMap2) const

Threshold FHE: Adds two prior evaluation key sets for summation

Parameters
  • evalKeyMap1 – first summation key set.

  • evalKeyMap2 – second summation key set.

Returns

the new joined key set for summation.

virtual Ciphertext<Element> IntMPBootAdjustScale(ConstCiphertext<Element> ciphertext) const

Threshold FHE: Prepare a ciphertext for Multi-Party Interactive Bootstrapping

Parameters

ciphertext – Input Ciphertext

Returns

: Resulting Ciphertext

virtual Ciphertext<Element> IntMPBootRandomElementGen(std::shared_ptr<CryptoParametersCKKSRNS> params, const PublicKey<Element> publicKey) const

Threshold FHE: Generate a common random polynomial for Multi-Party Interactive Bootstrapping

Parameters

publicKey – the scheme public key (you can also provide the lead party’s public-key)

Returns

: Resulting ring element

virtual std::vector<Ciphertext<Element>> IntMPBootDecrypt(const PrivateKey<Element> privateKey, ConstCiphertext<Element> ciphertext, ConstCiphertext<Element> a) const

Threshold FHE: Does masked decryption as part of Multi-Party Interactive Bootstrapping. Each party calls this function as part of the protocol

Parameters
  • privateKey – secret key share for party i

  • ciphertext – input ciphertext

  • a – input common random polynomial

Returns

: Resulting masked decryption

virtual std::vector<Ciphertext<Element>> IntMPBootAdd(std::vector<std::vector<Ciphertext<Element>>> &sharesPairVec) const

Threshold FHE: Aggregates a vector of masked decryptions and re-encryotion shares, which is the second step of the interactive multiparty bootstrapping procedure.

Parameters

sharesPairVec – vector of pair of ciphertexts, each element of this vector contains (h_0i, h_1i) - the masked-decryption and encryption shares ofparty i

Returns

: aggregated pair of shares ((h_0, h_1)

virtual Ciphertext<Element> IntMPBootEncrypt(const PublicKey<Element> publicKey, const std::vector<Ciphertext<Element>> &sharesPair, ConstCiphertext<Element> a, ConstCiphertext<Element> ciphertext) const

Threshold FHE: Does public key encryption of lead party’s masked decryption as part of interactive multi-party bootstrapping, which increases the ciphertext modulus and enables future computations. This operation is done by the lead party as the final step of interactive multi-party bootstrapping.

Parameters
  • publicKey – the lead party’s public key

  • sharesPair – aggregated decryption and re-encryption shares

  • a – common random ring element

  • ciphertext – input ciphertext

Returns

: Resulting encryption

template<class Archive>
inline void save(Archive &ar, std::uint32_t const version) const
template<class Archive>
inline void load(Archive &ar, std::uint32_t const version)
inline std::string SerializedObjectName() const