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

CODEX_Client::Interface Namespace Reference

This nested namespace holds a singleton Interface which is only needed for building interfaces to C or other languages that support C hooks but not C++. More...


Classes

class  Interface
 This class is a singleton instance of CODEX_Client::Client. More...
struct  codex_policy_t
 C representation of a CODEX policy. More...
struct  codex_credentials_t
 C representation of a CODEX credentials object. More...
struct  codex_binding_t
 C representation of a CODEX name binding. More...

Functions

void codex_zero_policy (codex_policy_t *policy)
 Zero the elements of a codex_policy_t.
void codex_zero_credentials (codex_credentials_t *credentials)
 Zero the elements of a codex_credentials_t.
void codex_zero_binding (codex_binding_t *binding)
 Zero the elements of a codex_binding_t.
codex_policy_tcodex_new_policy ()
 Allocate a new codex_policy_t.
codex_credentials_tcodex_new_credentials ()
 Allocate a new codex_credentials_t.
codex_binding_tcodex_new_binding ()
 Allocate a new codex_binding_t.
void codex_clear_policy (codex_policy_t *policy)
 Clear a codex_policy_t.
void codex_clear_credentials (codex_credentials_t *credentials)
 Clear a codex_credentials_t.
void codex_clear_binding (codex_binding_t *binding)
 Clear a codex_binding_t.
void codex_free_policy (codex_policy_t *policy)
 Free a codex_policy_t.
void codex_free_credentials (codex_credentials_t *credentials)
 Free a codex_credentials_t.
void codex_free_binding (codex_binding_t *binding)
 Free a codex_binding_t.
int codex_parse_binding (codex_binding_t *binding)
 Parse the binding returned from codex_create_key to fill the various fields.
int codex_set_server (const char *name, int port)
 Set the remote server.
int codex_set_service_key (const X509 *cert)
 Set the service's RSA public key certificate.
int codex_set_key_pair (const X509 *cert, const RSA *key)
 Set the client's RSA public/private key pair.
int codex_create_policy (const RSA *policy_pub_key, const RSA *owner_priv_key, codex_policy_t *policy)
 Create a read/write policy.
int codex_issue_credentials (const RSA *client_pub_key, const RSA *policy_priv_key, codex_credentials_t *credentials)
 Create read/write credentials.
int codex_create_key (const unsigned char *name, int length, const X509 *owner_cert, const codex_policy_t *read_policy, const codex_policy_t *write_policy, codex_binding_t *binding)
 Bind a name and access control policies.
int codex_write_key (const unsigned char *name, int length, const BIGNUM *key_value, const codex_credentials_t *credentials, const RSA *cred_private_key, const codex_binding_t *binding)
 Associate a value with a name.
int codex_read_key (const unsigned char *name, int length, const codex_credentials_t *credentials, const RSA *cred_private_key, BIGNUM **returned_key_value)
 Retrieve the value associate with a name.
int codex_to_file (const char *fname)
 Save the client's state to a file.
int codex_from_file (const char *fname)
 Read the client's state from a file.
void codex_clean_up ()
 Clean up the local state.


Detailed Description

This nested namespace holds a singleton Interface which is only needed for building interfaces to C or other languages that support C hooks but not C++.

An example of this might be a SWIG interface from which to build packages for Perl, Python, or Tcl.


Function Documentation

void CODEX_Client::Interface::codex_clear_binding codex_binding_t binding  ) 
 

Clear a codex_binding_t.

This goes through an existing binding structure and clears all of the elements.

Parameters:
binding A pointer to the structure to clear.

Definition at line 101 of file client_functions.cc.

References codex_free_policy(), and codex_zero_binding().

Referenced by codex_create_key(), codex_free_binding(), and codex_parse_binding().

void CODEX_Client::Interface::codex_clear_credentials codex_credentials_t credentials  ) 
 

Clear a codex_credentials_t.

This goes through an existing credentials structure and clears all of the elements.

Parameters:
credentials A pointer to the structure to clear.

Definition at line 93 of file client_functions.cc.

References codex_zero_credentials().

Referenced by codex_free_credentials(), and codex_issue_credentials().

void CODEX_Client::Interface::codex_clear_policy codex_policy_t policy  ) 
 

Clear a codex_policy_t.

This goes through an existing policy structure and clears all of the elements.

Parameters:
policy A pointer to the structure to clear.

