OpenDDS  Snapshot(2023/04/28-20:55)
Public Member Functions | Private Attributes | List of all members
OpenDDS::Security::SSL::dh_constructor Class Reference

Public Member Functions

 dh_constructor ()
 
 ~dh_constructor ()
 
EVP_PKEYget_key ()
 

Private Attributes

EVP_PKEYparams
 
EVP_PKEY_CTX * paramgen_ctx
 
EVP_PKEY_CTX * keygen_ctx
 

Detailed Description

Definition at line 80 of file DiffieHellman.cpp.

Constructor & Destructor Documentation

◆ dh_constructor()

OpenDDS::Security::SSL::dh_constructor::dh_constructor ( )
inline

◆ ~dh_constructor()

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

Definition at line 85 of file DiffieHellman.cpp.

86  {
87  EVP_PKEY_free(params);
88  EVP_PKEY_CTX_free(paramgen_ctx);
89  EVP_PKEY_CTX_free(keygen_ctx);
90  }

Member Function Documentation

◆ get_key()

EVP_PKEY* OpenDDS::Security::SSL::dh_constructor::get_key ( )
inline

Definition at line 92 of file DiffieHellman.cpp.

References OPENDDS_SSL_LOG_ERR.

Referenced by OpenDDS::Security::SSL::DH_2048_MODP_256_PRIME::init().

93  {
94  EVP_PKEY* result = 0;
95 
96 #if OPENSSL_VERSION_NUMBER < 0x10002000L
97  OPENDDS_SSL_LOG_ERR("RFC 5114 2.3 - 2048-bit MODP Group with 256-bit Prime Order Subgroup - not provided by this OpenSSL library");
98 #else
99 
100  if (0 == (params = EVP_PKEY_new())) {
101  OPENDDS_SSL_LOG_ERR("EVP_PKEY_new failed");
102  return 0;
103  }
104 
105  if (0 == (paramgen_ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_DHX, 0))) {
106  OPENDDS_SSL_LOG_ERR("EVP_PKEY_CTX_new_id");
107  return 0;
108  }
109 
110  if (1 != EVP_PKEY_paramgen_init(paramgen_ctx)) {
111  OPENDDS_SSL_LOG_ERR("EVP_PKEY_paramgen_init failed");
112  return 0;
113  }
114 
115  if (1 != EVP_PKEY_CTX_set_dh_rfc5114(paramgen_ctx, 3)) {
116  OPENDDS_SSL_LOG_ERR("EVP_PKEY_CTX_set_dh_rfc5114 failed");
117  return 0;
118  }
119 
120  if ((1 != EVP_PKEY_paramgen(paramgen_ctx, &params)) || params == 0) {
121  OPENDDS_SSL_LOG_ERR("EVP_PKEY_paramgen failed");
122  return 0;
123  }
124 
125  if (0 == (keygen_ctx = EVP_PKEY_CTX_new(params, 0))) {
126  OPENDDS_SSL_LOG_ERR("EVP_PKEY_CTX_new failed");
127  return 0;
128  }
129 
130  if (1 != EVP_PKEY_keygen_init(keygen_ctx)) {
131  OPENDDS_SSL_LOG_ERR("EVP_PKEY_keygen_init failed");
132  return 0;
133  }
134 
135  if (1 != EVP_PKEY_keygen(keygen_ctx, &result)) {
136  OPENDDS_SSL_LOG_ERR("EVP_PKEY_keygen failed");
137  return 0;
138  }
139 
140 #endif
141  return result;
142  }
struct evp_pkey_st EVP_PKEY
#define OPENDDS_SSL_LOG_ERR(MSG)
Definition: Err.h:12

Member Data Documentation

◆ keygen_ctx

EVP_PKEY_CTX* OpenDDS::Security::SSL::dh_constructor::keygen_ctx
private

Definition at line 147 of file DiffieHellman.cpp.

◆ paramgen_ctx

EVP_PKEY_CTX* OpenDDS::Security::SSL::dh_constructor::paramgen_ctx
private

Definition at line 146 of file DiffieHellman.cpp.

◆ params

EVP_PKEY* OpenDDS::Security::SSL::dh_constructor::params
private

Definition at line 145 of file DiffieHellman.cpp.


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