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

CODEX_KeyService::StateInfo Class Reference

This is a singleton class that holds all of the state information that different parts of the key service need to share. More...

#include <StateInfo.h>

Collaboration diagram for CODEX_KeyService::StateInfo:

Collaboration graph
[legend]
List of all members.

Public Types

typedef map< CODEX_Events::Activity *,
ClientActivity * > 
ClientMap
 Map an activity to itself as a derived type.
typedef map< const unsigned
char *, CODEX_Events::Activity *,
CODEX_Quorum::memless< CODEX_Server::ServerState::nMID > > 
RequestMap
 Map a sequence number to an Activity.
typedef map< CODEX_ASN1::ustring,
KeyInfo * > 
KeyMap
 Map a key name to its information.
typedef CODEX_Server::ServerState::ShareType ShareType
 Shorthand for type of a share.
typedef CODEX_Server::ServerState::LSType LSType
 Shorthand for a labelled share type.
typedef CryptoSystem< CODEX_Client::CipherTextType,
ShareType
CryptoSystemType
 Set up some configuration-specific typedefs.
typedef CryptoSystemType::ThresholdType ThresholdDecryptionType
 Specify the threshold scheme to use for decryptions.
enum  SynchronyState { kFailed, kWrote, kRead }
 Indicates the result of a call to synchronize().

Public Member Functions

void configure (const CONF *conf, const char *sec, const string &fname)
 Configure the state from an OpenSSL CONF-format file.
void setMessageDomain (unsigned char d)
 Set the 1-byte domain identifier for client messages.
void setDelegationDomain (unsigned char d)
 Set the 1-byte domain identifier for internal delegation messages.
unsigned char messageDomain ()
 The domain identifier for client messages.
unsigned char delegationDomain ()
 The domain identifier for internal delegation messages.
long clientPort () const
 The port on which to listen for client connections.
bool addClient (ClientActivity *clientAct)
 Add a new ClientActivity to the client map.
ClientActivitygetClient (CODEX_Events::Activity *clientAct) const
 Pointer to the ClientActivity, or NULL if not present.
bool removeClient (CODEX_Events::Activity *clientAct)
 Remote a ClientActivity from the map.
bool registerSequenceNumber (const unsigned char *seqNum, CODEX_Events::Activity *clientAct)
 Affiliate a sequence number with an activity, so that cleanup of bad connections can be done.
CODEX_Events::ActivitygetActFromSeqNum (const unsigned char *seqNum) const
 Given a sequence number, return the ClientActivity for which the request is acting.
bool removeSequenceNumber (const unsigned char *seqNum)
 Remove a sequence number.
bool addKeyName (const CODEX_ASN1::ustring &name, const CODEX_Client::SignedBoundNameMsg &binding)
 Add a new key name and its binding to the key map.
bool addKeyName (const CODEX_ASN1::ustring &name, const CODEX_Client::BoundNameMsg &binding)
 Add a new key name and its binding to the key map.
const KeyInfogetKeyInfo (const CODEX_ASN1::ustring &name) const
 Pointer to the key's KeyInfo, or NULL if not present.
bool addKeySignature (const CODEX_ASN1::ustring &name, const CODEX_Ciphers::RSASignature &signature)
 Add a signature to a binding.
bool replaceKeyBinding (const CODEX_ASN1::ustring &name, const CODEX_Client::SignedBoundNameMsg &binding)
 Replace a binding with a signed binding.
bool addKeyValue (const CODEX_ASN1::ustring &name, const CODEX_Client::RequestCipherTextType &keyValue)
 Add a key value for an already-bound key name.
bool verifyKeyValue (const CODEX_ASN1::ustring &name)
 Add a bit indicating that a key value is verified.
const LSTypedecryptionShares (const LSType::LabelType &label, unsigned int server) const
 The shares of the private key used to perform decryptions.
const LSType::LabelTypedefaultDecryptionLabel () const
 The label for the default sharing of the decryption key.
const ThresholdDecryptionTypethresholdDecryption () const
 The threshold cryptosystem for performing decryptions.
template<class T>
const LSTypeshareTemplate (const LSType::LabelType &label, unsigned int server) const
 This templated method does type distinction for us, which makes switching between cryptosystems somewhat cleaner.
