Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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.5 2004/05/19 15:56:49 mmarsh Exp $
00008  *
00009  * $Log: client_functions.h,v $
00010  * Revision 1.5  2004/05/19 15:56:49  mmarsh
00011  * *** empty log message ***
00012  *
00013  * Revision 1.4  2003/11/13 15:01:52  mmarsh
00014  * There were C++-style comments in the parts of the file that are supposed
00015  * to be C-usable.  Whether it works or not, it's non-ANSI and has been fixed.
00016  *
00017  * Revision 1.3  2003/11/06 17:01:03  mmarsh
00018  * Added the implementations for the C wrappers.  This required some changes
00019  * in the prototypes and structures, as well.
00020  *
00021  * The namespace CODEX_Client::Interface was incorrectly defined.  This has
00022  * now been fixed.
00023  *
00024  * Revision 1.2  2003/11/04 22:31:48  mmarsh
00025  * *** empty log message ***
00026  *
00027  */
00028 
00029 #ifndef __CODEX_CLIENT_CLIENT_FUNCTIONS_H__
00030 #define __CODEX_CLIENT_CLIENT_FUNCTIONS_H__
00031 
00038 #include <openssl/bn.h>
00039 #include <openssl/rsa.h>
00040 
00041 /* We don't want to confuse regular C code. */
00042 #ifdef __cplusplus
00043 
00044 #include "Client.h"
00045 
00046 
00047 namespace CODEX_Client
00048 {
00055    namespace Interface
00056    {
00062       class Interface : public Client
00063       {
00064          public :
00066             static Interface* instance();
00068             static void destroy();
00069          private :
00070             Interface();
00071             virtual ~Interface() {}
00072             static Interface* m_instance;
00073       };
00074 
00075 extern "C"
00076 {
00077 #endif /* __cplusplus */
00078 
00083    typedef struct
00084    {
00085          unsigned char* data; 
00086          long           length; 
00087    } codex_policy_t;
00088 
00093    typedef struct
00094    {
00095          unsigned char* data; 
00096          long           length; 
00097    } codex_credentials_t;
00098 
00103    typedef struct
00104    {
00105          /* Marshalled data */
00106          unsigned char * data; 
00107          long            length; 
00109          /* BoundNameMsg::m_name */
00110          unsigned char * name; 
00111          long            namelen; 
00113          /* BoundNameMsg::m_request */
00114          X509          * owner; 
00115          codex_policy_t* read_policy; 
00116          codex_policy_t* write_policy; 
00118          /* SignedBoundNameMsg::m_signature */
00119          BIGNUM        * signature; 
00120    } codex_binding_t;
00121 
00122 
00131    void codex_zero_policy( codex_policy_t* policy );
00132 
00141    void codex_zero_credentials( codex_credentials_t* credentials );
00142 
00151    void codex_zero_binding( codex_binding_t* binding );
00152 
00153 
00157    codex_policy_t* codex_new_policy();
00158 
00162    codex_credentials_t* codex_new_credentials();
00163 
00167    codex_binding_t* codex_new_binding();
00168 
00169 
00170 
00177    void codex_clear_policy( codex_policy_t* policy );
00178 
00185    void codex_clear_credentials( codex_credentials_t* credentials );
00186 
00193    void codex_clear_binding( codex_binding_t* binding );
00194 
00195 
00204    void codex_free_policy( codex_policy_t* policy );
00205 
00214    void codex_free_credentials( codex_credentials_t* credentials );
00215 
00224    void codex_free_binding( codex_binding_t* binding );
00225 
00226 
00241    int codex_parse_binding( codex_binding_t* binding );
00242 
00243 
00251    int codex_set_server( const char* name, int port );
00252 
00259    int codex_set_service_key( const X509* cert );
00260 
00268    int codex_set_key_pair( const X509* cert, const RSA* key );
00269 
00279    int codex_create_policy( const RSA* policy_pub_key,
00280                             const RSA* owner_priv_key,
00281                             codex_policy_t* policy );
00282 
00292    int codex_issue_credentials( const RSA* client_pub_key,
00293                                 const RSA* policy_priv_key,
00294                                 codex_credentials_t* credentials );
00295 
00307    int codex_create_key( const unsigned char* name,
00308                          int length,
00309                          const X509* owner_cert,
00310                          const codex_policy_t* read_policy,
00311                          const codex_policy_t* write_policy,
00312                          codex_binding_t* binding );
00313 
00326    int codex_write_key( const unsigned char* name,
00327                         int length,
00328                         const BIGNUM* key_value,
00329                         const codex_credentials_t* credentials,
00330                         const RSA* cred_private_key,
00331                         const codex_binding_t* binding );
00332 
00345    int codex_read_key( const unsigned char* name,
00346                        int length,
00347                        const codex_credentials_t* credentials,
00348                        const RSA* cred_private_key,
00349                        BIGNUM** returned_key_value );
00350 
00358    int codex_to_file( const char* fname );
00359 
00367    int codex_from_file( const char* fname );
00368 
00372    void codex_clean_up();
00373 
00374 #ifdef __cplusplus
00375 } /* extern "C" */
00376    } /* namespace Interface */
00377 } /* namespace CODEX_Client */
00378 #endif
00379 
00380 #endif /* __CODEX_CLIENT_CLIENT_FUNCTIONS_H__ */

Generated on Wed Jun 2 16:32:54 2004 for COrnell Data EXchange (CODEX) by doxygen1.2.18