Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CODEX_Ciphers::ElGamalPrivateKey Class Reference

Serializable encapsulation of an ElGamal private key. More...

#include <ElGamal.h>

Inheritance diagram for CODEX_Ciphers::ElGamalPrivateKey:

Inheritance graph
[legend]
Collaboration diagram for CODEX_Ciphers::ElGamalPrivateKey:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ElGamalPrivateKey ()
 Default constructor, for creating an object to be unmarshalled.
 ElGamalPrivateKey (BIGNUM *x)
 Create an ElGamalPrivateKey from a BIGNUM.
 ElGamalPrivateKey (const CODEX_ASN1::BigNumber &x)
 Create an ElGamalPrivateKey from a BigNumber.
 ElGamalPrivateKey (const ElGamalPrivateKey &aKey)
 Copy constructor.
virtual ~ElGamalPrivateKey ()
 Destructor.
const CODEX_ASN1::SecureBigNumberx () const
 This object as a SecureBigNumber.
BIGNUM * decrypt (const ElGamalCipherText &cipherText, const ElGamalPublicKey &publicKey) const
 Decrypt a message.
ElGamalSignaturesign (const BIGNUM *message, const ElGamalPublicKey &publicKey) const
 Sign a message.
void toFile (const char *fname) const
 Writes the private key to a file.
void * fromFile (const char *fname)
 Reads the private key from a file.
bool operator== (const BigNumber &aBN) const
 Equality operator.
bool operator!= (const BigNumber &aBN) const
 Inequality operator.
bool operator< (const BigNumber &aBN) const
 Less-than operator.
bool operator> (const BigNumber &aBN) const
 Less-than operator.
const BIGNUM * value () const
 BIGNUM structure.
const ASN1_INTEGER * asn1 () const
 ASN1_INTEGER corresponding to the BIGNUM.
int marshal (unsigned char **pp) const
 This function creates a serialized representation of the object, which is returned through the argument pp.
void * unmarshal (void *bogus, unsigned char **pp, long length)
 This function takes a serialized representation of the object and recreates the object representation.
bool initialized () const

Protected Attributes

BIGNUM * m_value
 BigNumber as an OpenSSL BIGNUM.
ASN1_INTEGER * m_asn1
 BigNumber as an ASN.1 integer.
bool m_initialized
 Has this object been initialized yet, or is it still blank?

Detailed Description

Serializable encapsulation of an ElGamal private key.

This is just an extension of a SecureBigNumber.

Definition at line 370 of file ElGamal.h.


Member Function Documentation

BIGNUM * ElGamalPrivateKey::decrypt const ElGamalCipherText cipherText,
const ElGamalPublicKey publicKey
const
 

Decrypt a message.

Parameters:
cipherText The encryption of a message using the public key corresponding to this private key.
publicKey The corresponding public key.
Returns:
A pointer to a new BIGNUM containing the plaintext.
Exceptions:
BignumNullException Some memory allocation failed.
BignumModExpException There was an error during modular exponentiation.
BignumModInverseException There was an error during modular inversion.
BignumModMulException There was an error during modular multiplication.
BignumContextException Memory allocation failed for a BN_CTX.

Definition at line 49 of file ElGamalPrivateKey.cc.

void * ElGamalPrivateKey::fromFile const char *  fname  ) 
 

Reads the private key from a file.

Parameters:
fname Name of the file from which to read the key
Exceptions:
FileCannotOpenException The file fname could not be opened.

Definition at line 266 of file ElGamalPrivateKey.cc.

References CODEX_ASN1::BigNumber::unmarshal().

bool CODEX_ASN1::Base::initialized  )  const [inline, inherited]
 

Returns:
Has this object been initialized?

Definition at line 175 of file Base.h.

References CODEX_ASN1::Base::m_initialized.

