SeComLib
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Macros
Pages
core
el_gamal_ciphertext.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 EL_GAMAL_CIPHERTEXT_IMPLEMENTATION_GUARD
30
#define EL_GAMAL_CIPHERTEXT_IMPLEMENTATION_GUARD
31
32
namespace
SeComLib {
33
namespace
Core {
41
template
<
typename
T_DataType>
42
ElGamalCiphertext
ElGamalCiphertext::operator*
(
const
T_DataType &input)
const
{
43
if
(!this->
encryptionModulus
) {
44
throw
std::runtime_error(
"This operation requires the encryption modulus."
);
45
}
46
47
if
(input == 0) {
48
throw
std::runtime_error(
"The plaintext term should not be 0."
);
49
}
50
51
ElGamalCiphertext
output(this->
data
.
x
.GetPowModN(input, *this->encryptionModulus), this->
data
.
y
.GetPowModN(input, *this->
encryptionModulus
), this->
encryptionModulus
);
52
53
return
output;
54
}
55
}
//namespace Core
56
}
//namespace SeComLib
57
58
#endif//EL_GAMAL_CIPHERTEXT_IMPLEMENTATION_GUARD
SeComLib::Core::ElGamalCiphertext::operator*
ElGamalCiphertext operator*(const T_DataType &input) const
Homomorphic multiplication binary operator.
Definition:
el_gamal_ciphertext.hpp:42
SeComLib::Core::ElGamalCiphertext::data
Data data
Cipertext container.
Definition:
el_gamal_ciphertext.h:64
SeComLib::Core::ElGamalCiphertext::Data::x
BigInteger x
Definition:
el_gamal_ciphertext.h:51
SeComLib::Core::ElGamalCiphertext::encryptionModulus
std::shared_ptr< BigInteger > encryptionModulus
The encryption modulus.
Definition:
el_gamal_ciphertext.h:90
SeComLib::Core::ElGamalCiphertext::Data::y
BigInteger y
Definition:
el_gamal_ciphertext.h:54
SeComLib::Core::ElGamalCiphertext
ElGamal cipertext.
Definition:
el_gamal_ciphertext.h:43
Generated on Mon Jan 27 2014 01:04:37 for SeComLib by
1.8.6