Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::PK_KEM_Encryptor Class Referencefinal

`#include <pubkey.h>`

## Public Member Functions
void | encrypt (secure_vector< uint8_t > &out_encapsulated_key, secure_vector< uint8_t > &out_shared_key, size_t desired_shared_key_len, Botan::RandomNumberGenerator &rng, const uint8_t salt[], size_t salt_len)
template<typename Alloc >
void | encrypt (secure_vector< uint8_t > &out_encapsulated_key, secure_vector< uint8_t > &out_shared_key, size_t desired_shared_key_len, Botan::RandomNumberGenerator &rng, const std::vector< uint8_t, Alloc > &salt)
void | encrypt (secure_vector< uint8_t > &out_encapsulated_key, secure_vector< uint8_t > &out_shared_key, size_t desired_shared_key_len, Botan::RandomNumberGenerator &rng)
PK_KEM_Encryptor & | operator= (const PK_KEM_Encryptor &)=delete
| PK_KEM_Encryptor (const Public_Key &key, RandomNumberGenerator &rng, const std::string &kem_param="", const std::string &provider="")
| PK_KEM_Encryptor (const PK_KEM_Encryptor &)=delete
| ~PK_KEM_Encryptor ()

## Detailed Description

Public Key Key Encapsulation Mechanism Encryption.

Definition at line 597 of file pubkey.h.

## Constructor & Destructor Documentation

Botan::PK_KEM_Encryptor::PK_KEM_Encryptor | ( | const Public_Key & | key,
|  | RandomNumberGenerator & | rng,
|  | const std::string & | kem_param = `""`,
|  | const std::string & | provider = `""`
| ) |  |

Construct an instance.

Parameters

  key | the key to use inside the encryptor
  rng | the RNG to use
  kem_param | additional KEM parameters
  provider | the provider to use

Definition at line 127 of file pubkey.cpp.

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

131 {
132 m_op = key.create_kem_encryption_op(rng, param, provider);
133 if(!m_op)
134 throw Invalid_Argument("Key type " + key.algo_name() + " does not support KEM encryption");
135 }

Botan::PK_KEM_Encryptor::~PK_KEM_Encryptor | ( |  | ) |

Definition at line 137 of file pubkey.cpp.

137 { /* for unique_ptr */ }

Botan::PK_KEM_Encryptor::PK_KEM_Encryptor | ( | const PK_KEM_Encryptor & |  | ) |
| delete

## Member Function Documentation

void Botan::PK_KEM_Encryptor::encrypt | ( | secure_vector< uint8_t > & | out_encapsulated_key,
|  | secure_vector< uint8_t > & | out_shared_key,
|  | size_t | desired_shared_key_len,
|  | Botan::RandomNumberGenerator & | rng,
|  | const uint8_t | salt[],
|  | size_t | salt_len
| ) |  |

Generate a shared key for data encryption.

Parameters

  out_encapsulated_key | the generated encapsulated key
  out_shared_key | the generated shared key
  desired_shared_key_len | desired size of the shared key in bytes
  rng | the RNG to use
  salt | a salt value used in the KDF
  salt_len | size of the salt value in bytes

Definition at line 139 of file pubkey.cpp.

Referenced by Botan::mceies_encrypt().

145 {
146 m_op->kem_encrypt(out_encapsulated_key,
147 out_shared_key,
148 desired_shared_key_len,
149 rng,
150 salt,
151 salt_len);
152 }
template<typename Alloc >

void Botan::PK_KEM_Encryptor::encrypt | ( | secure_vector< uint8_t > & | out_encapsulated_key,
|  | secure_vector< uint8_t > & | out_shared_key,
|  | size_t | desired_shared_key_len,
|  | Botan::RandomNumberGenerator & | rng,
|  | const std::vector< uint8_t, Alloc > & | salt
| ) |  |
| inline

Generate a shared key for data encryption.

Parameters

  out_encapsulated_key | the generated encapsulated key
  out_shared_key | the generated shared key
  desired_shared_key_len | desired size of the shared key in bytes
  rng | the RNG to use
  salt | a salt value used in the KDF

Definition at line 650 of file pubkey.h.

References Botan::CryptoBox::encrypt().

655 {
656 this->encrypt(out_encapsulated_key,
657 out_shared_key,
658 desired_shared_key_len,
659 rng,
660 salt.data(), salt.size());
661 }
Botan::PK_KEM_Encryptor::encrypt
void encrypt(secure_vector< uint8_t > &out_encapsulated_key, secure_vector< uint8_t > &out_shared_key, size_t desired_shared_key_len, Botan::RandomNumberGenerator &rng, const uint8_t salt[], size_t salt_len)
Definition: pubkey.cpp:139

void Botan::PK_KEM_Encryptor::encrypt | ( | secure_vector< uint8_t > & | out_encapsulated_key,
|  | secure_vector< uint8_t > & | out_shared_key,
|  | size_t | desired_shared_key_len,
|  | Botan::RandomNumberGenerator & | rng
| ) |  |
| inline

Generate a shared key for data encryption.

Parameters

  out_encapsulated_key | the generated encapsulated key
  out_shared_key | the generated shared key
  desired_shared_key_len | desired size of the shared key in bytes
  rng | the RNG to use

Definition at line 671 of file pubkey.h.

References Botan::CryptoBox::encrypt().

675 {
676 this->encrypt(out_encapsulated_key,
677 out_shared_key,
678 desired_shared_key_len,
679 rng,
680 nullptr,
681 0);
682 }
Botan::PK_KEM_Encryptor::encrypt
void encrypt(secure_vector< uint8_t > &out_encapsulated_key, secure_vector< uint8_t > &out_shared_key, size_t desired_shared_key_len, Botan::RandomNumberGenerator &rng, const uint8_t salt[], size_t salt_len)
Definition: pubkey.cpp:139

PK_KEM_Encryptor& Botan::PK_KEM_Encryptor::operator= | ( | const PK_KEM_Encryptor & |  | ) |
| delete

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

- src/lib/pubkey/pubkey.h
- src/lib/pubkey/pubkey.cpp