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

Public Member Functions

 cache_dsign_algo_impl ()
 
 ~cache_dsign_algo_impl ()
 
int operator() (X509 *cert, std::string &dst)
 

Private Attributes

EVP_PKEYpkey_
 
RSA * rsa_
 
EC_KEY * ec_
 

Detailed Description

Definition at line 355 of file Certificate.cpp.

Constructor & Destructor Documentation

◆ cache_dsign_algo_impl()

OpenDDS::Security::SSL::cache_dsign_algo_impl::cache_dsign_algo_impl ( )
inline

◆ ~cache_dsign_algo_impl()

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

Definition at line 359 of file Certificate.cpp.

References pkey_.

360  {
361  EVP_PKEY_free(pkey_);
362  RSA_free(rsa_);
363  EC_KEY_free(ec_);
364  }

Member Function Documentation

◆ operator()()

int OpenDDS::Security::SSL::cache_dsign_algo_impl::operator() ( X509 cert,
std::string &  dst 
)
inline

Definition at line 373 of file Certificate.cpp.

References ACE_ERROR, LM_WARNING, OPENDDS_SSL_LOG_ERR, and pkey_.

374  {
375  if (!cert) {
376  ACE_ERROR((LM_WARNING,
377  "(%P|%t) SSL::Certificate::cache_dsign_algo: WARNING, failed to "
378  "get pubkey from X509 cert\n"));
379  return 1;
380  }
381 
382  pkey_ = X509_get_pubkey(cert);
383  if (!pkey_) {
384  OPENDDS_SSL_LOG_ERR("cache_dsign_algo_impl::operator(): x509_get_pubkey failed");
385  return 1;
386  }
387 
388 #ifndef OPENSSL_V_3_0
389  rsa_ = EVP_PKEY_get1_RSA(pkey_);
390  if (rsa_) {
391  dst = "RSASSA-PSS-SHA256";
392  return 0;
393  }
394 
395  ec_ = EVP_PKEY_get1_EC_KEY(pkey_);
396  if (ec_) {
397  dst = "ECDSA-SHA256";
398  return 0;
399  }
400 #else
401  const int ptype = EVP_PKEY_id (pkey_);
402  if (ptype == EVP_PKEY_RSA || ptype == EVP_PKEY_RSA_PSS) {
403  dst = "RSASSA-PSS-SHA256";
404  return 0;
405  } else if (ptype == EVP_PKEY_EC) {
406  dst = "ECDSA-SHA256";
407  return 0;
408  }
409 #endif
410 
411  ACE_ERROR((LM_WARNING,
412  "(%P|%t) SSL::Certificate::cache_dsign_algo: WARNING, only RSASSA-PSS-SHA256 or "
413  "ECDSA-SHA256 are currently supported signature/verification algorithms\n"));
414 
415  return 1;
416  }
#define ACE_ERROR(X)
#define OPENDDS_SSL_LOG_ERR(MSG)
Definition: Err.h:12

Member Data Documentation

◆ ec_

EC_KEY* OpenDDS::Security::SSL::cache_dsign_algo_impl::ec_
private

Definition at line 422 of file Certificate.cpp.

◆ pkey_

EVP_PKEY* OpenDDS::Security::SSL::cache_dsign_algo_impl::pkey_
private

Definition at line 419 of file Certificate.cpp.

◆ rsa_

RSA* OpenDDS::Security::SSL::cache_dsign_algo_impl::rsa_
private

Definition at line 421 of file Certificate.cpp.


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