SeComLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SeComLib::PrivateRecommendationsDataPacking::Client Class Reference

Client. More...

#include <client.h>

Public Member Functions

 Client (const std::shared_ptr< ServiceProvider > &serviceProvider, const std::shared_ptr< PrivacyServiceProvider > &privacyServiceProvider, const PaillierPublicKey &publicKey)
 Constructor. More...
 
 ~Client ()
 Destructor - void implementation.
 
const
ServiceProvider::EncryptedUserDataContainer
GetNormalizedScaledRatings () const
 Get \( [\tilde{V}_i^d] \). More...
 
const
ServiceProvider::PackedItems
GetSparseRatings () const
 Get \( [V_i^{Packed}] \). More...
 
void ComputeRecommendations ()
 Interact with the server(s) to extract the recommendations for every user. More...
 

Private Types

typedef
DecryptionBlindingFactorContainer
< Paillier,
BlindingFactorCacheParameters
BlindingFactorContainer
 Alias for the blinding factor container.
 

Private Member Functions

std::deque< BigInteger > computeEmptyBuckets (const size_t L) const
 Computes the empty buckets \( 2^{i * bucketSize} \). More...
 
ServiceProvider::PackedData packUserSparseRatings (const std::deque< unsigned long > &userPlaintextSparseRatings, const std::deque< BigInteger > &userEmptyBuckets) const
 Pack the sparse ratings for one user. More...
 
 Client (Client const &)
 Copy constructor - not implemented.
 
Client operator= (Client const &)
 Copy assignment operator - not implemented.
 

Private Attributes

const std::shared_ptr
< ServiceProvider
serviceProvider
 A reference to the ServiceProvider.
 
const std::shared_ptr
< PrivacyServiceProvider
privacyServiceProvider
 A reference to the PrivacyServiceProvider.
 
Paillier paillierCryptoProvider
 Paillier crypto provider.
 
size_t userCount
 Number of users who need recommendations.
 
size_t itemCount
 Number of ratings per user.
 
size_t denselyRatedItemCount
 Number of densely rated items.
 
size_t ratingBitSize
 The size of the user ratings (in bits)
 
size_t scaledNormalizedRatingBitSize
 k - The size of the scaled normalized ratings (in bits)
 
unsigned int digitsToPreserve
 Number of digits preserved from the normalized user ratings.
 
size_t kappa
 The security parameter for the secure comparison protocol (in bits)
 
size_t hatL
 The upper bound of most similar users ( \( \hat{L} > L \))
 
std::deque< BigInteger > emptyBuckets
 Empty buckets \( (2^{t + \lceil\log{\hat{L}}\rceil})^i \), where \( t \) is the bit size of the ratings.
 
std::string ratingsFilePath
 The path to the file containing precomputed ratings.
 
ServiceProvider::EncryptedUserDataContainer normalizedScaledRatings
 \( [\tilde{V}_i^d] \)
 
std::deque< std::deque
< unsigned long > > 
plaintextSparseRatings
 \( V_i^p \)
 
ServiceProvider::PackedItems sparseRatings
 \( [V_i^{Packed}] \)
 
RandomizerCache
< BlindingFactorContainer
LdecryptionBlindingFactorCache
 \( L \) decryption blinding factor cache instance
 
RandomizerCache
< BlindingFactorContainer
URSumDecryptionBlindingFactorCache
 \( UR^{sum} \) decryption blinding factor cache instance
 

Static Private Attributes

static const std::string configurationPath
 Service Provider configuration path. More...
 

Detailed Description

Client.

Definition at line 62 of file private_recommendations_data_packing/client.h.

Constructor & Destructor Documentation

SeComLib::PrivateRecommendationsDataPacking::Client::Client ( const std::shared_ptr< ServiceProvider > &  serviceProvider,
const std::shared_ptr< PrivacyServiceProvider > &  privacyServiceProvider,
const PaillierPublicKey publicKey 
)

Constructor.

Assumes that the client has a secure channel to the PrivacyServiceProvider.

Parameters
serviceProvidera ServiceProvider instance
privacyServiceProvidera PrivacyServiceProvider instance
publicKeythe Paillier public key of the PrivacyServiceProvider
Exceptions
std::runtime_errorthe ratings file can't be opened

Compute the empty buckets first

Load ratings from file

Pack the sparse ratings

Definition at line 48 of file private_recommendations_data_packing/client.cpp.

Member Function Documentation

std::deque< BigInteger > SeComLib::PrivateRecommendationsDataPacking::Client::computeEmptyBuckets ( const size_t  L) const
private

Computes the empty buckets \( 2^{i * bucketSize} \).

Parameters
Lthe number of similar users
Returns
the empty buckets

Precompute \( \lceil log_2(\hat{L}) \rceil \) and initialize the sparse ratings data packer

\( t + \lceil\log{\hat{L}}\rceil \)

We need to reserve \( \kappa \) extra bits in each encryption in order to perform secure blinding In order not to cause overflows during secure blinding, we reserve another 2 extra bits at the top of each encryption, such that if size(r) = size(message space) - 2, then r + d < message space

Pre-compute the empty buckets \( 2^{i * bucketSize} \)

Definition at line 262 of file private_recommendations_data_packing/client.cpp.

void SeComLib::PrivateRecommendationsDataPacking::Client::ComputeRecommendations ( )

Interact with the server(s) to extract the recommendations for every user.

Fetches encrypted values from the Service Provider, blinds them and sends them to the Privacy Service Provider for decryption.

Fetch \( [L] \) and \( [UR_{sum}] \) from the Service Provider

\( L = Dec([L][r]) - r \)

If \( L < \hat{L} \) the server computed the proper recommendations

If \( L >= \hat{L} \) the sparse ratings need to be repacked and sent to the server in order to recompute the recommendations

Unpack \( UR_{sum} \)

\( UR_{sum} = Dec([UR_{sum}][r]) - r \)

There are (items - denselyRelatedItems) packed buckets in total, so the last encryption may have unpopulated buckets, which we ignore

Definition at line 170 of file private_recommendations_data_packing/client.cpp.

const ServiceProvider::EncryptedUserDataContainer & SeComLib::PrivateRecommendationsDataPacking::Client::GetNormalizedScaledRatings ( ) const

Get \( [\tilde{V}_i^d] \).

Returns
\( [\tilde{V}_i^d] \)

Definition at line 156 of file private_recommendations_data_packing/client.cpp.

const ServiceProvider::PackedItems & SeComLib::PrivateRecommendationsDataPacking::Client::GetSparseRatings ( ) const

Get \( [V_i^{Packed}] \).

Returns
\( [V_i^{Packed}] \)

Definition at line 163 of file private_recommendations_data_packing/client.cpp.

ServiceProvider::PackedData SeComLib::PrivateRecommendationsDataPacking::Client::packUserSparseRatings ( const std::deque< unsigned long > &  userPlaintextSparseRatings,
const std::deque< BigInteger > &  userEmptyBuckets 
) const
private

Pack the sparse ratings for one user.

Parameters
userPlaintextSparseRatingsthe plaintext sparse ratings
userEmptyBucketsthe empty buckets
Returns
packed user sparse ratings

Definition at line 291 of file private_recommendations_data_packing/client.cpp.

Member Data Documentation

const std::string SeComLib::PrivateRecommendationsDataPacking::Client::configurationPath
staticprivate

Service Provider configuration path.

Set the configuration path.

Definition at line 94 of file private_recommendations_data_packing/client.h.


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