Referenced by CODEX_APSS::SecretManagement::addComputeMsg(), CODEX_APSS::SecretManagement::addEstablishMsg(), CODEX_APSS::SecretManagement::addEstablishResponse(), CODEX_APSS::SecretManagement::addInitMsg(), CODEX_APSS::SecretManagement::addSharing(), CODEX_APSS::SecretManagement::addSubsharing(), CODEX_VSS::Combinatoric< NumT, ThreshT >::apply(), CODEX_Server::ServerState::caKey(), CODEX_KeyService::ClientCreateCallback::ClientCreateCallback(), CODEX_VSS::Combinatoric< NumT, ThreshT >::count(), CODEX_Server::QuorumBuilderAct::handler(), CODEX_APSS::MessageVerifier::handler(), CODEX_KeyService::DelegateResponseVerifier::handler(), CODEX_KeyService::DelegateRequestDistributor::handler(), CODEX_KeyService::ClientMessageVerifier::handler(), CODEX_KeyService::ClientMessageSigner::handler(), CODEX_VSS::SubshareLabel< LabelType >::marshal(), CODEX_KeyService::KeyInfo::marshal(), CODEX_VSS::LabeledShare< ShareType, OneWay >::marshal(), CODEX_VSS::ShareLabel< _ShareType, _OneWay >::marshal(), CODEX_VSS::ModExpFunctionalArgs::marshal(), CODEX_VSS::Combinatoric< NumT, ThreshT >::marshal(), CODEX_KeyService::SignWriteCallback::operator()(), CODEX_KeyService::SignReadCallback::operator()(), CODEX_KeyService::SignCreateCallback::operator()(), CODEX_VSS::ModExpFunctional::operator()(), CODEX_KeyService::ClientReadCallback::operator()(), CODEX_KeyService::ClientCreateCallback::operator()(), CODEX_VSS::Combinatoric< NumT, ThreshT >::operator+=(), CODEX_Server::ServerState::readElGamalShares(), CODEX_VSS::Combinatoric< NumT, ThreshT >::recover(), CODEX_APSS::SecretManagement::sendFinished(), CODEX_Server::ServerState::serviceKey(), CODEX_Server::ServerState::setEGShareCallback(), and CODEX_Server::ServerState::setRSAShareCallback().

int BigNumber::marshal unsigned char **  pp  )  const [virtual, inherited]
 

This function creates a serialized representation of the object, which is returned through the argument pp.

This must be overridden by the concrete derived class.

Parameters:
pp Serialized form of the object
Returns:
Length of the marshalled data

Implements CODEX_ASN1::Base.

Definition at line 145 of file BigNumber.cc.

References CODEX_ASN1::BigNumber::asn1(), and CODEX_ASN1::BigNumber::m_asn1.

Referenced by CODEX_Client::Client::contactServer(), CODEX_Ciphers::VarRSAPrivateKey::decrypt(), CODEX_ThresholdCrypto::DLProof::DLProof(), CODEX_Ciphers::VarRSAPublicKey::encrypt(), CODEX_Ciphers::ElGamalPublicKey::encryptS(), CODEX_Server::QuorumBuilderAct::handler(), CODEX_KeyService::ClientResponseSigner::handler(), CODEX_Ciphers::VarRSACipherText::marshal(), CODEX_Ciphers::VarRSABlindPlainText::marshal(), CODEX_Ciphers::VarRSABlindCipherText::marshal(), CODEX_Ciphers::TranslationCertificate::marshal(), CODEX_KeyService::KeyInfo::marshal(), CODEX_Server::ServerSignature::marshal(), CODEX_Ciphers::RSAPublicKey::marshal(), CODEX_Ciphers::RSAPrivateKey::marshal(), CODEX_Client::ReadKeyMsg::marshal(), CODEX_Ciphers::PolCredBase::marshal(), CODEX_VSS::ModExpFunctionalArgs::marshal(), CODEX_Client::KeyStoredMsg::marshal(), CODEX_Ciphers::ElGamalSignature::marshal(), CODEX_Ciphers::ElGamalSchnorrCipherText::marshal(), CODEX_Ciphers::ElGamalPublicKey::marshal(), CODEX_Ciphers::ElGamalCipherText::marshal(), CODEX_ThresholdCrypto::DLProof::marshal(), CODEX_VSS::Combinatoric< NumT, ThreshT >::marshal(), CODEX_Client::BlindKeyMsg::marshal(), CODEX_Server::SignedAugmentedEGPublicKey::marshal(), CODEX_Server::AugmentedEGPublicKey::marshal(), CODEX_Ciphers::RSAPlaintextPK::RSAPlaintextPK(), toFile(), CODEX_Client::Client::toFile(), CODEX_Ciphers::TranslationCertificate::TranslationCertificate(), CODEX_Ciphers::VarRSABlindPlainText::unblind(), CODEX_Ciphers::TranslationCertificate::verify(), CODEX_Ciphers::ElGamalSchnorrCipherText::verify(), and CODEX_ThresholdCrypto::DLProof::verify().