template<class T>
const LSType::LabelTypelabelTemplate () const
 This templated method does type distinction for us, which makes switching between cryptosystems somewhat cleaner.
template<class T>
const T & thresholdTemplate () const
 This templated method does type distinction for us, which makes switching between cryptosystems somewhat cleaner.
unsigned int ppkSecurityParam () const
 The security parameter for the proof of plaintext knowledge.
SynchronyState synchronize (const char *fname, bool force_read=false)
 Synchronize the object state with stable storage.

Static Public Member Functions

static StateInfoinstance ()
 Static method to fetch the unique instance.
static void destroy ()
 Destroys the unique instance.

Protected Member Functions

 StateInfo ()
 Protected constructor, prevents multiple instances.
virtual ~StateInfo ()
 Protected virtual destructor.

Static Protected Attributes

static StateInfom_instance
 Unique instance of this class.

Detailed Description

This is a singleton class that holds all of the state information that different parts of the key service need to share.

Implementing the state this way allows us not to have to pass pointers and references to the state everywhere. There is, of course, the danger that something that really shouldn't be accessing the state will be able to, but since the server code has to be trusted on that server in any event, this shouldn't matter. The state information can also be saved to and read from disk, so that state can persist between sessions.

Todo:
Add a dirty bit and setting/checking routines. Saving the state to disk will clear the dirty bit. An immortal event can then be used to determine if the state needs to be written to disk.

Definition at line 169 of file CODEX_KeyService/StateInfo.h.


Member Typedef Documentation

typedef map< CODEX_ASN1::ustring , KeyInfo* > CODEX_KeyService::StateInfo::KeyMap
 

Map a key name to its information.

Todo:
Use an SQL database?

Definition at line 200 of file CODEX_KeyService/StateInfo.h.


Member Function Documentation

bool CODEX_KeyService::StateInfo::addClient ClientActivity clientAct  ) 
 

Add a new ClientActivity to the client map.

Returns:
true if successful, false if the activity already exists in the map or an error occurred.

Referenced by CODEX_KeyService::ClientActivity::ClientActivity().

const LSType& CODEX_KeyService::StateInfo::decryptionShares const LSType::LabelType label,
unsigned int  server
const
 

The shares of the private key used to perform decryptions.

Parameters:
label The label for the sharing.
server The server requesting the decryption with this label (used to update servers with invalid labels).
Returns:
A labeled sharing of the private key, uninitialized if the label was not found.

Referenced by CODEX_KeyService::ClientMessageSigner::handler().

CODEX_Events::Activity* CODEX_KeyService::StateInfo::getActFromSeqNum const unsigned char *  seqNum  )  const
 

Given a sequence number, return the ClientActivity for which the request is acting.

Returns:
A pointer to the ClientActivity, or NULL if there is none.

Referenced by CODEX_KeyService::ResponseCallback::fail(), CODEX_KeyService::VerifyWriteCallback::operator()(), CODEX_KeyService::SignWriteCallback::operator()(), CODEX_KeyService::SignReadCallback::operator()(), CODEX_KeyService::SignCreateCallback::operator()(), CODEX_KeyService::ClientWriteCallback::operator()(), CODEX_KeyService::ClientReadCallback::operator()(), and CODEX_KeyService::ClientCreateCallback::operator()().

unsigned int CODEX_KeyService::StateInfo::ppkSecurityParam  )  const [inline]
 

The security parameter for the proof of plaintext knowledge.

This is the number of proof elements to provide.

Definition at line 373 of file CODEX_KeyService/StateInfo.h.

SynchronyState CODEX_KeyService::StateInfo::synchronize const char *  fname,
bool  force_read = false
 

Synchronize the object state with stable storage.

Snapshots can be implemented using different file names at specified points. If the file does not exist, it will be created. If the state information is empty, a read will be attempted. Otherwise a write will be attempted unless force_read is true.

Parameters:
fname The file name on stable storage.
force_read A read should be attempted regardless of the current object state. This is useful for implementing rollbacks.
Return values:
kFailed The operation failed.
kWrote The state was written to stable storage.
kRead The state was read from stable storage.


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