elGamal::CipherGroup Class Reference

Implements a CipherGroup, i.e. the cartesian product of two Groups. El-Gamal operations are implemented here. More...

#include <ciphergroup.hpp>

+ Collaboration diagram for elGamal::CipherGroup:

Public Member Functions

 CipherGroup (arithm::Group *group)
 Builds a CipherGroup from a group in which computations will be made.
arithm::GroupgetGrp ()
 Returns the group in which the computations are made.
CipherText getCipherText (verifierUtils::ByteTree *bt)
 Returns a CipherText from this group built from a bytetree.
ArrayOfCiphers getArrayOfCiphers (verifierUtils::ByteTree *bt)
 Returns an ArrayOfCiphers from this group built from a bytetree.
Encryption/decryption
CipherText enc (arithm::Elmt y, arithm::Elmt m, arithm::Elmt s)
 Let grp->getGenerator() be g then returns $Enc_{(g,y)} (m,s) = (g^s, y^s m)$.
arithm::Elmt dec (arithm::Elmt x, CipherText uv)
 Let uv be $(u,v)$. Then returns $Dec_x (u,v) = u^{-x} v$.
arithm::Elmt pdec (arithm::Elmt xl, CipherText uv)
 Let uv be $(u,v)$. Then returns $PDec_{x_l}(u,v) = u^{x_l}$.
arithm::ArrayOfElmts pdec (arithm::Elmt xl, ArrayOfCiphers uv)
 Applies pdec component-wise on an array of cipher text using a fixed public key.
arithm::Elmt tdec (CipherText uv, arithm::Elmt f)
 Let uv be $(u,v)$. The returns $TDec((u,v),f) = v f^{-1}$.
arithm::ArrayOfElmts tdec (ArrayOfCiphers uv, arithm::ArrayOfElmts f)
 Applies tdec component-wise on an array of cipher texts and an array of decryption factors (i.e. group elements).
Group operations
CipherText exponentiation (CipherText c, arithm::Elmt s)
 Componentwise exponentiation of a ciphertext.
CipherText multiplication (CipherText c1, CipherText c2)
 Componentwise multiplication of a ciphertext.
ArrayOfCiphers exponentiation (ArrayOfCiphers c, arithm::ArrayOfElmts s)
 Componentwise exponentiation of an array of ciphertext.
CipherText expProduct (ArrayOfCiphers c, arithm::ArrayOfElmts s)
 Componentwise call to Group::expProduct().
bool compare (CipherText c1, CipherText c2)
 Returns true if c1 and c2 are identical, false otherwise.
bool compare (ArrayOfCiphers c1, ArrayOfCiphers c2)
 Returns true if c1 and c2 contain strictly identical ciphertexts, false otherwise.

Private Attributes

arithm::Groupgrp
 The group in which computations are made.

Detailed Description

Implements a CipherGroup, i.e. the cartesian product of two Groups. El-Gamal operations are implemented here.

Definition at line 28 of file ciphergroup.hpp.

Constructor & Destructor Documentation

CipherGroup::CipherGroup ( arithm::Group group)

Builds a CipherGroup from a group in which computations will be made.

Definition at line 20 of file ciphergroup.cpp.

{
grp = group;
}

Member Function Documentation

bool CipherGroup::compare ( CipherText  c1,
CipherText  c2 
)

Returns true if c1 and c2 are identical, false otherwise.

Definition at line 131 of file ciphergroup.cpp.

{
return ( (grp->compare(c1.getU(), c2.getU())) &&
(grp->compare(c1.getV(), c2.getV())) );
}
bool CipherGroup::compare ( ArrayOfCiphers  c1,
ArrayOfCiphers  c2 
)

Returns true if c1 and c2 contain strictly identical ciphertexts, false otherwise.

Definition at line 138 of file ciphergroup.cpp.

{
for (unsigned int i=0; i<c1.size(); i++)
if (! compare(c1.getCipherText(i), c2.getCipherText(i)) )
return false;
return true;
}
arithm::Elmt CipherGroup::dec ( arithm::Elmt  x,
CipherText  uv 
)

