SeComLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
private_recommendations_data_packing/secure_comparison_server.h
Go to the documentation of this file.
1 /*
2 SeComLib
3 Copyright 2012-2013 TU Delft, Information Security & Privacy Lab (http://isplab.tudelft.nl/)
4 
5 Contributors:
6 Inald Lagendijk (R.L.Lagendijk@TUDelft.nl)
7 Mihai Todor (todormihai@gmail.com)
8 Thijs Veugen (P.J.M.Veugen@tudelft.nl)
9 Zekeriya Erkin (z.erkin@tudelft.nl)
10 
11 Licensed under the Apache License, Version 2.0 (the "License");
12 you may not use this file except in compliance with the License.
13 You may obtain a copy of the License at
14 
15 http://www.apache.org/licenses/LICENSE-2.0
16 
17 Unless required by applicable law or agreed to in writing, software
18 distributed under the License is distributed on an "AS IS" BASIS,
19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 See the License for the specific language governing permissions and
21 limitations under the License.
22 */
29 #ifndef SECURE_COMPARISON_SERVER_HEADER_GUARD
30 #define SECURE_COMPARISON_SERVER_HEADER_GUARD
31 
32 //include our headers
33 #include "utils/config.h"
34 #include "core/big_integer.h"
35 #include "core/random_provider.h"
36 #include "core/paillier.h"
37 #include "core/dgk.h"
38 #include "core/randomizer_cache.h"
39 
43 
44 namespace SeComLib {
45 using namespace Core;
46 using namespace PrivateRecommendationsUtils;
47 
48 namespace PrivateRecommendationsDataPacking {
49  //forward-declare required classes
50  class SecureComparisonClient;
51 
56  public:
58  typedef std::deque<Paillier::Ciphertext> EncryptedUserData;
59 
61  typedef std::deque<Paillier::Ciphertext> PackedData;
62 
64  typedef std::deque<PackedData> PackedItems;
65 
67  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);
68 
71 
73  EncryptedUserData Compare (const PackedData &packedSimilarityValues, const size_t similarityValueCountInLastEncryption);
74 
76  const BigInteger &GetEmptyBucket (const size_t index) const;
77 
79  void SetClient (const std::shared_ptr<SecureComparisonClient> &secureComparisonClient);
80 
82  const std::shared_ptr<DgkComparisonServer> &GetDgkComparisonServer () const;
83 
84  private:
87 
90 
93 
96 
98  size_t l;
99 
101  const std::deque<BigInteger> &emptyBuckets;
102 
105 
108 
110  const std::shared_ptr<DgkComparisonServer> dgkComparisonServer;
111 
113  std::weak_ptr<SecureComparisonClient> secureComparisonClient;
114 
117 
120  };
121 }//namespace PrivateRecommendationsDataPacking
122 }//namespace SeComLib
123 
124 #endif//SERVICE_PROVIDER_HEADER_GUARD
Implementation of the public-key DGK Cryptosystem.
Definition: dgk.h:104
Definition of class Dgk.
std::weak_ptr< SecureComparisonClient > secureComparisonClient
A reference to the SecureComparisonClient.
Definition of template class RandomizerCache.
Defines BigInteger.
Definition of struct ComparisonBlindingFactorContainer.
Definition of class Config.
Definition of class DgkComparisonServer.
Implementation of the public-key Paillier Cryptosystem.
Definition: paillier.h:103
const std::shared_ptr< DgkComparisonServer > dgkComparisonServer
A reference to the DgkComparisonServer.
Defines RandomProvider.
Definition of class Paillier.
RandomizerCache< BlindingFactorContainer > blindingFactorCache
Blinding factor cache instance.
ComparisonBlindingFactorContainer< Paillier, ComparisonBlindingFactorCacheParameters > BlindingFactorContainer
Alias for the blinding factor container.
Definition of struct ComparisonBlindingFactorCacheParameters.