HEaaN
Crypto Lab's great homomorphic encryption library
Public Member Functions | Private Attributes | List of all members
HEaaN::CollectiveKeyGenerator Class Reference

A class generating public keys from secret keys provided by multiple parties. More...

#include <CollectiveKeyGenerator.hpp>

Public Member Functions

 CollectiveKeyGenerator (const Context &context)
 Construct a CollectiveKeyGenerator object with a given context. More...
 
 CollectiveKeyGenerator (const Context &context, const Context &context_sparse)
 Construct a module for generating collective key including keys for sparse secret encapsulation for the given context. More...
 
CollectiveKeyGenData genCommonRandomData (const CollectiveKeyGenConfig &config) const
 Generate a random data to be shared among parties for collective key generation. More...
 
CollectiveKeyGenData genKeyShare (const SecretKey &sk, const CollectiveKeyGenData &crd) const
 Generate key share, the data which can be aggregated to generate collective key for encryption / conjugation / rotation / sparse secret encapsulation. More...
 
CollectiveKeyGenData aggregateKeyShare (const std::vector< const CollectiveKeyGenData * > &parts) const
 Aggregate key share from each party. More...
 
CollectiveKeyGenData genMultKeyShareRoundOne (const SecretKey &sk, const SecretKey &tmp_sk, const CollectiveKeyGenData &crd) const
 Perform round one for collective mult(relinearization) key generation. More...
 
CollectiveKeyGenData genMultKeyShareRoundTwo (const SecretKey &sk, const SecretKey &tmp_sk, const CollectiveKeyGenData &data_round_one) const
 Perform round two for collective mult(relinearization) key generation. More...
 
std::shared_ptr< EncryptionKey > genEncKey (const CollectiveKeyGenData &crd, const CollectiveKeyGenData &agg) const
 Collectively generate key for encryption. More...
 
std::shared_ptr< EvaluationKey > genConjKey (const CollectiveKeyGenData &crd, const CollectiveKeyGenData &agg) const
 Collectively generate key for conjugation. More...
 
std::shared_ptr< EvaluationKey > genRotKey (const CollectiveKeyGenData &crd, const CollectiveKeyGenData &agg) const
 Collectively generate key for rotation. More...
 
std::shared_ptr< EvaluationKey > genMultKey (const CollectiveKeyGenData &data_round_one, const CollectiveKeyGenData &data_round_two) const
 Collectively generate key for multiplication. More...
 
std::shared_ptr< SparseSecretEncapsulationKey > genSparseSecretEncapsulationKey (const CollectiveKeyGenData &crd, const CollectiveKeyGenData &agg) const
 Collectively generate key for sparse secret encapsulation. More...
 

Private Attributes

std::shared_ptr< CollectiveKeyGeneratorImpl > impl_
 

Detailed Description

A class generating public keys from secret keys provided by multiple parties.

Generate collectively known public key for encryption / multiplication / conjugation / rotation / sparse secret encapsulation. The class member functions should be performed in sequential order.

Constructor & Destructor Documentation

◆ CollectiveKeyGenerator() [1/2]

HEaaN::CollectiveKeyGenerator::CollectiveKeyGenerator ( const Context context)
explicit

Construct a CollectiveKeyGenerator object with a given context.

◆ CollectiveKeyGenerator() [2/2]

HEaaN::CollectiveKeyGenerator::CollectiveKeyGenerator ( const Context context,
const Context context_sparse 
)
explicit

Construct a module for generating collective key including keys for sparse secret encapsulation for the given context.

Exceptions
RuntimeExceptionif context_sparse is not a context constructed with the corresponding sparse parameter of which constructed context. Please refer to getSparseParameterPresetFor() on ParameterPreset.hpp for the sparse parameters.

Member Function Documentation

◆ aggregateKeyShare()

CollectiveKeyGenData HEaaN::CollectiveKeyGenerator::aggregateKeyShare ( const std::vector< const CollectiveKeyGenData * > &  parts) const

Aggregate key share from each party.

Parameters
[in]partsa vector of key shares obtained from genKeyShare().
Exceptions
RuntimeExceptionif all the parts is not created to generate the same key.
Returns
Returns aggregated key share for the same key for which parts were generated. aggregated key share is used to generate collective key in genAndSaveCollectiveKey().

As computation which is performed on this function is addition, user may eagerly evaluate aggregation when only a subset of required CollectiveKeyGenData are prepared, as below : auto aggregated_part_AB = aggregateKeyShare({&part_A, &part_B}); auto aggregated_part_ABC = aggregateKeyShare({&aggregated_part_AB, &part_C});

◆ genCommonRandomData()

CollectiveKeyGenData HEaaN::CollectiveKeyGenerator::genCommonRandomData ( const CollectiveKeyGenConfig config) const

