Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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>

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
 Indicates the result of a call to synchronize().


Public Methods

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 ()
 
Returns:
the domain identifier for client messages


unsigned char delegationDomain ()
 
Returns:
the domain identifier for internal delegation messages


long clientPort () const
 
Returns:
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
 
Returns:
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
 
Returns:
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
 
Returns:
The label for the default sharing of the decryption key.


const ThresholdDecryptionTypethresholdDecryption () const
 
Returns:
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
SynchronyState synchronize (const char *fname, bool force_read=false)
 Synchronize the object state with stable storage.


Static Public Methods

StateInfo * instance ()
 Static method to fetch the unique instance.

void destroy ()
 Destroys the unique instance.


Protected Methods

 StateInfo ()
 Protected constructor, prevents multiple instances.

virtual ~StateInfo ()
 Protected virtual destructor.


Static Protected Attributes

StateInfo * m_instance = 0
 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 166 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 197 of file CODEX_KeyService/StateInfo.h.


Member Function Documentation

bool 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.

Definition at line 293 of file CODEX_KeyService/StateInfo.cc.

const StateInfo::LSType & 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.

Definition at line 498 of file CODEX_KeyService/StateInfo.cc.

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

CODEX_Events::Activity * 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.

Definition at line 364 of file CODEX_KeyService/StateInfo.cc.

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]
 

Returns:
The security parameter for the proof of plaintext knowledge. This is the number of proof elements to provide.

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

StateInfo::SynchronyState 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.

Definition at line 68 of file CODEX_KeyService/StateInfo.cc.

References CODEX_ASN1::OctetString::marshal(), CODEX_ASN1::Integer::marshal(), CODEX_KeyService::KeyInfo::unmarshal(), CODEX_ASN1::OctetString::unmarshal(), CODEX_ASN1::Integer::unmarshal(), CODEX_ASN1::OctetString::value(), and CODEX_ASN1::Integer::value().


The documentation for this class was generated from the following files:
Generated on Wed Jun 2 16:33:14 2004 for COrnell Data EXchange (CODEX) by doxygen1.2.18