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

CODEX_Ciphers::RSAPublicKey Class Reference

Serializable encapsulation of an RSA public key. More...

#include <RSA.h>

Inheritance diagram for CODEX_Ciphers::RSAPublicKey:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RSAPublicKey ()
 Default constructor, for creating an object to be unmarshalled.
 RSAPublicKey (BIGNUM *n, BIGNUM *e)
 Constructor taking components of the key as BIGNUM%s.
 RSAPublicKey (const CODEX_ASN1::BigNumber &n, const CODEX_ASN1::BigNumber &e)
 Constructor taking components of the key as BigNumber%s.
 RSAPublicKey (const X509 *cert)
 Constructor taking an X.509 certificate.
 RSAPublicKey (const RSAPublicKey &aKey)
 Copy constructor.
virtual ~RSAPublicKey ()
 Destructor.
void operator= (const RSAPublicKey &aKey)
 Assignment operator.
virtual const CODEX_ASN1::BigNumbern () const
 Modulus of the public key.
virtual const CODEX_ASN1::BigNumbere () const
 Encryption exponent.
RSACipherTextencrypt (const BIGNUM *message) const
 Encrypt a message.
bool verifySignature (const RSASignature &signature, const BIGNUM *message) const
 Verify the signature for a message.
int marshal (unsigned char **pp) const
 Serialize the object.
void * unmarshal (void *bogus, unsigned char **pp, long length)
 Unserialize the object.
void toFile (const char *fname) const
 Writes the public key to a file.
void * fromFile (const char *fname)
 Reads the public key from a file.
bool initialized () const

Protected Member Functions

BIGNUM * exponentiate (const BIGNUM *aBN) const

Protected Attributes

bool m_initialized
 Has this object been initialized yet, or is it still blank?

Detailed Description

Serializable encapsulation of an RSA public key.

Definition at line 91 of file RSA.h.


Constructor & Destructor Documentation

RSAPublicKey::RSAPublicKey const X509 *  cert  ) 
 

Constructor taking an X.509 certificate.

Bug:
Have to cast away const for X509_get_pubkey.

Definition at line 50 of file RSAPublicKey.cc.


Member Function Documentation

RSACipherText * RSAPublicKey::encrypt const BIGNUM *  message  )  const
 

Encrypt a message.

Parameters:
message Non-null pointer to a BIGNUM containing the message to encrypt. This message must be smaller than the modulus of the public key.
Returns:
A pointer to a new RSACipherText object.
Exceptions:
BignumNullException The message is 0 or some memory allocation failed.
BignumModExpException There was an error during modular exponentiation.
BignumContextException Memory allocation failed for a BN_CTX.

Definition at line 88 of file RSAPublicKey.cc.

Referenced by CODEX_KeyService::DelegateResponseVerifier::handler(), CODEX_Client::Client::readKey(), and CODEX_Server::ServerState::thresholdOperation().

void * RSAPublicKey::fromFile const char *  fname  ) 
 

Reads the public 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 234 of file RSAPublicKey.cc.

References 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().

void RSAPublicKey::toFile const char *  fname  )  const
 

Writes the public 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 212 of file RSAPublicKey.cc.

References marshal().

bool RSAPublicKey::verifySignature const RSASignature signature,
const BIGNUM *  message
const
 

Verify the signature for a message.

Parameters:
signature Signature object to verify
message Non-null pointer to a BIGNUM containing the message allegedly signed with signature. The message must be smaller than the modulus of the public key, and might be a digest of a longer message.
Returns:
Success or failure of the signature verification
Exceptions:
BignumNullException The message is 0 or some memory allocation failed.
BignumModExpException There was an error during modular exponentiation.
BignumContextException Memory allocation failed for a BN_CTX.

Definition at line 94 of file RSAPublicKey.cc.

Referenced by CODEX_Client::Client::createKey(), CODEX_Client::Client::getServiceKey(), CODEX_APSS::MessageVerifier::handler(), CODEX_KeyService::ClientMessageVerifier::handler(), CODEX_KeyService::VerifyWriteCallback::operator()(), CODEX_KeyService::SignWriteCallback::operator()(), CODEX_KeyService::SignReadCallback::operator()(), CODEX_KeyService::SignCreateCallback::operator()(), CODEX_KeyService::ClientWriteCallback::operator()(), CODEX_KeyService::ClientReadCallback::operator()(), CODEX_KeyService::ClientCreateCallback::operator()(), CODEX_Client::Client::readKey(), CODEX_Ciphers::VarRSAPublicKey::verifySignature(), and CODEX_Client::Client::writeKey().


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