#include <DiffieHellman.h>
Public Types | |
typedef DCPS::unique_ptr < DHAlgorithm > | unique_ptr |
Public Member Functions | |
DHAlgorithm () | |
virtual | ~DHAlgorithm () |
virtual int | init ()=0 |
virtual int | pub_key (DDS::OctetSeq &dst)=0 |
virtual int | gen_shared_secret (const DDS::OctetSeq &pub_key) |
virtual const DDS::OctetSeq & | get_shared_secret () const |
virtual bool | cmp_shared_secret (const DHAlgorithm &other) const |
virtual const char * | kagree_algo () const =0 |
Protected Member Functions | |
virtual int | compute_shared_secret (const DDS::OctetSeq &pub_key)=0 |
int | hash_shared_secret () |
Protected Attributes | |
EVP_PKEY * | k_ |
DDS::OctetSeq | shared_secret_ |
Definition at line 18 of file DiffieHellman.h.
Definition at line 21 of file DiffieHellman.h.
OpenDDS::Security::SSL::DHAlgorithm::DHAlgorithm | ( | ) | [inline] |
Definition at line 23 of file DiffieHellman.h.
00023 : k_(NULL) {}
OpenDDS::Security::SSL::DHAlgorithm::~DHAlgorithm | ( | ) | [virtual] |
bool OpenDDS::Security::SSL::DHAlgorithm::cmp_shared_secret | ( | const DHAlgorithm & | other | ) | const [virtual] |
Definition at line 37 of file DiffieHellman.cpp.
References get_shared_secret(), and shared_secret_.
00038 { 00039 if (shared_secret_.length() != other.get_shared_secret().length()) { 00040 return false; 00041 } 00042 return (0 == std::memcmp(shared_secret_.get_buffer(), 00043 other.get_shared_secret().get_buffer(), 00044 shared_secret_.length())); 00045 }
virtual int OpenDDS::Security::SSL::DHAlgorithm::compute_shared_secret | ( | const DDS::OctetSeq & | pub_key | ) | [protected, pure virtual] |
virtual int OpenDDS::Security::SSL::DHAlgorithm::gen_shared_secret | ( | const DDS::OctetSeq & | pub_key | ) | [inline, virtual] |
Definition at line 29 of file DiffieHellman.h.
00030 { 00031 int err = compute_shared_secret(pub_key) || hash_shared_secret(); 00032 return err; 00033 }
virtual const DDS::OctetSeq& OpenDDS::Security::SSL::DHAlgorithm::get_shared_secret | ( | ) | const [inline, virtual] |
Definition at line 34 of file DiffieHellman.h.
Referenced by cmp_shared_secret().
00035 { 00036 return shared_secret_; 00037 }
int OpenDDS::Security::SSL::DHAlgorithm::hash_shared_secret | ( | ) | [protected] |
Definition at line 47 of file DiffieHellman.cpp.
References OpenDDS::Security::SSL::hash(), and shared_secret_.
00048 { 00049 DDS::OctetSeq tmp = shared_secret_; 00050 std::vector<const DDS::OctetSeq*> hash_data; 00051 hash_data.push_back(&tmp); 00052 return SSL::hash(hash_data, shared_secret_); 00053 }
virtual int OpenDDS::Security::SSL::DHAlgorithm::init | ( | ) | [pure virtual] |
virtual const char* OpenDDS::Security::SSL::DHAlgorithm::kagree_algo | ( | ) | const [pure virtual] |
virtual int OpenDDS::Security::SSL::DHAlgorithm::pub_key | ( | DDS::OctetSeq & | dst | ) | [pure virtual] |
EVP_PKEY* OpenDDS::Security::SSL::DHAlgorithm::k_ [protected] |
Definition at line 45 of file DiffieHellman.h.
Referenced by OpenDDS::Security::SSL::ECDH_PRIME_256_V1_CEUM::compute_shared_secret(), OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::compute_shared_secret(), OpenDDS::Security::SSL::ECDH_PRIME_256_V1_CEUM::init(), OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::init(), OpenDDS::Security::SSL::ECDH_PRIME_256_V1_CEUM::pub_key(), OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::pub_key(), and ~DHAlgorithm().
Definition at line 46 of file DiffieHellman.h.
Referenced by cmp_shared_secret(), OpenDDS::Security::SSL::ECDH_PRIME_256_V1_CEUM::compute_shared_secret(), OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::compute_shared_secret(), and hash_shared_secret().