Let uv be $(u,v)$. Then returns $Dec_x (u,v) = u^{-x} v$.

Definition at line 58 of file ciphergroup.cpp.

{
uv.getV());
}
CipherText CipherGroup::enc ( arithm::Elmt  y,
arithm::Elmt  m,
arithm::Elmt  s 
)

Let grp->getGenerator() be g then returns $Enc_{(g,y)} (m,s) = (g^s, y^s m)$.

Definition at line 49 of file ciphergroup.cpp.

CipherText CipherGroup::exponentiation ( CipherText  c,
arithm::Elmt  s 
)

Componentwise exponentiation of a ciphertext.

Definition at line 100 of file ciphergroup.cpp.

{
}
ArrayOfCiphers CipherGroup::exponentiation ( ArrayOfCiphers  c,
arithm::ArrayOfElmts  s 
)

Componentwise exponentiation of an array of ciphertext.

Definition at line 115 of file ciphergroup.cpp.

CipherText CipherGroup::expProduct ( ArrayOfCiphers  c,
arithm::ArrayOfElmts  s 
)

Componentwise call to Group::expProduct().

Definition at line 123 of file ciphergroup.cpp.

{
}
ArrayOfCiphers CipherGroup::getArrayOfCiphers ( verifierUtils::ByteTree bt)

Returns an ArrayOfCiphers from this group built from a bytetree.

Definition at line 38 of file ciphergroup.cpp.

{
return ArrayOfCiphers(bt,*this);
}
CipherText CipherGroup::getCipherText ( verifierUtils::ByteTree bt)

Returns a CipherText from this group built from a bytetree.

Definition at line 32 of file ciphergroup.cpp.

{
return CipherText(bt,*this);
}
arithm::Group * CipherGroup::getGrp ( )

Returns the group in which the computations are made.

Definition at line 26 of file ciphergroup.cpp.

{
return grp;
}
CipherText CipherGroup::multiplication ( CipherText  c1,
CipherText  c2 
)

Componentwise multiplication of a ciphertext.

Definition at line 108 of file ciphergroup.cpp.

{
return CipherText(grp->multiplication(c1.getU(),c2.getU()),
grp->multiplication(c1.getV(),c2.getV()));
}
arithm::Elmt CipherGroup::pdec ( arithm::Elmt  xl,
CipherText  uv 
)

Let uv be $(u,v)$. Then returns $PDec_{x_l}(u,v) = u^{x_l}$.

Definition at line 66 of file ciphergroup.cpp.

{
return grp->exponentiation(uv.getU(),xl);
}
arithm::ArrayOfElmts CipherGroup::pdec ( arithm::Elmt  xl,
ArrayOfCiphers  uv 
)

Applies pdec component-wise on an array of cipher text using a fixed public key.

Definition at line 72 of file ciphergroup.cpp.

{
for (unsigned int i=0; i<uv.size(); i++)
result.addElmt(pdec(xl, uv.getCipherText(i)));
return result;
}
arithm::Elmt CipherGroup::tdec ( CipherText  uv,
arithm::Elmt  f 
)

Let uv be $(u,v)$. The returns $TDec((u,v),f) = v f^{-1}$.

Definition at line 81 of file ciphergroup.cpp.

{
return grp->multiplication(uv.getV(),grp->multInverse(f));
}
arithm::ArrayOfElmts CipherGroup::tdec ( ArrayOfCiphers  uv,
arithm::ArrayOfElmts  f 
)

Applies tdec component-wise on an array of cipher texts and an array of decryption factors (i.e. group elements).

Definition at line 87 of file ciphergroup.cpp.

{
for (unsigned int i=0; i<uv.size(); i++)
result.addElmt(tdec(uv.getCipherText(i),f.getElmt(i)));
return result;
}

Member Data Documentation

arithm::Group* elGamal::CipherGroup::grp
private

The group in which computations are made.

Definition at line 34 of file ciphergroup.hpp.


The documentation for this class was generated from the following files: