Botan 2.19.5 Crypto and TLS for C&

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

`#include <pubkey.h>`

## Public Member Functions
template<typename Alloc1 , typename Alloc2 >
secure_vector< uint8_t > | decrypt (const std::vector< uint8_t, Alloc1 > &encap_key, size_t desired_shared_key_len, const std::vector< uint8_t, Alloc2 > &salt)
secure_vector< uint8_t > | decrypt (const uint8_t encap_key[], size_t encap_key_len, size_t desired_shared_key_len)
secure_vector< uint8_t > | decrypt (const uint8_t encap_key[], size_t encap_key_len, size_t desired_shared_key_len, const uint8_t salt[], size_t salt_len)
PK_KEM_Decryptor & | operator= (const PK_KEM_Decryptor &)=delete
| PK_KEM_Decryptor (const PK_KEM_Decryptor &)=delete
| PK_KEM_Decryptor (const Private_Key &key, RandomNumberGenerator &rng, const std::string &kem_param="", const std::string &provider="")
| ~PK_KEM_Decryptor ()

## Detailed Description

Public Key Key Encapsulation Mechanism Decryption.

Definition at line 718 of file pubkey.h.

## Constructor & Destructor Documentation

## ◆ PK_KEM_Decryptor() [1/2]

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

Construct an instance.

Parameters

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

Definition at line 165 of file pubkey.cpp.

169 {
170 m_op = key.create_kem_decryption_op(rng, param, provider);
171 if(!m_op)
172 throw Invalid_Argument("Key type " + key.algo_name() + " does not support KEM decryption");
173 }

References Botan::Public_Key::algo_name(), and Botan::Private_Key::create_kem_decryption_op().

## ◆ ~PK_KEM_Decryptor()

Botan::PK_KEM_Decryptor::~PK_KEM_Decryptor | ( |  | ) |

Definition at line 175 of file pubkey.cpp.

175{ /* for unique_ptr */ }

## ◆ PK_KEM_Decryptor() [2/2]

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

## Member Function Documentation

## ◆ decrypt() [1/3]

template<typename Alloc1 , typename Alloc2 >

secure_vector< uint8_t > Botan::PK_KEM_Decryptor::decrypt | ( | const std::vector< uint8_t, Alloc1 > & | encap_key,
|  | size_t | desired_shared_key_len,
|  | const std::vector< uint8_t, Alloc2 > & | salt
| ) |  |
| inline

Decrypts the shared key for data encryption.

Parameters

  encap_key | the encapsulated key
  desired_shared_key_len | desired size of the shared key in bytes
  salt | a salt value used in the KDF

Returns
  the shared data encryption key

Definition at line 785 of file pubkey.h.

788 {
789 return this->decrypt(encap_key.data(), encap_key.size(),
790 desired_shared_key_len,
791 salt.data(), salt.size());
792 }
Botan::PK_KEM_Decryptor::decrypt
secure_vector< uint8_t > decrypt(const uint8_t encap_key[], size_t encap_key_len, size_t desired_shared_key_len, const uint8_t salt[], size_t salt_len)
Definition: pubkey.cpp:177

References Botan::CryptoBox::decrypt().

## ◆ decrypt() [2/3]

secure_vector< uint8_t > Botan::PK_KEM_Decryptor::decrypt | ( | const uint8_t | encap_key[],
|  | size_t | encap_key_len,
|  | size_t | desired_shared_key_len
| ) |  |
| inline

Decrypts the shared key for data encryption.

Parameters

  encap_key | the encapsulated key
  encap_key_len | size of the encapsulated key in bytes
  desired_shared_key_len | desired size of the shared key in bytes

Returns
  the shared data encryption key

Definition at line 768 of file pubkey.h.

771 {
772 return this->decrypt(encap_key, encap_key_len,
773 desired_shared_key_len,
774 nullptr, 0);
775 }

References Botan::CryptoBox::decrypt().

## ◆ decrypt() [3/3]

secure_vector< uint8_t > Botan::PK_KEM_Decryptor::decrypt | ( | const uint8_t | encap_key[],
|  | size_t | encap_key_len,
|  | size_t | desired_shared_key_len,
|  | const uint8_t | salt[],
|  | size_t | salt_len
| ) |  |

Decrypts the shared key for data encryption.

Parameters

  encap_key | the encapsulated key
  encap_key_len | size of the encapsulated key in bytes
  desired_shared_key_len | desired size of the shared key in bytes
  salt | a salt value used in the KDF
  salt_len | size of the salt value in bytes

Returns
  the shared data encryption key

Definition at line 177 of file pubkey.cpp.

182 {
183 return m_op->kem_decrypt(encap_key, encap_key_len,
184 desired_shared_key_len,
185 salt, salt_len);
186 }
salt_len
size_t salt_len
Definition: x509_obj.cpp:25

References salt_len.

Referenced by Botan::mceies_decrypt().

## ◆ operator=()

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

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

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