00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SSLIOP_Credentials.h 00006 * 00007 * $Id: SSLIOP_Credentials.h 81490 2008-04-28 14:32:24Z johnnyw $ 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 ::CORBA::LocalObject 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 (void); 00078 00079 virtual SecurityLevel3::CredentialsType creds_type (void) = 0; 00080 00081 virtual SecurityLevel3::CredentialsUsage creds_usage (); 00082 00083 virtual TimeBase::UtcT expiry_time (void); 00084 00085 virtual SecurityLevel3::CredentialsState creds_state (); 00086 00087 virtual char * add_relinquished_listener ( 00088 SecurityLevel3::RelinquishedCredentialsListener_ptr listener); 00089 00090 virtual void remove_relinquished_listener (const char * id); 00091 //@} 00092 00093 00094 //@{ 00095 /// Return a pointer to the underlying X.509 certificate. 00096 /** 00097 * @note Caller owns the returned object. Use a 00098 * TAO::SSLIOP::X509_var. 00099 */ 00100 ::X509 *x509 (void); 00101 //@} 00102 00103 /// Return a pointer to the underlying private key. 00104 /** 00105 * @return Non-zero value if private key is used. 00106 * 00107 * @note Caller owns the returned object. Use a 00108 * TAO::SSLIOP::EVP_PKEY_var. 00109 */ 00110 ::EVP_PKEY *evp (void); 00111 //@} 00112 00113 bool operator== (const SSLIOP_Credentials &rhs); 00114 00115 CORBA::ULong hash (void) const; 00116 00117 // The static operations. 00118 static SSLIOP::Credentials_ptr _duplicate (SSLIOP::Credentials_ptr obj); 00119 00120 static SSLIOP::Credentials_ptr _narrow (CORBA::Object_ptr obj); 00121 00122 static SSLIOP::Credentials_ptr _nil (void) 00123 { 00124 return (SSLIOP::Credentials_ptr) 0; 00125 } 00126 00127 //@} 00128 00129 protected: 00130 00131 /// Destructor. 00132 /** 00133 * Protected destructor to enforce proper memory management 00134 * through the reference counting mechanism. 00135 */ 00136 ~SSLIOP_Credentials (void); 00137 00138 protected: 00139 00140 /// Reference to the X.509 certificate associated with this SSLIOP 00141 /// Credentials object. 00142 SSLIOP::X509_var x509_; 00143 00144 /// Reference to the private key associated with the X.509 00145 /// certificate. 00146 SSLIOP::EVP_PKEY_var evp_; 00147 00148 /// Credentials Identifier. 00149 CORBA::String_var id_; 00150 00151 /// The intended usage of the Credentials. 00152 SecurityLevel3::CredentialsUsage creds_usage_; 00153 00154 /// The time these Credentials expire. 00155 TimeBase::UtcT expiry_time_; 00156 00157 /// The validity of the Credentials. 00158 SecurityLevel3::CredentialsState creds_state_; 00159 00160 }; 00161 00162 // } // End SSLIOP namespace 00163 } // End TAO namespace 00164 00165 TAO_END_VERSIONED_NAMESPACE_DECL 00166 00167 #if defined (__ACE_INLINE__) 00168 # include "orbsvcs/SSLIOP/SSLIOP_Credentials.inl" 00169 #endif /* __ACE_INLINE__ */ 00170 00171 #include /**/ "ace/post.h" 00172 00173 #endif /* TAO_SSLIOP_CREDENTIALS_H */