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

CODEX_Client::Interface::Interface Class Reference

This class is a singleton instance of CODEX_Client::Client. More...

#include <client_functions.h>

Inheritance diagram for CODEX_Client::Interface::Interface:

Inheritance graph
[legend]
Collaboration diagram for CODEX_Client::Interface::Interface:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void setRemoteServer (const string &name, int port)
 Set the remote server.
void setServiceKey (CODEX_Ciphers::RSAPublicKey *key)
 Set the service's RSA public key.
void setKeyPair (CODEX_ASN1::Certificate *cert, CODEX_Ciphers::RSAPrivateKey *key)
 Set the client's RSA public/private key pair.
CODEX_Ciphers::PolicycreatePolicy (const CODEX_Ciphers::RSAPublicKey &policyPubKey, const CODEX_Ciphers::RSAPrivateKey &ownerPrivKey)
 Creates a CODEX_Ciphers::Policy object.
CODEX_Ciphers::CredentialsissueCredentials (const CODEX_Ciphers::RSAPublicKey &clientPubKey, const CODEX_Ciphers::RSAPrivateKey &policyPrivKey)
 Creates a CODEX_Ciphers::Credentials object.
bool createKey (const CODEX_ASN1::ustring &name, const CODEX_ASN1::Certificate &owner_cert, const CODEX_Ciphers::Policy &readPolicy, const CODEX_Ciphers::Policy &writePolicy, SignedBoundNameMsg &binding)
 Bind a name and access control policies.
bool writeKey (const CODEX_ASN1::ustring &name, const BIGNUM *keyValue, const CODEX_Ciphers::Credentials &credentials, const CODEX_Ciphers::RSAPrivateKey &privKey, const SignedBoundNameMsg &binding)
 Associate a value with a name.
bool readKey (const CODEX_ASN1::ustring &name, const CODEX_Ciphers::Credentials &credentials, const CODEX_Ciphers::RSAPrivateKey &privKey, BIGNUM **returnedKeyValue)
 Retrieve the value associated with a name.
void toFile (const char *fname) const
 Writes the Client's state to a file.
void * fromFile (const char *fname)
 Reads the Client's state from a file.
const CODEX_Quorum::RemoteServerserver () const
 The remote server.
const CODEX_ASN1::Certificatecertificate () const
 The client's certificate.
const CODEX_Ciphers::RSAPrivateKeyprivateKey () const
 The client's RSA private key.
const CODEX_Ciphers::RSAPublicKeyserviceKey () const
 The service's RSA public key.
const CODEX_Ciphers::ElGamalPublicKeyserviceEGKey () const
 The service's ElGamal public key.
const CODEX_ASN1::BigNumberserviceH () const
 The service's auxiliary generator.
const CODEX_Ciphers::ElGamalPublicKeypublicEGKey () const
 The client's ElGamal public key.
const CODEX_Ciphers::ElGamalPrivateKeyprivateEGKey () const
 The client's ElGamal private key.

Static Public Member Functions

static Interfaceinstance ()
 The unique instance of Interface.
static void destroy ()
 Destroy the unique instance of Interface.

Protected Member Functions

bool getServiceKey ()
 Fetch the service's ElGamal public key.
bool contactServer (const Message &message, unsigned char mtype, CODEX_Quorum::Message &response)
 Send a message to the remote server and wait for a response.

Detailed Description

This class is a singleton instance of CODEX_Client::Client.

It allows the C-callable functions to access a static object containing methods and state.

Definition at line 65 of file client_functions.h.


Member Function Documentation

bool Client::contactServer const Message message,
unsigned char  mtype,
CODEX_Quorum::Message response
[protected, inherited]
 

Send a message to the remote server and wait for a response.

Parameters:
message The message to send.
mtype The one-byte message type.
response The response, in marshalled form.
Returns:
Success or failure of the operation.

Definition at line 618 of file Client.cc.

References CODEX_Quorum::RemoteServer::flushSocket(), CODEX_ASN1::BigNumber::marshal(), CODEX_Quorum::RemoteServer::receiveFrom(), CODEX_Quorum::RemoteServerReturn::reset(), CODEX_Quorum::RemoteServerReturn::returnCode(), and CODEX_Quorum::RemoteServer::sendTo().

