00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SSLIOP_CredentialsAcquirer.h 00006 * 00007 * SSLIOP_CredentialsAcquirer.h,v 1.6 2005/11/16 17:16:15 ossama Exp 00008 * 00009 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef TAO_SSLIOP_CREDENTIALS_ACQUIRER_H 00015 #define TAO_SSLIOP_CREDENTIALS_ACQUIRER_H 00016 00017 #include /**/ "ace/pre.h" 00018 #include "orbsvcs/SSLIOP/SSLIOP_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "orbsvcs/Security/SL3_CredentialsCurator.h" 00025 00026 #include "orbsvcs/SSLIOPC.h" 00027 #include "orbsvcs/SecurityLevel3C.h" 00028 00029 #include "tao/LocalObject.h" 00030 00031 #include <openssl/opensslconf.h> 00032 00033 00034 #if defined(_MSC_VER) 00035 #pragma warning(push) 00036 #pragma warning(disable:4250) 00037 #endif /* _MSC_VER */ 00038 00039 00040 /// Forward declarations for OpenSSL data structures. 00041 extern "C" 00042 { 00043 typedef struct x509_st X509; 00044 typedef struct evp_pkey_st EVP_PKEY; 00045 } 00046 00047 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00048 00049 namespace TAO 00050 { 00051 namespace SSLIOP 00052 { 00053 /** 00054 * @class CredentialsAcquirer 00055 * 00056 * @brief SSLIOP-specific SecurityLevel3::CredentialsAcquirer 00057 * implementation. 00058 * 00059 * This class generates SSLIOP-specific credentials. 00060 */ 00061 class TAO_SSLIOP_Export CredentialsAcquirer 00062 : public virtual SecurityLevel3::CredentialsAcquirer, 00063 public virtual TAO_Local_RefCounted_Object 00064 { 00065 public: 00066 00067 /// Constructor 00068 CredentialsAcquirer (TAO::SL3::CredentialsCurator_ptr curator, 00069 const CORBA::Any & acquisition_arguments); 00070 00071 /** 00072 * @name SecurityLevel3::CredentialsAcquirer Methods 00073 * 00074 * Methods required by the SecurityLevel3::CredentialsAcquirer 00075 * interface. 00076 */ 00077 //@{ 00078 virtual char * acquisition_method (ACE_ENV_SINGLE_ARG_DECL) 00079 ACE_THROW_SPEC ((CORBA::SystemException)); 00080 00081 virtual SecurityLevel3::AcquisitionStatus current_status ( 00082 ACE_ENV_SINGLE_ARG_DECL) 00083 ACE_THROW_SPEC ((CORBA::SystemException)); 00084 00085 virtual CORBA::ULong nth_iteration (ACE_ENV_SINGLE_ARG_DECL) 00086 ACE_THROW_SPEC ((CORBA::SystemException)); 00087 00088 virtual CORBA::Any * get_continuation_data (ACE_ENV_SINGLE_ARG_DECL) 00089 ACE_THROW_SPEC ((CORBA::SystemException)); 00090 00091 virtual SecurityLevel3::AcquisitionStatus continue_acquisition ( 00092 const CORBA::Any & acquisition_arguments 00093 ACE_ENV_ARG_DECL) 00094 ACE_THROW_SPEC ((CORBA::SystemException)); 00095 00096 virtual SecurityLevel3::OwnCredentials_ptr get_credentials ( 00097 CORBA::Boolean on_list 00098 ACE_ENV_ARG_DECL) 00099 ACE_THROW_SPEC ((CORBA::SystemException)); 00100 00101 virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) 00102 ACE_THROW_SPEC ((CORBA::SystemException)); 00103 //@} 00104 00105 protected: 00106 00107 /// Destructor 00108 /** 00109 * Protected destructor to enforce proper memory management 00110 * through the reference counting mechanism. 00111 */ 00112 ~CredentialsAcquirer (void); 00113 00114 private: 00115 00116 /// Verify that this CredentialsAcquirer object is still valid, 00117 /// i.e. hasn't been destroyed. 00118 void check_validity (ACE_ENV_SINGLE_ARG_DECL); 00119 00120 /// Create an OpenSSL X.509 certificate data structure. 00121 static ::X509 * make_X509 (const ::SSLIOP::File &certificate); 00122 00123 /// Create an OpenSSL EVP_PKEY key data structure. 00124 static ::EVP_PKEY * make_EVP_PKEY (const ::SSLIOP::File &key); 00125 00126 private: 00127 00128 /// Lock used for synchronization. 00129 TAO_SYNCH_MUTEX lock_; 00130 00131 /// Reference to the TAO CredentialsCurator implementation. 00132 TAO::SL3::CredentialsCurator_var curator_; 00133 00134 /// SSLIOP-specific credentials acquisition arguments. 00135 const CORBA::Any & acquisition_arguments_; 00136 00137 /// Has this CredentialsAcquirer object completed credentials 00138 /// acquisition or been explicitly destroyed? 00139 bool destroyed_; 00140 00141 }; 00142 00143 } // End SSLIOP namespace 00144 } // End TAO namespace 00145 00146 TAO_END_VERSIONED_NAMESPACE_DECL 00147 00148 #if defined(_MSC_VER) 00149 #pragma warning(pop) 00150 #endif /* _MSC_VER */ 00151 00152 #include /**/ "ace/post.h" 00153 00154 #endif /* TAO_SSLIOP_CREDENTIALS_ACQUIRER_H */