00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SSLIOP_Credentials.h 00006 * 00007 * SSLIOP_Credentials.h,v 1.20 2006/06/22 15:03:25 parsons Exp 00008 * 00009 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_SSLIOP_CREDENTIALS_H 00014 #define TAO_SSLIOP_CREDENTIALS_H 00015 00016 #include /**/ "ace/pre.h" 00017 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/SSLIOP/SSLIOP_X509.h" 00025 #include "orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h" 00026 #include "orbsvcs/SecurityLevel3C.h" 00027 #include "tao/LocalObject.h" 00028 00029 00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 namespace TAO 00033 { 00034 class SSLIOP_Credentials; 00035 00036 namespace SSLIOP 00037 { 00038 typedef SSLIOP_Credentials* Credentials_ptr; 00039 typedef TAO_Pseudo_Var_T<SSLIOP_Credentials> Credentials_var; 00040 typedef TAO_Pseudo_Out_T<SSLIOP_Credentials> Credentials_out; 00041 } 00042 00043 /** 00044 * @class SSLIOP_Credentials 00045 * 00046 * @brief SSLIOP-specific implementation of the 00047 * SecurityLevel3::Credentials interface. 00048 * 00049 * This class encapsulates the X.509 certificate associated with a 00050 * given a principal. 00051 * 00052 * @note Why is this class not the TAO::SSLIOP namespace? Because 00053 * brain damaged MSVC++ 6 cannot call a base class 00054 * constructor of class declared in a namespace that is more 00055 * than one level deep in a sub-class base member 00056 * initializer list. 00057 */ 00058 class TAO_SSLIOP_Export SSLIOP_Credentials 00059 : public virtual SecurityLevel3::Credentials, 00060 public virtual TAO_Local_RefCounted_Object 00061 { 00062 public: 00063 typedef SSLIOP::Credentials_ptr _ptr_type; 00064 typedef SSLIOP::Credentials_var _var_type; 00065 typedef SSLIOP::Credentials_out _out_type; 00066 00067 /// Constructor 00068 SSLIOP_Credentials (::X509 * cert, ::EVP_PKEY * evp); 00069 00070 /** 00071 * @name SecurityLevel3::Credentials Methods 00072 * 00073 * Methods required by the SecurityLevel3::Credentials 00074 * interface. 00075 */ 00076 //@{ 00077 virtual char * creds_id (ACE_ENV_SINGLE_ARG_DECL) 00078 ACE_THROW_SPEC ((CORBA::SystemException)); 00079 00080 virtual 00081 SecurityLevel3::CredentialsType creds_type (ACE_ENV_SINGLE_ARG_DECL) 00082 ACE_THROW_SPEC ((CORBA::SystemException)) = 0; 00083 00084 virtual SecurityLevel3::CredentialsUsage creds_usage ( 00085 ACE_ENV_SINGLE_ARG_DECL) 00086 ACE_THROW_SPEC ((CORBA::SystemException)); 00087 00088 virtual TimeBase::UtcT expiry_time (ACE_ENV_SINGLE_ARG_DECL) 00089 ACE_THROW_SPEC ((CORBA::SystemException)); 00090 00091 virtual SecurityLevel3::CredentialsState creds_state ( 00092 ACE_ENV_SINGLE_ARG_DECL) 00093 ACE_THROW_SPEC ((CORBA::SystemException)); 00094 00095 virtual char * add_relinquished_listener ( 00096 SecurityLevel3::RelinquishedCredentialsListener_ptr listener 00097 ACE_ENV_ARG_DECL) 00098 ACE_THROW_SPEC ((CORBA::SystemException)); 00099 00100 virtual void remove_relinquished_listener (const char * id 00101 ACE_ENV_ARG_DECL) 00102 ACE_THROW_SPEC ((CORBA::SystemException)); 00103 //@} 00104 00105 00106 //@{ 00107 /// Return a pointer to the underlying X.509 certificate. 00108 /** 00109 * @note Caller owns the returned object. Use a 00110 * TAO::SSLIOP::X509_var. 00111 */ 00112 ::X509 *x509 (void); 00113 //@} 00114 00115 /// Return a pointer to the underlying private key. 00116 /** 00117 * @return Non-zero value if private key is used. 00118 * 00119 * @note Caller owns the returned object. Use a 00120 * TAO::SSLIOP::EVP_PKEY_var. 00121 */ 00122 ::EVP_PKEY *evp (void); 00123 //@} 00124 00125 bool operator== (const SSLIOP_Credentials &rhs); 00126 00127 CORBA::ULong hash (void) const; 00128 00129 // The static operations. 00130 static SSLIOP::Credentials_ptr _duplicate (SSLIOP::Credentials_ptr obj); 00131 00132 static SSLIOP::Credentials_ptr _narrow (CORBA::Object_ptr obj 00133 ACE_ENV_ARG_DECL); 00134 00135 static SSLIOP::Credentials_ptr _nil (void) 00136 { 00137 return (SSLIOP::Credentials_ptr) 0; 00138 } 00139 00140 //@} 00141 00142 protected: 00143 00144 /// Destructor. 00145 /** 00146 * Protected destructor to enforce proper memory management 00147 * through the reference counting mechanism. 00148 */ 00149 ~SSLIOP_Credentials (void); 00150 00151 protected: 00152 00153 /// Reference to the X.509 certificate associated with this SSLIOP 00154 /// Credentials object. 00155 SSLIOP::X509_var x509_; 00156 00157 /// Reference to the private key associated with the X.509 00158 /// certificate. 00159 SSLIOP::EVP_PKEY_var evp_; 00160 00161 /// Credentials Identifier. 00162 CORBA::String_var id_; 00163 00164 /// The intended usage of the Credentials. 00165 SecurityLevel3::CredentialsUsage creds_usage_; 00166 00167 /// The time these Credentials expire. 00168 TimeBase::UtcT expiry_time_; 00169 00170 /// The validity of the Credentials. 00171 SecurityLevel3::CredentialsState creds_state_; 00172 00173 }; 00174 00175 // } // End SSLIOP namespace 00176 } // End TAO namespace 00177 00178 TAO_END_VERSIONED_NAMESPACE_DECL 00179 00180 #if defined (__ACE_INLINE__) 00181 # include "orbsvcs/SSLIOP/SSLIOP_Credentials.inl" 00182 #endif /* __ACE_INLINE__ */ 00183 00184 #include /**/ "ace/post.h" 00185 00186 #endif /* TAO_SSLIOP_CREDENTIALS_H */