Referenced by CODEX_Client::Client::createKey(), CODEX_Client::Client::getServiceKey(), CODEX_Client::Client::readKey(), and CODEX_Client::Client::writeKey().

bool Client::createKey const CODEX_ASN1::ustring name,
const CODEX_ASN1::Certificate owner_cert,
const CODEX_Ciphers::Policy readPolicy,
const CODEX_Ciphers::Policy writePolicy,
SignedBoundNameMsg binding
[inherited]
 

Bind a name and access control policies.

Parameters:
name The name for the key.
owner_cert The owner's certificate.
readPolicy The read policy to set for this name.
writePolicy The write policy to set for this name.
binding The response from the service. Must be allocated but not initialized.
Returns:
Success or failure of the operation.

Definition at line 127 of file Client.cc.

References CODEX_Quorum::Message::buffer(), CODEX_Client::Client::contactServer(), CODEX_Client::Message::digest(), CODEX_Quorum::Message::length(), CODEX_Client::CreateKeyMsg::name(), CODEX_Ciphers::RSAPrivateKey::sign(), CODEX_Client::SignedMessage< MT, ST >::signature(), CODEX_ASN1::BigNumber::value(), CODEX_ASN1::OctetString::value(), and CODEX_Ciphers::RSAPublicKey::verifySignature().

Referenced by CODEX_Client::Interface::codex_create_key().

CODEX_Ciphers::Policy * Client::createPolicy const CODEX_Ciphers::RSAPublicKey policyPubKey,
const CODEX_Ciphers::RSAPrivateKey ownerPrivKey
[inherited]
 

Creates a CODEX_Ciphers::Policy object.

Parameters:
policyPubKey The public key specifying the access policy.
ownerPrivKey The owner's private key, which will be used to sign policyPubKey.
Returns:
The new policy, or NULL if an error occurred.

Definition at line 92 of file Client.cc.

References CODEX_Ciphers::Policy::unmarshal().

Referenced by CODEX_Client::Interface::codex_create_policy().

void * Client::fromFile const char *  fname  )  [inherited]
 

Reads the Client's state from a file.

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

Definition at line 774 of file Client.cc.

References CODEX_ASN1::BigNumber::unmarshal(), CODEX_Ciphers::ElGamalPublicKey::unmarshal(), CODEX_Ciphers::RSAPublicKey::unmarshal(), CODEX_Ciphers::RSAPrivateKey::unmarshal(), CODEX_ASN1::Certificate::unmarshal(), CODEX_ASN1::Integer::unmarshal(), and CODEX_ASN1::Integer::value().

Referenced by CODEX_Client::Interface::codex_from_file().

CODEX_Ciphers::Credentials * Client::issueCredentials const CODEX_Ciphers::RSAPublicKey clientPubKey,
const CODEX_Ciphers::RSAPrivateKey policyPrivKey
[inherited]
 

Creates a CODEX_Ciphers::Credentials object.

Parameters:
clientPubKey The public key of the credentials holder.
policyPrivKey The private key for the access policy, which will be used to sign policyPubKey.
Returns:
The new credentials, or NULL if an error occurred.

Definition at line 111 of file Client.cc.

Referenced by CODEX_Client::Interface::codex_issue_credentials().

bool Client::readKey const CODEX_ASN1::ustring name,
const CODEX_Ciphers::Credentials credentials,
const CODEX_Ciphers::RSAPrivateKey privKey,
BIGNUM **  returnedKeyValue
[inherited]
 

Retrieve the value associated with a name.

The key value is returned blind, and all blinding operations for the client are performed in this method. If an application needs to keep the blinding factor for some reason, it should be straightforward to adapt this method.

Parameters:
name The name of the key.
credentials The client's credentials for this operation.
privKey The client's private key corresponding to the public key in credentials.
returnedKeyValue The key, possibly with padding. This must point to a valid pointer. That is, it may not be NULL.
Returns:
Success or failure of the operation. On failure, *returnedKeyValue will be NULL.

