Botan  1.11.15
Public Member Functions | List of all members
Botan::PK_Key_Agreement Class Reference

#include <pubkey.h>

Public Member Functions

SymmetricKey derive_key (size_t key_len, const byte in[], size_t in_len, const byte params[], size_t params_len) const
 
SymmetricKey derive_key (size_t key_len, const std::vector< byte > &in, const byte params[], size_t params_len) const
 
SymmetricKey derive_key (size_t key_len, const byte in[], size_t in_len, const std::string &params="") const
 
SymmetricKey derive_key (size_t key_len, const std::vector< byte > &in, const std::string &params="") const
 
 PK_Key_Agreement (const Private_Key &key, const std::string &kdf)
 

Detailed Description

Key used for key agreement

Definition at line 313 of file pubkey.h.

Constructor & Destructor Documentation

Botan::PK_Key_Agreement::PK_Key_Agreement ( const Private_Key key,
const std::string &  kdf 
)

Construct a PK Key Agreement.

Parameters
keythe key to use
kdfname of the KDF to use (or 'Raw' for no KDF)

Definition at line 327 of file pubkey.cpp.

References Botan::Public_Key::algo_name(), and Botan::get_kdf().

329  {
330  m_op.reset(get_pk_op<PK_Ops::Key_Agreement>(key, kdf_name));
331 
332  if(!m_op)
333  throw Lookup_Error("Key agreement with " + key.algo_name() + " not supported");
334 
335  m_kdf.reset(get_kdf(kdf_name));
336  }
KDF * get_kdf(const std::string &algo_spec)
Definition: kdf.cpp:14

Member Function Documentation

SymmetricKey Botan::PK_Key_Agreement::derive_key ( size_t  key_len,
const byte  in[],
size_t  in_len,
const byte  params[],
size_t  params_len 
) const

Definition at line 338 of file pubkey.cpp.

Referenced by botan_pk_op_key_agreement(), and Botan::TLS::Client_Key_Exchange::Client_Key_Exchange().

341  {
342  secure_vector<byte> z = m_op->agree(in, in_len);
343 
344  if(!m_kdf)
345  return z;
346 
347  return m_kdf->derive_key(key_len, z, params, params_len);
348  }
SymmetricKey Botan::PK_Key_Agreement::derive_key ( size_t  key_len,
const std::vector< byte > &  in,
const byte  params[],
size_t  params_len 
) const
inline

Definition at line 339 of file pubkey.h.

343  {
344  return derive_key(key_len, &in[0], in.size(),
345  params, params_len);
346  }
SymmetricKey derive_key(size_t key_len, const byte in[], size_t in_len, const byte params[], size_t params_len) const
Definition: pubkey.cpp:338
SymmetricKey Botan::PK_Key_Agreement::derive_key ( size_t  key_len,
const byte  in[],
size_t  in_len,
const std::string &  params = "" 
) const
inline

Definition at line 355 of file pubkey.h.

358  {
359  return derive_key(key_len, in, in_len,
360  reinterpret_cast<const byte*>(params.data()),
361  params.length());
362  }
SymmetricKey derive_key(size_t key_len, const byte in[], size_t in_len, const byte params[], size_t params_len) const
Definition: pubkey.cpp:338
SymmetricKey Botan::PK_Key_Agreement::derive_key ( size_t  key_len,
const std::vector< byte > &  in,
const std::string &  params = "" 
) const
inline

Definition at line 370 of file pubkey.h.

373  {
374  return derive_key(key_len, &in[0], in.size(),
375  reinterpret_cast<const byte*>(params.data()),
376  params.length());
377  }
SymmetricKey derive_key(size_t key_len, const byte in[], size_t in_len, const byte params[], size_t params_len) const
Definition: pubkey.cpp:338
uint8_t byte
Definition: types.h:31

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