#include <LocalCredentialData.h>
Public Types | |
typedef DCPS::RcHandle < LocalAuthCredentialData > | shared_ptr |
Public Member Functions | |
LocalAuthCredentialData () | |
virtual | ~LocalAuthCredentialData () |
bool | load_access_permissions (const DDS::Security::PermissionsCredentialToken &src, DDS::Security::SecurityException &ex) |
bool | load_credentials (const DDS::PropertySeq &props, DDS::Security::SecurityException &ex) |
const SSL::Certificate & | get_ca_cert () const |
const SSL::Certificate & | get_participant_cert () const |
const SSL::PrivateKey & | get_participant_private_key () const |
const DDS::OctetSeq & | get_access_permissions () const |
bool | validate () const |
Private Attributes | |
SSL::Certificate::unique_ptr | ca_cert_ |
SSL::Certificate::unique_ptr | participant_cert_ |
SSL::PrivateKey::unique_ptr | participant_pkey_ |
DDS::OctetSeq | access_permissions_ |
Definition at line 41 of file Authentication/LocalCredentialData.h.
typedef DCPS::RcHandle<LocalAuthCredentialData> OpenDDS::Security::LocalAuthCredentialData::shared_ptr |
Definition at line 43 of file Authentication/LocalCredentialData.h.
OpenDDS::Security::LocalAuthCredentialData::LocalAuthCredentialData | ( | ) |
Definition at line 63 of file Authentication/LocalCredentialData.cpp.
OpenDDS::Security::LocalAuthCredentialData::~LocalAuthCredentialData | ( | ) | [virtual] |
Definition at line 68 of file Authentication/LocalCredentialData.cpp.
const DDS::OctetSeq& OpenDDS::Security::LocalAuthCredentialData::get_access_permissions | ( | ) | const [inline] |
Definition at line 69 of file Authentication/LocalCredentialData.h.
Referenced by OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_reply(), and OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_request().
00070 { 00071 return access_permissions_; 00072 }
const SSL::Certificate& OpenDDS::Security::LocalAuthCredentialData::get_ca_cert | ( | ) | const [inline] |
Definition at line 54 of file Authentication/LocalCredentialData.h.
Referenced by OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_reply(), OpenDDS::Security::AuthenticationBuiltInImpl::get_identity_token(), and OpenDDS::Security::AuthenticationBuiltInImpl::process_handshake_reply().
00055 { 00056 return *ca_cert_; 00057 }
const SSL::Certificate& OpenDDS::Security::LocalAuthCredentialData::get_participant_cert | ( | ) | const [inline] |
Definition at line 59 of file Authentication/LocalCredentialData.h.
Referenced by OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_reply(), OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_request(), and OpenDDS::Security::AuthenticationBuiltInImpl::get_identity_token().
00060 { 00061 return *participant_cert_; 00062 }
const SSL::PrivateKey& OpenDDS::Security::LocalAuthCredentialData::get_participant_private_key | ( | ) | const [inline] |
Definition at line 64 of file Authentication/LocalCredentialData.h.
Referenced by OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_reply(), and OpenDDS::Security::AuthenticationBuiltInImpl::process_handshake_reply().
00065 { 00066 return *participant_pkey_; 00067 }
bool OpenDDS::Security::LocalAuthCredentialData::load_access_permissions | ( | const DDS::Security::PermissionsCredentialToken & | src, | |
DDS::Security::SecurityException & | ex | |||
) |
Definition at line 73 of file Authentication/LocalCredentialData.cpp.
References access_permissions_, OpenDDS::DCPS::back_inserter(), and OpenDDS::Security::CommonUtilities::set_security_error().
00075 { 00076 const char* cperm = TokenReader(src).get_property_value("dds.perm.cert"); 00077 if (! cperm) { 00078 set_security_error(ex, -1, 0, 00079 "LocalAuthCredentialData::load_access_permissions: " 00080 "no 'dds.perm.cert' property provided"); 00081 return false; 00082 } 00083 DCPS::SequenceBackInsertIterator<DDS::OctetSeq> back_inserter(access_permissions_); 00084 std::copy(cperm, cperm + std::strlen(cperm), back_inserter); 00085 00086 // Set trailing null bit 00087 *back_inserter = 0u; 00088 00089 return true; 00090 }
bool OpenDDS::Security::LocalAuthCredentialData::load_credentials | ( | const DDS::PropertySeq & | props, | |
DDS::Security::SecurityException & | ex | |||
) |
Definition at line 92 of file Authentication/LocalCredentialData.cpp.
References ca_cert_, OpenDDS::DCPS::DCPS_debug_level, LM_DEBUG, participant_cert_, participant_pkey_, OpenDDS::DCPS::unique_ptr< T, Deleter >::reset(), and OpenDDS::Security::CommonUtilities::set_security_error().
00093 { 00094 std::string name, value, pkey_uri, password; 00095 if (OpenDDS::DCPS::DCPS_debug_level > 0) { 00096 ACE_DEBUG((LM_DEBUG, "(%P|%t) LocalAuthCredentialData::load: Number of Properties: %i\n", props.length())); 00097 } 00098 for (size_t i = 0; i < props.length(); ++i) { 00099 name = props[i].name; 00100 value = props[i].value; 00101 00102 if (OpenDDS::DCPS::DCPS_debug_level > 0) { 00103 ACE_DEBUG((LM_DEBUG, "(%P|%t) LocalAuthCredentialData::load: property %i: %C: %C\n", 00104 i, name.c_str(), value.c_str())); 00105 } 00106 00107 if (name == "dds.sec.auth.identity_ca") { 00108 ca_cert_.reset(new SSL::Certificate(value)); 00109 00110 } else if (name == "dds.sec.auth.private_key") { 00111 pkey_uri = value; 00112 00113 } else if (name == "dds.sec.auth.identity_certificate") { 00114 participant_cert_.reset(new SSL::Certificate(value)); 00115 00116 } else if (name == "dds.sec.auth.password") { 00117 password = value; 00118 00119 } 00120 } 00121 00122 if (pkey_uri != "") { 00123 participant_pkey_.reset(new SSL::PrivateKey(pkey_uri, password)); 00124 } 00125 00126 if (! ca_cert_) { 00127 set_security_error(ex, -1, 0, "LocalAuthCredentialData::load: failed to load CA certificate"); 00128 return false; 00129 00130 } else if (! participant_cert_) { 00131 set_security_error(ex, -1, 0, "LocalAuthCredentialData::load: failed to load participant certificate"); 00132 return false; 00133 00134 } else if (! participant_pkey_) { 00135 set_security_error(ex, -1, 0, "LocalAuthCredentialData::load: failed to load participant private-key"); 00136 return false; 00137 00138 } 00139 00140 return true; 00141 }
bool OpenDDS::Security::LocalAuthCredentialData::validate | ( | ) | const [inline] |
Definition at line 74 of file Authentication/LocalCredentialData.h.
References LM_WARNING.
00075 { 00076 if (!participant_cert_) { 00077 ACE_ERROR((LM_WARNING, 00078 "(%P|%t) LocalAuthCredentialData::validate(): WARNING: participant_cert_ is null," 00079 " some of the security properties might be missing!\n")); 00080 return false; 00081 } 00082 if (!ca_cert_) { 00083 ACE_ERROR((LM_WARNING, 00084 "(%P|%t) LocalAuthCredentialData::validate(): WARNING: ca_cert_ is null," 00085 " some of the security properties might be missing!\n")); 00086 return false; 00087 } 00088 return (X509_V_OK == participant_cert_->validate(*ca_cert_)); 00089 }
Definition at line 96 of file Authentication/LocalCredentialData.h.
Referenced by load_access_permissions().
Definition at line 93 of file Authentication/LocalCredentialData.h.
Referenced by load_credentials().
SSL::Certificate::unique_ptr OpenDDS::Security::LocalAuthCredentialData::participant_cert_ [private] |
Definition at line 94 of file Authentication/LocalCredentialData.h.
Referenced by load_credentials().
Definition at line 95 of file Authentication/LocalCredentialData.h.
Referenced by load_credentials().