OpenDDS::Security::SSL::dh_shared_secret Class Reference

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

List of all members.

Public Member Functions

 dh_shared_secret (EVP_PKEY *pkey)
 ~dh_shared_secret ()
int operator() (const DDS::OctetSeq &pub_key, DDS::OctetSeq &dst)

Private Attributes

DH_Handle keypair
BIGNUM * pubkey

Detailed Description

Definition at line 156 of file DiffieHellman.cpp.


Constructor & Destructor Documentation

OpenDDS::Security::SSL::dh_shared_secret::dh_shared_secret ( EVP_PKEY pkey  )  [inline, explicit]

Definition at line 159 of file DiffieHellman.cpp.

References keypair, and OPENDDS_SSL_LOG_ERR.

00160       : keypair(pkey), pubkey(NULL)
00161     {
00162       if (!keypair) {
00163         OPENDDS_SSL_LOG_ERR("EVP_PKEY_get0_DH failed");
00164       }
00165     }

OpenDDS::Security::SSL::dh_shared_secret::~dh_shared_secret (  )  [inline]

Definition at line 167 of file DiffieHellman.cpp.

References pubkey.

00167 { BN_free(pubkey); }


Member Function Documentation

int OpenDDS::Security::SSL::dh_shared_secret::operator() ( const DDS::OctetSeq pub_key,
DDS::OctetSeq dst 
) [inline]

Definition at line 169 of file DiffieHellman.cpp.

References keypair, len, OPENDDS_SSL_LOG_ERR, and pubkey.

00170     {
00171       if (!keypair) return 1;
00172 
00173       if (NULL == (pubkey = BN_bin2bn(pub_key.get_buffer(), pub_key.length(),
00174                                       NULL))) {
00175         OPENDDS_SSL_LOG_ERR("BN_bin2bn failed");
00176         return 1;
00177       }
00178 
00179       int len = DH_size(keypair);
00180       dst.length(len);
00181 
00182       len = DH_compute_key(dst.get_buffer(), pubkey, keypair);
00183       if (len < 0) {
00184         OPENDDS_SSL_LOG_ERR("DH_compute_key failed");
00185         dst.length(0u);
00186         return 1;
00187       }
00188 
00189       dst.length(len);
00190       return 0;
00191     }


Member Data Documentation

Definition at line 194 of file DiffieHellman.cpp.

Referenced by dh_shared_secret(), and operator()().

Definition at line 195 of file DiffieHellman.cpp.

Referenced by operator()(), and ~dh_shared_secret().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1