Generate a random data to be shared among parties for collective key generation.

Parameters
[in]configConfiguration representing the key type for which collective key generated.
Returns
Returns a random data which can be used to generate key share in genKeyShare().

◆ genConjKey()

std::shared_ptr<EvaluationKey> HEaaN::CollectiveKeyGenerator::genConjKey ( const CollectiveKeyGenData crd,
const CollectiveKeyGenData agg 
) const

Collectively generate key for conjugation.

Parameters
[in]crdCommon random data obtained from genCommonRandomData().
[in]aggaggregated key share obtained from aggregateKeyShare().
Exceptions
RuntimeExceptionif crd or agg are not created to generate conjugation key

◆ genEncKey()

std::shared_ptr<EncryptionKey> HEaaN::CollectiveKeyGenerator::genEncKey ( const CollectiveKeyGenData crd,
const CollectiveKeyGenData agg 
) const

Collectively generate key for encryption.

Parameters
[in]crdCommon random data obtained from genCommonRandomData().
[in]aggaggregated key share obtained from aggregateKeyShare().
Exceptions
RuntimeExceptionif crd or agg are not created to generate encryption key

◆ genKeyShare()

CollectiveKeyGenData HEaaN::CollectiveKeyGenerator::genKeyShare ( const SecretKey sk,
const CollectiveKeyGenData crd 
) const

Generate key share, the data which can be aggregated to generate collective key for encryption / conjugation / rotation / sparse secret encapsulation.

Parameters
[in]skSecret key
[in]crdCommon random data obtained from genCommonRandomData().
Returns
Returns key share for the same key for which crd was generated. key shares are aggregated by aggregateKeyShare().

◆ genMultKey()

std::shared_ptr<EvaluationKey> HEaaN::CollectiveKeyGenerator::genMultKey ( const CollectiveKeyGenData data_round_one,
const CollectiveKeyGenData data_round_two 
) const

Collectively generate key for multiplication.

Parameters
[in]data_round_oneReturned data from genMultKeyShareRoundOne().
[in]data_round_twoReturned data from genMultKeyShareRoundTwo().
Exceptions
RuntimeExceptionif data_round_one or data_round_two are not created to generate multiplication key

◆ genMultKeyShareRoundOne()

CollectiveKeyGenData HEaaN::CollectiveKeyGenerator::genMultKeyShareRoundOne ( const SecretKey sk,
const SecretKey tmp_sk,
const CollectiveKeyGenData crd 
) const

Perform round one for collective mult(relinearization) key generation.

Parameters
[in]skSecret key
[in]tmp_sk
[in]crdCommon random data obtained from genCommonRandomData().
Exceptions
RuntimeExceptionif crd is not generated for multiplication key
Returns
Returned data is used in genMultKeyShareRoundTwo().

◆ genMultKeyShareRoundTwo()

CollectiveKeyGenData HEaaN::CollectiveKeyGenerator::genMultKeyShareRoundTwo ( const SecretKey sk,
const SecretKey tmp_sk,
const CollectiveKeyGenData data_round_one 
) const

Perform round two for collective mult(relinearization) key generation.

Parameters
[in]skSecret key
[in]tmp_sk
[in]data_round_oneReturned data from genMultKeyShareRoundOne().
Exceptions
RuntimeExceptionif data_round_one is not generated for multiplication key
Returns
Returned data is used to generate collective key in genAndSaveCollectiveMultKey().

◆ genRotKey()

std::shared_ptr<EvaluationKey> HEaaN::CollectiveKeyGenerator::genRotKey ( const CollectiveKeyGenData crd,
const CollectiveKeyGenData agg 
) const

Collectively generate key for rotation.

Parameters
[in]crdCommon random data obtained from genCommonRandomData().
[in]aggaggregated key share obtained from aggregateKeyShare().
Exceptions
RuntimeExceptionif crd or agg are not created to generate rotation key

◆ genSparseSecretEncapsulationKey()

std::shared_ptr<SparseSecretEncapsulationKey> HEaaN::CollectiveKeyGenerator::genSparseSecretEncapsulationKey ( const CollectiveKeyGenData crd,
const CollectiveKeyGenData agg 
) const

Collectively generate key for sparse secret encapsulation.

Parameters
[in]crdCommon random data obtained from genCommonRandomData().
[in]aggaggregated key share obtained from aggregateKeyShare().
Exceptions
RuntimeExceptionif crd or agg are not created to generate sparse secret encapsulation key

Member Data Documentation

◆ impl_

std::shared_ptr<CollectiveKeyGeneratorImpl> HEaaN::CollectiveKeyGenerator::impl_
private

The documentation for this class was generated from the following file: