34 namespace PrivateRecommendationsDataPacking {
 
   45     SecureComparisonServer::SecureComparisonServer (
const Paillier &paillierCryptoProvider, 
const Dgk &dgkCryptoProvider, 
const BigInteger &similarityTreshold, 
const size_t l, 
const size_t bucketSize, 
const size_t maxPackedBuckets, 
const std::deque<BigInteger> &emptyBuckets, 
const std::string &configurationPath) :
 
   46         paillierCryptoProvider(paillierCryptoProvider),
 
   47         dgkCryptoProvider(dgkCryptoProvider),
 
   50         emptyBuckets(emptyBuckets),
 
   51         maxPackedBuckets(maxPackedBuckets),
 
   53         dgkComparisonServer(std::make_shared<
DgkComparisonServer>(paillierCryptoProvider, dgkCryptoProvider, l + 1)) {
 
   55         BigInteger twoTimestwoPowLMinusDelta = (BigInteger(2).GetPow(static_cast<unsigned long>(this->l)) - similarityTreshold) * 2;
 
   58         BigInteger partialD = twoTimestwoPowLMinusDelta;
 
   60             partialD += (one << (static_cast<unsigned long>(bucketSize * i))) * twoTimestwoPowLMinusDelta;
 
   75         for (
size_t encryptionIndex = 0; encryptionIndex < packedSimilarityValues.size(); ++encryptionIndex) {
 
   88             size_t encryptedBucketsCount = encryptionIndex < packedSimilarityValues.size() - 1 ? this->
maxPackedBuckets : similarityValueCountInLastEncryption;
 
   94             for (
size_t i = 0; i < encryptedBucketsCount; ++i) {
 
PaillierCiphertext Ciphertext
Provide public access to the T_Ciphertext type. 
 
Implementation of the public-key DGK Cryptosystem. 
 
Definition of class SecureComparisonServer. 
 
T_CryptoProvider::Ciphertext encryptedR
 
 
std::weak_ptr< SecureComparisonClient > secureComparisonClient
A reference to the SecureComparisonClient. 
 
std::deque< Paillier::Ciphertext > EncryptedUserData
Encrypted user data. 
 
const std::deque< BigInteger > & emptyBuckets
Empty buckets . 
 
const BigInteger & GetEmptyBucket(const size_t index) const 
Fetch an empty bucket for the given index. 
 
const std::shared_ptr< DgkComparisonServer > & GetDgkComparisonServer() const 
Getter for this->dgkComparisonServer. 
 
Definition of class SecureComparisonClient. 
 
Paillier::Ciphertext encryptedPartialD
 
 
size_t maxPackedBuckets
The maximum number of buckets that fit in one encryption. 
 
virtual Ciphertext EncryptIntegerNonrandom(const BigInteger &plaintext) const 
Encrypt number without randomization. 
 
Implementation of the public-key Paillier Cryptosystem. 
 
const std::shared_ptr< DgkComparisonServer > dgkComparisonServer
A reference to the DgkComparisonServer. 
 
std::deque< BigInteger > ri
 
 
std::deque< Paillier::Ciphertext > PackedData
Packed data. 
 
SecureComparisonServer(const Paillier &paillierCryptoProvider, const Dgk &dgkCryptoProvider, const BigInteger &similarityTreshold, const size_t l, const size_t bucketSize, const size_t maxPackedBuckets, const std::deque< BigInteger > &emptyBuckets, const std::string &configurationPath)
Constructor. 
 
RandomizerCache< BlindingFactorContainer > blindingFactorCache
Blinding factor cache instance. 
 
EncryptedUserData Compare(const PackedData &packedSimilarityValues, const size_t similarityValueCountInLastEncryption)
Interactive secure comparison. 
 
Stores precomputed random data. 
 
Comparison blinding factor cache parameter container struct. 
 
void SetClient(const std::shared_ptr< SecureComparisonClient > &secureComparisonClient)
Setter for this->secureComparisonClient.