Definition at line 370 of file Client.cc.

References CODEX_Quorum::Message::buffer(), CODEX_Client::Client::contactServer(), CODEX_Client::Message::digest(), CODEX_Ciphers::RSAPublicKey::encrypt(), CODEX_Ciphers::ElGamalPublicKey::encryptS(), CODEX_Client::Client::getServiceKey(), CODEX_Quorum::Message::length(), CODEX_Client::SignedMessage< MT, ST >::message(), CODEX_Ciphers::RSAPublicKey::n(), CODEX_Client::ReadKeyMsg::name(), CODEX_Ciphers::ElGamalPublicKey::p(), CODEX_Ciphers::ElGamalPublicKey::q(), CODEX_Client::SignedMessage< MT, ST >::signature(), CODEX_Client::SignedMessage< MT, ST >::unmarshal(), CODEX_ASN1::OctetString::value(), CODEX_ASN1::BigNumber::value(), and CODEX_Ciphers::RSAPublicKey::verifySignature().

Referenced by CODEX_Client::Interface::codex_read_key().

void Client::setKeyPair CODEX_ASN1::Certificate cert,
CODEX_Ciphers::RSAPrivateKey key
[inherited]
 

Set the client's RSA public/private key pair.

Parameters:
cert A certificate signed by the client-authorizing CA.
key The private key corresponding to the public key in cert.

Definition at line 83 of file Client.cc.

Referenced by CODEX_Client::Interface::codex_set_key_pair().

void Client::setRemoteServer const string &  name,
int  port
[inherited]
 

Set the remote server.

Parameters:
name The name of the remote host.
port Port on the remote host to contact.

Definition at line 59 of file Client.cc.

Referenced by CODEX_Client::Interface::codex_set_server().

void Client::toFile const char *  fname  )  const [inherited]
 

Writes the Client's state to a file.

Only the key information is stored. The CODEX_Quorum::RemoteServer will still need to be set in subsequent sessions.

Parameters:
fname The name of the file.
Exceptions:
CODEX_Ciphers::FileCannotCreateException The file fname could not be created.

Definition at line 674 of file Client.cc.

References CODEX_ASN1::BigNumber::marshal(), CODEX_Ciphers::ElGamalPublicKey::marshal(), CODEX_Ciphers::RSAPublicKey::marshal(), CODEX_Ciphers::RSAPrivateKey::marshal(), CODEX_ASN1::Certificate::marshal(), CODEX_ASN1::Integer::marshal(), and CODEX_ASN1::Integer::value().

Referenced by CODEX_Client::Interface::codex_to_file().

bool Client::writeKey const CODEX_ASN1::ustring name,
const BIGNUM *  keyValue,
const CODEX_Ciphers::Credentials credentials,
const CODEX_Ciphers::RSAPrivateKey privKey,
const SignedBoundNameMsg binding
[inherited]
 

Associate a value with a name.

Parameters:
name The name of the key.
keyValue The value to be stored. This should be padded to a reasonable length.
credentials The client's credentials for this operation.
privKey The client's private key corresponding to the public key in credentials.
binding The service's signed response to the CreateKeyMsg request.
Returns:
Success or failure of the operation.

Definition at line 218 of file Client.cc.

References CODEX_Quorum::Message::buffer(), CODEX_Client::Client::contactServer(), CODEX_Client::Message::digest(), CODEX_Ciphers::VarRSAPublicKey::encrypt(), CODEX_Ciphers::ElGamalPublicKey::encryptS(), CODEX_Client::Client::getServiceKey(), CODEX_Quorum::Message::length(), CODEX_Client::SignedMessage< MT, ST >::message(), CODEX_Client::WriteKeyMsg::name(), CODEX_Client::SignedMessage< MT, ST >::signature(), CODEX_Client::SignedMessage< MT, ST >::unmarshal(), CODEX_ASN1::BigNumber::value(), CODEX_ASN1::OctetString::value(), and CODEX_Ciphers::RSAPublicKey::verifySignature().

Referenced by CODEX_Client::Interface::codex_write_key().


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