00001 // $Id: SSLIOP_ClientCredentials.cpp 77001 2007-02-12 07:54:49Z johnnyw $ 00002 00003 #include "orbsvcs/SSLIOP/SSLIOP_ClientCredentials.h" 00004 #include "orbsvcs/SSLIOP/SSLIOP_OwnCredentials.h" 00005 00006 00007 ACE_RCSID (SSLIOP, 00008 SSLIOP_ClientCredentials, 00009 "$Id: SSLIOP_ClientCredentials.cpp 77001 2007-02-12 07:54:49Z johnnyw $") 00010 00011 00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00013 00014 TAO::SSLIOP::ClientCredentials::ClientCredentials ( 00015 X509 * cert, 00016 EVP_PKEY *evp, 00017 SSL * ssl) 00018 : SSLIOP_Credentials (cert, evp), 00019 ssl_ (TAO::SSLIOP::OpenSSL_traits< ::SSL >::_duplicate (ssl)) 00020 { 00021 } 00022 00023 TAO::SSLIOP::ClientCredentials::~ClientCredentials (void) 00024 { 00025 } 00026 00027 SecurityLevel3::CredentialsType 00028 TAO::SSLIOP::ClientCredentials::creds_type (void) 00029 { 00030 return SecurityLevel3::CT_ClientCredentials; 00031 } 00032 00033 char * 00034 TAO::SSLIOP::ClientCredentials::context_id (void) 00035 { 00036 throw CORBA::NO_IMPLEMENT (); 00037 } 00038 00039 SecurityLevel3::Principal * 00040 TAO::SSLIOP::ClientCredentials::client_principal (void) 00041 { 00042 throw CORBA::NO_IMPLEMENT (); 00043 } 00044 00045 SecurityLevel3::StatementList * 00046 TAO::SSLIOP::ClientCredentials::client_supporting_statements () 00047 { 00048 throw CORBA::NO_IMPLEMENT (); 00049 } 00050 00051 SecurityLevel3::ResourceNameList * 00052 TAO::SSLIOP::ClientCredentials::client_restricted_resources () 00053 { 00054 throw CORBA::NO_IMPLEMENT (); 00055 } 00056 00057 SecurityLevel3::Principal * 00058 TAO::SSLIOP::ClientCredentials::target_principal (void) 00059 { 00060 throw CORBA::NO_IMPLEMENT (); 00061 } 00062 00063 SecurityLevel3::StatementList * 00064 TAO::SSLIOP::ClientCredentials::target_supporting_statements () 00065 { 00066 throw CORBA::NO_IMPLEMENT (); 00067 } 00068 00069 SecurityLevel3::ResourceNameList * 00070 TAO::SSLIOP::ClientCredentials::target_restricted_resources () 00071 { 00072 throw CORBA::NO_IMPLEMENT (); 00073 } 00074 00075 SecurityLevel3::OwnCredentials_ptr 00076 TAO::SSLIOP::ClientCredentials::parent_credentials (void) 00077 { 00078 SecurityLevel3::OwnCredentials_ptr creds = 00079 SecurityLevel3::OwnCredentials::_nil (); 00080 00081 ACE_NEW_THROW_EX (creds, 00082 TAO::SSLIOP::OwnCredentials ( 00083 ::SSL_get_certificate (this->ssl_.in ()), 00084 ::SSL_get_privatekey (this->ssl_.in ())), 00085 CORBA::NO_MEMORY ()); 00086 00087 return creds; 00088 } 00089 00090 CORBA::Boolean 00091 TAO::SSLIOP::ClientCredentials::client_authentication () 00092 { 00093 // If the client presented no certificate (i.e. cert_.ptr() == 0), 00094 // the client was not authenticated. Otherwise, verify the peer's 00095 // certificate. 00096 00097 return 00098 this->x509_.in () != 0 00099 && SSL_get_verify_result (this->ssl_.in ()) == X509_V_OK; 00100 } 00101 00102 CORBA::Boolean 00103 TAO::SSLIOP::ClientCredentials::target_authentication (void) 00104 { 00105 throw CORBA::NO_IMPLEMENT (); 00106 } 00107 00108 CORBA::Boolean 00109 TAO::SSLIOP::ClientCredentials::confidentiality (void) 00110 { 00111 throw CORBA::NO_IMPLEMENT (); 00112 } 00113 00114 CORBA::Boolean 00115 TAO::SSLIOP::ClientCredentials::integrity (void) 00116 { 00117 // TAO's SSLIOP pluggable transport always provides integrity. Note 00118 // that if we 00119 00120 return true; 00121 } 00122 00123 TAO_END_VERSIONED_NAMESPACE_DECL