Botan 3.0.0-alpha0
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_Decryptoroperator= (const PK_KEM_Decryptor &)=delete
 
PK_KEM_Decryptoroperator= (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 (PK_KEM_Decryptor &&)=delete
 
 ~PK_KEM_Decryptor ()
 

Detailed Description

Public Key Key Encapsulation Mechanism Decryption.

Definition at line 660 of file pubkey.h.

Constructor & Destructor Documentation

◆ PK_KEM_Decryptor() [1/3]

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
keythe key to use inside the decryptor
rngthe RNG to use
kem_paramadditional KEM parameters
providerthe 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 ( )
default

◆ PK_KEM_Decryptor() [2/3]

Botan::PK_KEM_Decryptor::PK_KEM_Decryptor ( const PK_KEM_Decryptor )
delete

◆ PK_KEM_Decryptor() [3/3]

Botan::PK_KEM_Decryptor::PK_KEM_Decryptor ( 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_keythe encapsulated key
desired_shared_key_lendesired size of the shared key in bytes
salta salt value used in the KDF
Returns
the shared data encryption key

Definition at line 720 of file pubkey.h.

723 {
724 return this->decrypt(encap_key.data(), encap_key.size(),
725 desired_shared_key_len,
726 salt.data(), salt.size());
727 }
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_keythe encapsulated key
encap_key_lensize of the encapsulated key in bytes
desired_shared_key_lendesired size of the shared key in bytes
Returns
the shared data encryption key

Definition at line 703 of file pubkey.h.

706 {
707 return this->decrypt(encap_key, encap_key_len,
708 desired_shared_key_len,
709 nullptr, 0);
710 }

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_keythe encapsulated key
encap_key_lensize of the encapsulated key in bytes
desired_shared_key_lendesired size of the shared key in bytes
salta salt value used in the KDF
salt_lensize 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 }
size_t salt_len
Definition: x509_obj.cpp:25

References salt_len.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

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