SeComLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
secure_face_recognition/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 SecureFaceRecognition {
39  const std::string Server::configurationPath("SecureFaceRecognition");
40 
45  Server::Server (const PaillierPublicKey &paillierPublicKey, const DgkPublicKey &dgkPublicKey) :
46  paillierCryptoProvider(paillierPublicKey),
47  dgkCryptoProvider(dgkPublicKey),
48  secureComparisonServer(std::make_shared<SecureComparisonServer>(paillierCryptoProvider, dgkCryptoProvider, configurationPath)) {
49  }
50 
66  return this->secureComparisonServer->Compare(a, b);
67  }
68 
72  void Server::SetClient (const std::shared_ptr<const Client> &client) {
73  this->client = client;
74  this->secureComparisonServer->SetClient(client->GetSecureComparisonClient());
75  }
76 
80  const std::shared_ptr<SecureComparisonServer> &Server::GetSecureComparisonServer () const {
81  return this->secureComparisonServer;
82  }
83 
84 }//namespace SecureFaceRecognition
85 }//namespace SeComLib
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.
Paillier::Ciphertext SecureComparison(const Paillier::Ciphertext &a, const Paillier::Ciphertext &b) const
Computes the relation between the inputs.
The public key container structure for the Dgk cryptosystem.
Definition: dgk.h:47
Server(const PaillierPublicKey &paillierPublicKey, const DgkPublicKey &dgkPublicKey)
Constructor.
Definition of class Client.
static const std::string configurationPath
Service Provider configuration path.
const std::shared_ptr< SecureComparisonServer > & GetSecureComparisonServer() const
Getter for this->secureComparisonServer.
const std::shared_ptr< SecureComparisonServer > secureComparisonServer
A reference to the SecureComparisonServer.
Definition of class Server.
The public key container structure for the Paillier cryptosystem.
Definition: paillier.h:49