ElGamalSignature * ElGamalPrivateKey::sign const BIGNUM *  message,
const ElGamalPublicKey publicKey
const
 

Sign a message.

Parameters:
message Non-null pointer to a BIGNUM containing the message to sign. This message must be smaller than the modulus of the public key.
publicKey The corresponding public key.
Returns:
A pointer to a new ElGamalSignature object.
Exceptions:
BignumNullException The message is 0 or some memory allocation failed.
BignumSubException There was an error during subtraction.
BignumAddException There was an error during addition.
BignumRandRangeException There was an error generating the random exponent.
BignumGCDException There was an error while computing a greatest common denominator.
BignumModInverseException There was an error during modular inversion.
BignumModExpException There was an error during modular exponentiation.
BignumModMulException There was an error during modular multiplication.
BignumContextException Memory allocation failed for a BN_CTX.

Definition at line 120 of file ElGamalPrivateKey.cc.

void ElGamalPrivateKey::toFile const char *  fname  )  const
 

Writes the private key to a file.

Parameters:
fname Name of the file in which to store the key
Exceptions:
FileCannotCreateException The file fname could not be created.

Definition at line 244 of file ElGamalPrivateKey.cc.

References CODEX_ASN1::BigNumber::marshal().

void * BigNumber::unmarshal void *  bogus,
unsigned char **  pp,
long  length
[virtual, inherited]
 

This function takes a serialized representation of the object and recreates the object representation.

This must be overridden by the concrete derived class.

Parameters:
bogus Included for compatibility with OpenSSL ASN.1 macros
pp Serialized form of the data
length Number of bytes of pp to unmarshal
Returns:
success or failure of the unmarshalling

Implements CODEX_ASN1::Base.

Definition at line 152 of file BigNumber.cc.

References CODEX_ASN1::BigNumber::m_asn1, and CODEX_ASN1::BigNumber::m_value.

Referenced by fromFile(), CODEX_Client::Client::fromFile(), CODEX_Server::QuorumBuilderAct::handler(), CODEX_KeyService::VerifyWriteCallback::operator()(), CODEX_KeyService::ClientWriteCallback::operator()(), CODEX_KeyService::ClientCreateCallback::operator()(), CODEX_Ciphers::VarRSACipherText::unmarshal(), CODEX_Ciphers::VarRSABlindPlainText::unmarshal(), CODEX_Ciphers::VarRSABlindCipherText::unmarshal(), CODEX_Ciphers::TranslationCertificate::unmarshal(), CODEX_KeyService::KeyInfo::unmarshal(), CODEX_Server::ServerSignature::unmarshal(), CODEX_Ciphers::RSAPublicKey::unmarshal(), CODEX_Ciphers::RSAPrivateKey::unmarshal(), CODEX_Client::ReadKeyMsg::unmarshal(), CODEX_Ciphers::PolCredBase::unmarshal(), CODEX_VSS::ModExpFunctionalArgs::unmarshal(), CODEX_Client::KeyStoredMsg::unmarshal(), CODEX_Ciphers::ElGamalSignature::unmarshal(), CODEX_Ciphers::ElGamalSchnorrCipherText::unmarshal(), CODEX_Ciphers::ElGamalPublicKey::unmarshal(), CODEX_Ciphers::ElGamalCipherText::unmarshal(), CODEX_ThresholdCrypto::DLProof::unmarshal(), CODEX_Client::BlindKeyMsg::unmarshal(), CODEX_Server::SignedAugmentedEGPublicKey::unmarshal(), and CODEX_Server::AugmentedEGPublicKey::unmarshal().


The documentation for this class was generated from the following files:
Generated on Fri May 6 17:41:51 2005 for COrnell Data EXchange (CODEX) by  doxygen 1.4.1