Definition at line 86 of file client_functions.cc.

References codex_zero_policy().

Referenced by codex_create_policy(), and codex_free_policy().

int CODEX_Client::Interface::codex_create_key const unsigned char *  name,
int  length,
const X509 *  owner_cert,
const codex_policy_t read_policy,
const codex_policy_t write_policy,
codex_binding_t binding
 

Bind a name and access control policies.

Bug:
Have to cast away const for X509_dup
Bug:
Have to cast away const for unmarshal

Definition at line 398 of file client_functions.cc.

References codex_clear_binding(), CODEX_Client::Client::createKey(), CODEX_Client::Interface::Interface::instance(), CODEX_Client::SignedMessage< MT, ST >::marshal(), and CODEX_Ciphers::Policy::unmarshal().

int CODEX_Client::Interface::codex_create_policy const RSA *  policy_pub_key,
const RSA *  owner_priv_key,
codex_policy_t policy
 

Create a read/write policy.

Parameters:
policy_pub_key The public key specifying the access policy.
owner_priv_key The owner's private key, which will be used to sign policy_pub_key.
policy A pointer to an allocated policy struct.
Return values:
1 The policy was created.
0 An error occurred.

Definition at line 307 of file client_functions.cc.

References codex_clear_policy(), CODEX_Client::Client::createPolicy(), CODEX_Client::Interface::Interface::instance(), and CODEX_Ciphers::Policy::marshal().

void CODEX_Client::Interface::codex_free_binding codex_binding_t binding  ) 
 

Free a codex_binding_t.

This will free the memory held by the structure as well as the structure itself, and should only be used with dynamically allocated codex_binding_t%s. Statically allocated structures should just call codex_clear_binding.

Parameters:
binding The dynamically allocated binding to free.

Definition at line 236 of file client_functions.cc.

References codex_clear_binding().

void CODEX_Client::Interface::codex_free_credentials codex_credentials_t credentials  ) 
 

Free a codex_credentials_t.

This will free the memory held by the structure as well as the structure itself, and should only be used with dynamically allocated codex_credentials_t%s. Statically allocated structures should just call codex_clear_credentials.

Parameters:
credentials The dynamically allocated credentials to free.

Definition at line 228 of file client_functions.cc.

References codex_clear_credentials().

void CODEX_Client::Interface::codex_free_policy codex_policy_t policy  ) 
 

Free a codex_policy_t.

This will free the memory held by the structure as well as the structure itself, and should only be used with dynamically allocated codex_policy_t%s. Statically allocated structures should just call codex_clear_policy.

Parameters:
policy The dynamically allocated policy to free.

Definition at line 221 of file client_functions.cc.

References codex_clear_policy().

Referenced by codex_clear_binding().

int CODEX_Client::Interface::codex_from_file const char *  fname  ) 
 

Read the client's state from a file.

Parameters:
fname The name of the file.
Return values:
1 The state information was successfully read.
0 An error occurred.
See also:
CODEX_Client::Client::fromFile()

Definition at line 602 of file client_functions.cc.

References CODEX_Client::Client::fromFile(), and CODEX_Client::Interface::Interface::instance().

int CODEX_Client::Interface::codex_issue_credentials const RSA *  client_pub_key,
const RSA *  policy_priv_key,
codex_credentials_t credentials
 

Create read/write credentials.

Parameters:
client_pub_key The public key of the credentials holder.
policy_priv_key The private key for the access policy, which will be used to sign policy_pub_key.
credentials A pointer to an allocated credentials struct.
Return values:
1 The credentials were created.
0 An error occurred.

Definition at line 351 of file client_functions.cc.

References codex_clear_credentials(), CODEX_Client::Interface::Interface::instance(), CODEX_Client::Client::issueCredentials(), and CODEX_Ciphers::Credentials::marshal().

int CODEX_Client::Interface::codex_parse_binding codex_binding_t binding  ) 
 

Parse the binding returned from codex_create_key to fill the various fields.

Bug:
Have to cast away const for X509_dup

Definition at line 142 of file client_functions.cc.

References codex_clear_binding(), CODEX_Client::Interface::codex_binding_t::data, CODEX_Ciphers::Policy::marshal(), CODEX_Client::SignedMessage< MT, ST >::message(), CODEX_Client::BoundNameMsg::name(), CODEX_Client::CreateKeyMsg::owner(), CODEX_Client::CreateKeyMsg::readP(), CODEX_Client::BoundNameMsg::request(), CODEX_Client::SignedMessage< MT, ST >::signature(), CODEX_Client::SignedMessage< MT, ST >::unmarshal(), CODEX_ASN1::BigNumber::value(), CODEX_ASN1::Certificate::value(), CODEX_ASN1::OctetString::value(), and CODEX_Client::CreateKeyMsg::writeP().

int CODEX_Client::Interface::codex_read_key const unsigned char *  name,
int  length,
const codex_credentials_t credentials,
const RSA *  cred_private_key,
BIGNUM **  returned_key_value
 

Retrieve the value associate with a name.

Bug:
Have to cast away const for unmarshal

Definition at line 529 of file client_functions.cc.

References CODEX_Client::Interface::Interface::instance(), CODEX_Client::Client::readKey(), and CODEX_Ciphers::Credentials::unmarshal().

int CODEX_Client::Interface::codex_set_key_pair const X509 *  cert,
const RSA *  key
 

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

Bug:
Have to cast away const for X509_dup

Definition at line 283 of file client_functions.cc.

References CODEX_Client::Interface::Interface::instance(), and CODEX_Client::Client::setKeyPair().

int CODEX_Client::Interface::codex_set_server const char *  name,
int  port
 

Set the remote server.

Parameters:
name Null-terminated string containing remote host name.
port Port on the remote server to contact.
Return values:
1 Server information was successfully set up.
0 An error occurred.

Definition at line 244 of file client_functions.cc.

References CODEX_Client::Interface::Interface::instance(), and CODEX_Client::Client::setRemoteServer().

int CODEX_Client::Interface::codex_set_service_key const X509 *  cert  ) 
 

Set the service's RSA public key certificate.

Parameters:
cert The certificate identifying the service.
Return values:
1 The key was set.
0 An error occurred.

Definition at line 263 of file client_functions.cc.

References CODEX_Client::Interface::Interface::instance(), and CODEX_Client::Client::setServiceKey().

int CODEX_Client::Interface::codex_to_file const char *  fname  ) 
 

Save the client's state to a file.

Parameters:
fname The name of the file.
Return values:
1 The state information was successfully written.
0 An error occurred.
See also:
CODEX_Client::Client::toFile()

Definition at line 583 of file client_functions.cc.

References CODEX_Client::Interface::Interface::instance(), and CODEX_Client::Client::toFile().

int CODEX_Client::Interface::codex_write_key const unsigned char *  name,
int  length,
const BIGNUM *  key_value,
const codex_credentials_t credentials,
const RSA *  cred_private_key,
const codex_binding_t binding
 

Associate a value with a name.

Bug:
Have to cast away const for unmarshal

Definition at line 467 of file client_functions.cc.

References CODEX_Client::Interface::Interface::instance(), CODEX_Client::SignedMessage< MT, ST >::unmarshal(), CODEX_Ciphers::Credentials::unmarshal(), and CODEX_Client::Client::writeKey().

void CODEX_Client::Interface::codex_zero_binding codex_binding_t binding  ) 
 

Zero the elements of a codex_binding_t.

This does not do any memory management, it just provides a convenient single-call way to zero out everything. This is useful for statically allocated structures, just to make sure they're properly initialized.

Parameters:
binding The binding to zero.

Definition at line 72 of file client_functions.cc.

Referenced by codex_clear_binding(), and codex_new_binding().

void CODEX_Client::Interface::codex_zero_credentials codex_credentials_t credentials  ) 
 

Zero the elements of a codex_credentials_t.

This does not do any memory management, it just provides a convenient single-call way to zero out everything. This is useful for statically allocated structures, just to make sure they're properly initialized.

Parameters:
credentials The credentials to zero.

Definition at line 64 of file client_functions.cc.

Referenced by codex_clear_credentials(), and codex_new_credentials().

void CODEX_Client::Interface::codex_zero_policy codex_policy_t policy  ) 
 

Zero the elements of a codex_policy_t.

This does not do any memory management, it just provides a convenient single-call way to zero out everything. This is useful for statically allocated structures, just to make sure they're properly initialized.

Parameters:
policy The policy to zero.

Definition at line 57 of file client_functions.cc.

Referenced by codex_clear_policy(), and codex_new_policy().


Generated on Fri May 6 17:42:00 2005 for COrnell Data EXchange (CODEX) by  doxygen 1.4.1