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

Public Member Functions

 ecdh_constructor ()
 
 ~ecdh_constructor ()
 
EVP_PKEYget_key ()
 

Private Attributes

EVP_PKEYparams
 
EVP_PKEY_CTX * paramgen_ctx
 
EVP_PKEY_CTX * keygen_ctx
 

Detailed Description

Definition at line 364 of file DiffieHellman.cpp.

Constructor & Destructor Documentation

◆ ecdh_constructor()

OpenDDS::Security::SSL::ecdh_constructor::ecdh_constructor ( )
inline

◆ ~ecdh_constructor()

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

Definition at line 369 of file DiffieHellman.cpp.

370  {
371  EVP_PKEY_free(params);
372  EVP_PKEY_CTX_free(paramgen_ctx);
373  EVP_PKEY_CTX_free(keygen_ctx);
374  }

Member Function Documentation

◆ get_key()

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

Definition at line 376 of file DiffieHellman.cpp.

References OPENDDS_SSL_LOG_ERR.

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

377  {
378  EVP_PKEY* result = 0;
379 
380  if (0 == (params = EVP_PKEY_new())) {
381  OPENDDS_SSL_LOG_ERR("EVP_PKEY_new failed");
382  return 0;
383  }
384 
385  if (0 == (paramgen_ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, 0))) {
386  OPENDDS_SSL_LOG_ERR("EVP_PKEY_CTX_new_id");
387  return 0;
388  }
389 
390  if (1 != EVP_PKEY_paramgen_init(paramgen_ctx)) {
391  OPENDDS_SSL_LOG_ERR("EVP_PKEY_paramgen_init failed");
392  return 0;
393  }
394 
395  if (1 != EVP_PKEY_CTX_set_ec_paramgen_curve_nid(paramgen_ctx, NID_X9_62_prime256v1)) {
396  OPENDDS_SSL_LOG_ERR("EVP_PKEY_CTX_set_ec_paramgen_curve_ni = failed");
397  return 0;
398  }
399 
400  if (1 != EVP_PKEY_paramgen(paramgen_ctx, &params) || params == 0) {
401  OPENDDS_SSL_LOG_ERR("EVP_PKEY_paramgen failed");
402  return 0;
403  }
404 
405  if (0 == (keygen_ctx = EVP_PKEY_CTX_new(params, 0))) {
406  OPENDDS_SSL_LOG_ERR("EVP_PKEY_CTX_new failed");
407  return 0;
408  }
409 
410  if (1 != EVP_PKEY_keygen_init(keygen_ctx)) {
411  OPENDDS_SSL_LOG_ERR("EVP_PKEY_keygen_init failed");
412  return 0;
413  }
414 
415  if (1 != EVP_PKEY_keygen(keygen_ctx, &result)) {
416  OPENDDS_SSL_LOG_ERR("EVP_PKEY_keygen failed");
417  return 0;
418  }
419 
420  return result;
421  }
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::ecdh_constructor::keygen_ctx
private

Definition at line 426 of file DiffieHellman.cpp.

◆ paramgen_ctx

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

Definition at line 425 of file DiffieHellman.cpp.

◆ params

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

Definition at line 424 of file DiffieHellman.cpp.


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