#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... | |
Definition at line 62 of file private_recommendations_data_packing/client.h.
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.
serviceProvider | a ServiceProvider instance |
privacyServiceProvider | a PrivacyServiceProvider instance |
publicKey | the Paillier public key of the PrivacyServiceProvider |
std::runtime_error | the 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.
|
private |
Computes the empty buckets \( 2^{i * bucketSize} \).
L | the number of similar users |
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] \).
Definition at line 156 of file private_recommendations_data_packing/client.cpp.
const ServiceProvider::PackedItems & SeComLib::PrivateRecommendationsDataPacking::Client::GetSparseRatings | ( | ) | const |
Get \( [V_i^{Packed}] \).
Definition at line 163 of file private_recommendations_data_packing/client.cpp.
|
private |
Pack the sparse ratings for one user.
userPlaintextSparseRatings | the plaintext sparse ratings |
userEmptyBuckets | the empty buckets |
Definition at line 291 of file private_recommendations_data_packing/client.cpp.
|
staticprivate |
Service Provider configuration path.
Set the configuration path.
Definition at line 94 of file private_recommendations_data_packing/client.h.