OpenDDS  Snapshot(2023/04/07-19:43)
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
OpenDDS::Security::SSL::DiffieHellman Class Reference

#include <DiffieHellman.h>

Collaboration diagram for OpenDDS::Security::SSL::DiffieHellman:
Collaboration graph
[legend]

Public Types

typedef DCPS::unique_ptr< DiffieHellmanunique_ptr
 

Public Member Functions

 DiffieHellman (DHAlgorithm *algorithm)
 
 ~DiffieHellman ()
 
void load ()
 
int pub_key (DDS::OctetSeq &dst)
 
int gen_shared_secret (const DDS::OctetSeq &pub_key)
 
const DDS::OctetSeqget_shared_secret ()
 
bool cmp_shared_secret (const DiffieHellman &other)
 
const char * kagree_algo () const
 

Static Public Member Functions

static DiffieHellmanfactory (const DDS::OctetSeq &kagree_algo)
 

Private Attributes

DHAlgorithm::unique_ptr algo_
 

Detailed Description

Definition at line 103 of file DiffieHellman.h.

Member Typedef Documentation

◆ unique_ptr

Definition at line 105 of file DiffieHellman.h.

Constructor & Destructor Documentation

◆ DiffieHellman()

OpenDDS::Security::SSL::DiffieHellman::DiffieHellman ( DHAlgorithm algorithm)
inlineexplicit

Definition at line 109 of file DiffieHellman.h.

109 : algo_(algorithm) {}

◆ ~DiffieHellman()

OpenDDS::Security::SSL::DiffieHellman::~DiffieHellman ( )
inline

Definition at line 111 of file DiffieHellman.h.

111 {}

Member Function Documentation

◆ cmp_shared_secret()

bool OpenDDS::Security::SSL::DiffieHellman::cmp_shared_secret ( const DiffieHellman other)
inline

Definition at line 136 of file DiffieHellman.h.

References algo_.

137  {
138  return algo_->cmp_shared_secret(*other.algo_);
139  }

◆ factory()

DiffieHellman * OpenDDS::Security::SSL::DiffieHellman::factory ( const DDS::OctetSeq kagree_algo)
static

Definition at line 709 of file DiffieHellman.cpp.

References ACE_ERROR, ACE_TEXT(), OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME_STR, OpenDDS::Security::SSL::ECDH_PRIME_256_V1_CEUM_STR, LM_ERROR, and OPENDDS_END_VERSIONED_NAMESPACE_DECL.

Referenced by OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_reply().

710 {
712  return new DiffieHellman(new DH_2048_MODP_256_PRIME);
713 
714  } else if (0 == compare(kagree_algo, ECDH_PRIME_256_V1_CEUM_STR, sizeof (ECDH_PRIME_256_V1_CEUM_STR))) {
715  return new DiffieHellman(new ECDH_PRIME_256_V1_CEUM);
716 
717  } else {
718  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) SSL::DiffieHellman::factory: ERROR, unknown kagree_algo\n")));
719  return 0;
720  }
721 }
#define ACE_ERROR(X)
DiffieHellman(DHAlgorithm *algorithm)
ACE_TEXT("TCP_Factory")
const char ECDH_PRIME_256_V1_CEUM_STR[]
Definition: DiffieHellman.h:23
const char DH_2048_MODP_256_PRIME_STR[]
Definition: DiffieHellman.h:22

◆ gen_shared_secret()

int OpenDDS::Security::SSL::DiffieHellman::gen_shared_secret ( const DDS::OctetSeq pub_key)
inline
Returns
int 0 on success; 1 on failure.

Definition at line 126 of file DiffieHellman.h.

127  {
128  return algo_->gen_shared_secret(pub_key);
129  }

◆ get_shared_secret()

const DDS::OctetSeq& OpenDDS::Security::SSL::DiffieHellman::get_shared_secret ( )
inline

Definition at line 131 of file DiffieHellman.h.

132  {
133  return algo_->get_shared_secret();
134  }

◆ kagree_algo()

const char* OpenDDS::Security::SSL::DiffieHellman::kagree_algo ( ) const
inline

Definition at line 141 of file DiffieHellman.h.

141 { return algo_->kagree_algo(); }

◆ load()

void OpenDDS::Security::SSL::DiffieHellman::load ( )
inline

Definition at line 113 of file DiffieHellman.h.

114  {
115  if (algo_) algo_->init();
116  }

◆ pub_key()

int OpenDDS::Security::SSL::DiffieHellman::pub_key ( DDS::OctetSeq dst)
inline
Returns
int 0 on success; 1 on failure.

Definition at line 121 of file DiffieHellman.h.

121 { return algo_->pub_key(dst); }

Member Data Documentation

◆ algo_

DHAlgorithm::unique_ptr OpenDDS::Security::SSL::DiffieHellman::algo_
private

Definition at line 144 of file DiffieHellman.h.

Referenced by cmp_shared_secret().


The documentation for this class was generated from the following files: