Botan 3.6.1
Crypto and TLS for C&
|
#include <pubkey.h>
Public Member Functions | |
size_t | encapsulated_key_length () const |
KEM_Encapsulation | encrypt (RandomNumberGenerator &rng, size_t desired_shared_key_len=32, std::span< const uint8_t > salt={}) |
void | encrypt (secure_vector< uint8_t > &out_encapsulated_key, secure_vector< uint8_t > &out_shared_key, RandomNumberGenerator &rng, size_t desired_shared_key_len=32, std::span< const uint8_t > salt={}) |
void | encrypt (secure_vector< uint8_t > &out_encapsulated_key, secure_vector< uint8_t > &out_shared_key, size_t desired_shared_key_len, RandomNumberGenerator &rng, const uint8_t salt[], size_t salt_len) |
void | encrypt (secure_vector< uint8_t > &out_encapsulated_key, secure_vector< uint8_t > &out_shared_key, size_t desired_shared_key_len, RandomNumberGenerator &rng, std::span< const uint8_t > salt={}) |
void | encrypt (std::span< uint8_t > out_encapsulated_key, std::span< uint8_t > out_shared_key, RandomNumberGenerator &rng, size_t desired_shared_key_len=32, std::span< const uint8_t > salt={}) |
PK_KEM_Encryptor & | operator= (const PK_KEM_Encryptor &)=delete |
PK_KEM_Encryptor & | operator= (PK_KEM_Encryptor &&) noexcept |
PK_KEM_Encryptor (const PK_KEM_Encryptor &)=delete | |
PK_KEM_Encryptor (const Public_Key &key, RandomNumberGenerator &rng, std::string_view kem_param="", std::string_view provider="") | |
PK_KEM_Encryptor (const Public_Key &key, std::string_view kem_param="", std::string_view provider="") | |
PK_KEM_Encryptor (PK_KEM_Encryptor &&) noexcept | |
size_t | shared_key_length (size_t desired_shared_key_len) const |
~PK_KEM_Encryptor () | |
Botan::PK_KEM_Encryptor::PK_KEM_Encryptor | ( | const Public_Key & | key, |
std::string_view | kem_param = "", | ||
std::string_view | provider = "" ) |
Construct an instance.
key | the key to encrypt to |
kem_param | additional KEM parameters |
provider | the provider to use |
Definition at line 137 of file pubkey.cpp.
References Botan::Asymmetric_Key::algo_name(), Botan::Public_Key::create_kem_encryption_op(), and Botan::fmt().
|
inline |
Construct an instance.
key | the key to encrypt to |
rng | the RNG to use |
kem_param | additional KEM parameters |
provider | the provider to use |
Definition at line 602 of file pubkey.h.
References BOTAN_UNUSED.
|
default |
|
delete |
|
defaultnoexcept |
size_t Botan::PK_KEM_Encryptor::encapsulated_key_length | ( | ) | const |
Return the length in bytes of encapsulated keys returned by this KEM
Definition at line 153 of file pubkey.cpp.
Referenced by encrypt().
|
inline |
Generate a shared key for data encryption.
rng | the RNG to use |
desired_shared_key_len | desired size of the shared key in bytes for the KDF (ignored if no KDF is used) |
salt | a salt value used in the KDF (ignored if no KDF is used) |
Definition at line 650 of file pubkey.h.
Referenced by Botan::Kyber_PrivateKey::check_key(), and Botan::TLS::Callbacks::tls_kem_encapsulate().
|
inline |
Generate a shared key for data encryption.
out_encapsulated_key | the generated encapsulated key |
out_shared_key | the generated shared key |
rng | the RNG to use |
desired_shared_key_len | desired size of the shared key in bytes (ignored if no KDF is used) |
salt | a salt value used in the KDF (ignored if no KDF is used) |
Definition at line 670 of file pubkey.h.
|
inline |
|
inline |
Definition at line 707 of file pubkey.h.
void Botan::PK_KEM_Encryptor::encrypt | ( | std::span< uint8_t > | out_encapsulated_key, |
std::span< uint8_t > | out_shared_key, | ||
RandomNumberGenerator & | rng, | ||
size_t | desired_shared_key_len = 32, | ||
std::span< const uint8_t > | salt = {} ) |
Generate a shared key for data encryption.
out_encapsulated_key | the generated encapsulated key |
out_shared_key | the generated shared key |
rng | the RNG to use |
desired_shared_key_len | desired size of the shared key in bytes (ignored if no KDF is used) |
salt | a salt value used in the KDF (ignored if no KDF is used) |
Definition at line 157 of file pubkey.cpp.
References BOTAN_ARG_CHECK, encapsulated_key_length(), and shared_key_length().
|
delete |
|
defaultnoexcept |
size_t Botan::PK_KEM_Encryptor::shared_key_length | ( | size_t | desired_shared_key_len | ) | const |
Return the length of the shared key returned by this KEM
If this KEM was used with a KDF, then it will always return exactly the desired key length, because the output of the KEM will be hashed by the KDF.
However if the KEM was used with "Raw" kdf, to request the algorithmic output of the KEM directly, then the desired key length will be ignored and a bytestring that depends on the algorithm is returned
desired_shared_key_len | is the requested length |
Definition at line 149 of file pubkey.cpp.
References shared_key_length().
Referenced by encrypt(), and shared_key_length().