#include <DiffieHellman.h>
Public Member Functions | |
DH_2048_MODP_256_PRIME () | |
~DH_2048_MODP_256_PRIME () | |
int | init () |
int | pub_key (DDS::OctetSeq &dst) |
int | compute_shared_secret (const DDS::OctetSeq &pub_key) |
const char * | kagree_algo () const |
Definition at line 49 of file DiffieHellman.h.
OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::DH_2048_MODP_256_PRIME | ( | ) |
Definition at line 55 of file DiffieHellman.cpp.
References init().
00055 { init(); }
OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::~DH_2048_MODP_256_PRIME | ( | ) |
Definition at line 57 of file DiffieHellman.cpp.
int OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::compute_shared_secret | ( | const DDS::OctetSeq & | pub_key | ) | [virtual] |
Implements OpenDDS::Security::SSL::DHAlgorithm.
Definition at line 198 of file DiffieHellman.cpp.
References OpenDDS::Security::SSL::DHAlgorithm::k_, and OpenDDS::Security::SSL::DHAlgorithm::shared_secret_.
00200 { 00201 dh_shared_secret secret(k_); 00202 return secret(pub_key, shared_secret_); 00203 }
int OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::init | ( | void | ) | [virtual] |
Implements OpenDDS::Security::SSL::DHAlgorithm.
Definition at line 115 of file DiffieHellman.cpp.
References OpenDDS::Security::SSL::DHAlgorithm::k_.
Referenced by DH_2048_MODP_256_PRIME().
00116 { 00117 if (k_) return 0; 00118 00119 dh_constructor dh; 00120 k_ = dh(); 00121 00122 if (k_) { 00123 return 0; 00124 00125 } else { 00126 return 1; 00127 } 00128 }
const char* OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::kagree_algo | ( | ) | const [inline, virtual] |
Implements OpenDDS::Security::SSL::DHAlgorithm.
Definition at line 70 of file DiffieHellman.h.
int OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::pub_key | ( | DDS::OctetSeq & | dst | ) | [virtual] |
Implements OpenDDS::Security::SSL::DHAlgorithm.
Definition at line 130 of file DiffieHellman.cpp.
References DH_get0_key(), OpenDDS::Security::SSL::DHAlgorithm::k_, and OPENDDS_SSL_LOG_ERR.
00131 { 00132 int result = 1; 00133 00134 if (k_) { 00135 DH_Handle dh(k_); 00136 if (dh) { 00137 const BIGNUM *pubkey, 00138 *privkey; /* Ignore the privkey but pass it in anyway since nothing 00139 documents what happens when a NULL gets passed in */ 00140 pubkey = privkey = NULL; 00141 DH_get0_key(dh, &pubkey, &privkey); 00142 if (pubkey) { 00143 dst.length(DH_size(dh)); 00144 if (0 < BN_bn2bin(pubkey, dst.get_buffer())) { 00145 result = 0; 00146 00147 } else { 00148 OPENDDS_SSL_LOG_ERR("BN_bn2bin failed"); 00149 } 00150 } 00151 } 00152 } 00153 return result; 00154 }