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

client_functions.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2003 Michael A. Marsh, Cornell University. All rights reserved.
00003  * This software is released under the modified BSD license.
00004  * See the file LICENSE in the top-level directory for details.
00005  */
00006 /*
00007  * $Id: client_functions.h,v 1.6 2005/01/21 19:44:16 mmarsh Exp $
00008  *
00009  * $Log: client_functions.h,v $
00010  * Revision 1.6  2005/01/21 19:44:16  mmarsh
00011  * Updated for compatibility with Doxygen 1.4.1
00012  *
00013  * Revision 1.5  2004/05/19 15:56:49  mmarsh
00014  * *** empty log message ***
00015  *
00016  * Revision 1.4  2003/11/13 15:01:52  mmarsh
00017  * There were C++-style comments in the parts of the file that are supposed
00018  * to be C-usable.  Whether it works or not, it's non-ANSI and has been fixed.
00019  *
00020  * Revision 1.3  2003/11/06 17:01:03  mmarsh
00021  * Added the implementations for the C wrappers.  This required some changes
00022  * in the prototypes and structures, as well.
00023  *
00024  * The namespace CODEX_Client::Interface was incorrectly defined.  This has
00025  * now been fixed.
00026  *
00027  * Revision 1.2  2003/11/04 22:31:48  mmarsh
00028  * *** empty log message ***
00029  *
00030  */
00031 
00032 #ifndef __CODEX_CLIENT_CLIENT_FUNCTIONS_H__
00033 #define __CODEX_CLIENT_CLIENT_FUNCTIONS_H__
00034 
00041 #include <openssl/bn.h>
00042 #include <openssl/rsa.h>
00043 
00044 /* We don't want to confuse regular C code. */
00045 #ifdef __cplusplus
00046 
00047 #include "Client.h"
00048 
00049 
00050 namespace CODEX_Client
00051 {
00058    namespace Interface
00059    {
00065       class Interface : public Client
00066       {
00067          public :
00069             static Interface* instance();
00071             static void destroy();
00072          private :
00073             Interface();
00074             virtual ~Interface() {}
00075             static Interface* m_instance;
00076       };
00077 
00078 extern "C"
00079 {
00080 #endif /* __cplusplus */
00081 
00086    typedef struct
00087    {
00088          unsigned char* data; 
00089          long           length; 
00090    } codex_policy_t;
00091 
00096    typedef struct
00097    {
00098          unsigned char* data; 
00099          long           length; 
00100    } codex_credentials_t;
00101 
00106    typedef struct
00107    {
00108          /* Marshalled data */
00109          unsigned char * data; 
00110          long            length; 
00112          /* BoundNameMsg::m_name */
00113          unsigned char * name; 
00114          long            namelen; 
00116          /* BoundNameMsg::m_request */
00117          X509          * owner; 
00118          codex_policy_t* read_policy; 
00119          codex_policy_t* write_policy; 
00121          /* SignedBoundNameMsg::m_signature */
00122          BIGNUM        * signature; 
00123    } codex_binding_t;
00124 
00125 
00134    void codex_zero_policy( codex_policy_t* policy );
00135 
00144    void codex_zero_credentials( codex_credentials_t* credentials );
00145 
00154    void codex_zero_binding( codex_binding_t* binding );
00155 
00156 
00160    codex_policy_t* codex_new_policy();
00161 
00165    codex_credentials_t* codex_new_credentials();
00166 
00170    codex_binding_t* codex_new_binding();
00171 
00172 
00173 
00180    void codex_clear_policy( codex_policy_t* policy );
00181 
00188    void codex_clear_credentials( codex_credentials_t* credentials );
00189 
00196    void codex_clear_binding( codex_binding_t* binding );
00197 
00198 
00207    void codex_free_policy( codex_policy_t* policy );
00208 
00217    void codex_free_credentials( codex_credentials_t* credentials );
00218 
00227    void codex_free_binding( codex_binding_t* binding );
00228 
00229 
00244    int codex_parse_binding( codex_binding_t* binding );
00245 
00246 
00254    int codex_set_server( const char* name, int port );
00255 
00262    int codex_set_service_key( const X509* cert );
00263 
00271    int codex_set_key_pair( const X509* cert, const RSA* key );
00272 
00282    int codex_create_policy( const RSA* policy_pub_key,
00283                             const RSA* owner_priv_key,
00284                             codex_policy_t* policy );
00285 
00295    int codex_issue_credentials( const RSA* client_pub_key,
00296                                 const RSA* policy_priv_key,
00297                                 codex_credentials_t* credentials );
00298 
00310    int codex_create_key( const unsigned char* name,
00311                          int length,
00312                          const X509* owner_cert,
00313                          const codex_policy_t* read_policy,
00314                          const codex_policy_t* write_policy,
00315                          codex_binding_t* binding );
00316 
00329    int codex_write_key( const unsigned char* name,
00330                         int length,
00331                         const BIGNUM* key_value,
00332                         const codex_credentials_t* credentials,
00333                         const RSA* cred_private_key,
00334                         const codex_binding_t* binding );
00335 
00348    int codex_read_key( const unsigned char* name,
00349                        int length,
00350                        const codex_credentials_t* credentials,
00351                        const RSA* cred_private_key,
00352                        BIGNUM** returned_key_value );
00353 
00361    int codex_to_file( const char* fname );
00362 
00370    int codex_from_file( const char* fname );
00371 
00375    void codex_clean_up();
00376 
00377 #ifdef __cplusplus
00378 } /* extern "C" */
00379    } /* namespace Interface */
00380 } /* namespace CODEX_Client */
00381 #endif
00382 
00383 #endif /* __CODEX_CLIENT_CLIENT_FUNCTIONS_H__ */

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