Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Macros
Pages
elgamal
ciphertext.cpp
Go to the documentation of this file.
1
12
#include "
ciphertext.hpp
"
13
#include "
ciphergroup.hpp
"
14
15
using namespace
elGamal;
16
17
18
19
CipherText::CipherText
(
verifierUtils::ByteTree
* bt,
CipherGroup
c) :
20
u(bt->getChild(0),c.getGrp()),
21
v(bt->getChild(1),c.getGrp())
22
{
23
if
( (!bt->
isNode
()) || (bt->
size
() != 2) )
24
{
25
std::cout<<
"ERROR: in CipherText(bt,c), bt is not a "
26
<<
"Node or is not of size 2.\nbt="
;
27
bt->
prettyPrint
(
""
);
28
std::cout<<std::endl;
29
exit(1);
30
}
31
}
32
33
34
CipherText::CipherText
(
arithm::Elmt
left,
arithm::Elmt
right) :
35
u(left), v(right)
36
{
37
}
38
39
40
verifierUtils::ByteTree
*
CipherText::toByteTree
()
41
{
42
verifierUtils::ByteTree
* result =
new
verifierUtils::Node
();
43
result->
addChild
(
u
.
toByteTree
());
44
result->
addChild
(
v
.
toByteTree
());
45
return
result;
46
}
47
48
49
arithm::Elmt
CipherText::getU
()
50
{
51
return
u
;
52
}
53
54
55
arithm::Elmt
CipherText::getV
()
56
{
57
return
v
;
58
}