OpenDDS::Security::SSL::ecdh_shared_secret_from_octets Class Reference

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

List of all members.

Public Member Functions

 ecdh_shared_secret_from_octets (EVP_PKEY *pkey)
 ~ecdh_shared_secret_from_octets ()
int operator() (const DDS::OctetSeq &src, DDS::OctetSeq &dst)

Private Attributes

EC_Handle keypair
EC_POINT * pubkey
const EC_GROUP * group
BN_CTX * bignum_ctx

Detailed Description

Definition at line 365 of file DiffieHellman.cpp.


Constructor & Destructor Documentation

OpenDDS::Security::SSL::ecdh_shared_secret_from_octets::ecdh_shared_secret_from_octets ( EVP_PKEY pkey  )  [inline]

Definition at line 368 of file DiffieHellman.cpp.

References keypair, and OPENDDS_SSL_LOG_ERR.

00369       : keypair(pkey), pubkey(NULL), group(NULL), bignum_ctx(NULL)
00370     {
00371       if (!keypair) {
00372         OPENDDS_SSL_LOG_ERR("EVP_PKEY_get0_EC_KEY failed");
00373       }
00374     }

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

Definition at line 376 of file DiffieHellman.cpp.

References bignum_ctx, and pubkey.

00377     {
00378       EC_POINT_free(pubkey);
00379       BN_CTX_free(bignum_ctx);
00380     }


Member Function Documentation

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

Definition at line 382 of file DiffieHellman.cpp.

References bignum_ctx, group, keypair, len, OPENDDS_SSL_LOG_ERR, and pubkey.

00383     {
00384       if (!keypair) return 1;
00385 
00386       if (NULL == (bignum_ctx = BN_CTX_new())) {
00387         OPENDDS_SSL_LOG_ERR("BN_CTX_new failed");
00388         return 1;
00389       }
00390 
00391       if (NULL == (group = EC_KEY_get0_group(keypair))) {
00392         OPENDDS_SSL_LOG_ERR("EC_KEY_get0_group failed");
00393         return 1;
00394       }
00395 
00396       pubkey = EC_POINT_new(group);
00397       if (1 != EC_POINT_oct2point(group, pubkey, src.get_buffer(),
00398                                   src.length(), bignum_ctx)) {
00399         OPENDDS_SSL_LOG_ERR("EC_POINT_point2oct failed");
00400         return 1;
00401       }
00402 
00403       int numbits = EC_GROUP_get_degree(group);
00404       dst.length((numbits + 7) / 8);
00405 
00406       int len = ECDH_compute_key(dst.get_buffer(), dst.length(), pubkey,
00407                                  keypair, NULL);
00408 
00409       if (0 == len) {
00410         OPENDDS_SSL_LOG_ERR("ECDH_compute_key failed");
00411         return 1;
00412       }
00413 
00414       return 0;
00415     }


Member Data Documentation

Definition at line 421 of file DiffieHellman.cpp.

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

Definition at line 420 of file DiffieHellman.cpp.

Referenced by operator()().

Definition at line 418 of file DiffieHellman.cpp.

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

Definition at line 419 of file DiffieHellman.cpp.

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


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