SeComLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
secure_extremum_selection/server.cpp
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 */
30 #include "server.h"
31 //avoid circular includes
32 #include "client.h"
33 
34 namespace SeComLib {
35 namespace SecureExtremumSelection {
39  const std::string Server::configurationPath("SecureExtremumSelection");
40 
45  Server::Server (const PaillierPublicKey &paillierPublicKey, const DgkPublicKey &dgkPublicKey) :
46  paillierCryptoProvider(paillierPublicKey),
47  dgkCryptoProvider(dgkPublicKey),
48  secureExtremumSelectionServer(std::make_shared<SecureExtremumSelectionServer<SecureComparisonServer, SecureComparisonClient>>(paillierCryptoProvider, dgkCryptoProvider, configurationPath)) {
49  }
50 
55  Paillier::Ciphertext Server::ComputeMinimum (std::vector<Paillier::Ciphertext> &items) const {
56  return this->secureExtremumSelectionServer->GetMinimum(items);
57  }
58 
63  Paillier::Ciphertext Server::ComputeMaximum (std::vector<Paillier::Ciphertext> &items) const {
64  return this->secureExtremumSelectionServer->GetMaximum(items);
65  }
66 
70  void Server::SetClient (const std::shared_ptr<const Client> &client) {
71  this->client = client;
72  this->secureExtremumSelectionServer->SetClient(client->GetSecureExtremumSelectionClient());
73  }
74 
78  const std::shared_ptr<SecureExtremumSelectionServer<SecureComparisonServer, SecureComparisonClient>> &Server::GetSecureExtremumSelectionServer () const {
79  return this->secureExtremumSelectionServer;
80  }
81 
82 }//namespace SecureExtremumSelection
83 }//namespace SeComLib
Definition of class Server.
const std::shared_ptr< SecureExtremumSelectionServer< SecureComparisonServer, SecureComparisonClient > > secureExtremumSelectionServer
A reference to the SecureExtremumSelectionServer.
The public key container structure for the Dgk cryptosystem.
Definition: dgk.h:47
Definition of class Client.
std::weak_ptr< const Client > client
A reference to the Client.
void SetClient(const std::shared_ptr< const Client > &client)
Sets a reference to the Privacy Service Provider.
Server(const PaillierPublicKey &paillierPublicKey, const DgkPublicKey &dgkPublicKey)
Constructor.
static const std::string configurationPath
Service Provider configuration path.
Paillier::Ciphertext ComputeMaximum(std::vector< Paillier::Ciphertext > &input) const
Secure maximum evaluation.
const std::shared_ptr< SecureExtremumSelectionServer< SecureComparisonServer, SecureComparisonClient > > & GetSecureExtremumSelectionServer() const
Getter for this->secureExtremumSelectionServer.
Paillier::Ciphertext ComputeMinimum(std::vector< Paillier::Ciphertext > &input) const
Secure minimum evaluation.
The public key container structure for the Paillier cryptosystem.
Definition: paillier.h:49