SeComLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
secure_face_recognition_utils/comparison_blinding_factor_container.hpp
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 COMPARISON_BLINDING_FACTOR_CONTAINER_IMPLEMENTATION_GUARD
30 #define COMPARISON_BLINDING_FACTOR_CONTAINER_IMPLEMENTATION_GUARD
31 
32 namespace SeComLib {
33 namespace SecureFaceRecognitionUtils {
40  template <typename T_CryptoProvider, typename T_Parameters>
41  ComparisonBlindingFactorContainer<T_CryptoProvider, T_Parameters>::ComparisonBlindingFactorContainer (const T_CryptoProvider &cryptoProvider, const T_Parameters &parameters) {
43  BigInteger r = RandomProvider::GetInstance().GetRandomInteger(parameters.l + 1 + parameters.kappa);
44  BigInteger hatR = r % parameters.twoPowL;
45 
46  for (size_t i = 0; i < parameters.l; ++i) {
47  this->hatRBits.emplace_back(hatR.GetBit(i));
48  }
49 
50  this->encryptedR = cryptoProvider.EncryptIntegerNonrandom(r);
51 
53  this->encryptedRModTwoPowL = cryptoProvider.EncryptIntegerNonrandom(hatR);
54  }
55 
56 }//namespace SecureFaceRecognitionUtils
57 }//namespace SeComLib
58 
59 #endif//COMPARISON_BLINDING_FACTOR_CONTAINER_IMPLEMENTATION_GUARD
ComparisonBlindingFactorContainer(const T_CryptoProvider &cryptoProvider, const T_Parameters &parameters)
Constructor.