Botan  2.6.0
Crypto and TLS for C++11
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_Encryptoroperator= (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 595 of file pubkey.h.

Constructor & Destructor Documentation

◆ PK_KEM_Encryptor() [1/2]

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
keythe key to use inside the encryptor
rngthe RNG to use
kem_paramadditional KEM parameters
providerthe provider to use

Definition at line 128 of file pubkey.cpp.

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

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

◆ ~PK_KEM_Encryptor()

Botan::PK_KEM_Encryptor::~PK_KEM_Encryptor ( )

Definition at line 138 of file pubkey.cpp.

138 { /* for unique_ptr */ }

◆ PK_KEM_Encryptor() [2/2]

Botan::PK_KEM_Encryptor::PK_KEM_Encryptor ( const PK_KEM_Encryptor )
delete

Member Function Documentation

◆ encrypt() [1/3]

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_keythe generated encapsulated key
out_shared_keythe generated shared key
desired_shared_key_lendesired size of the shared key in bytes
rngthe RNG to use
salta salt value used in the KDF
salt_lensize of the salt value in bytes

Definition at line 140 of file pubkey.cpp.

References salt_len.

Referenced by Botan::mceies_encrypt().

146  {
147  m_op->kem_encrypt(out_encapsulated_key,
148  out_shared_key,
149  desired_shared_key_len,
150  rng,
151  salt,
152  salt_len);
153  }
size_t salt_len
Definition: x509_obj.cpp:26

◆ encrypt() [2/3]

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_keythe generated encapsulated key
out_shared_keythe generated shared key
desired_shared_key_lendesired size of the shared key in bytes
rngthe RNG to use
salta salt value used in the KDF

Definition at line 648 of file pubkey.h.

References Botan::CryptoBox::encrypt().

653  {
654  this->encrypt(out_encapsulated_key,
655  out_shared_key,
656  desired_shared_key_len,
657  rng,
658  salt.data(), salt.size());
659  }
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:140

◆ encrypt() [3/3]

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_keythe generated encapsulated key
out_shared_keythe generated shared key
desired_shared_key_lendesired size of the shared key in bytes
rngthe RNG to use

Definition at line 669 of file pubkey.h.

References Botan::CryptoBox::encrypt().

673  {
674  this->encrypt(out_encapsulated_key,
675  out_shared_key,
676  desired_shared_key_len,
677  rng,
678  nullptr,
679  0);
680  }
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:140

◆ operator=()

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

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