Botan 3.9.0
Crypto and TLS for C&
|
Abstract interface for a KEM encryption operation for KEM combiners. More...
#include <hybrid_kem_ops.h>
Public Member Functions | |
size_t | encapsulated_key_length () const override |
The default implementation returns the sum of the encapsulated key lengths of the underlying KEMs. | |
void | kem_encrypt (std::span< uint8_t > out_encapsulated_key, std::span< uint8_t > out_shared_key, RandomNumberGenerator &rng, size_t desired_shared_key_len, std::span< const uint8_t > salt) final |
KEM_Encryption_with_Combiner (const std::vector< std::unique_ptr< Public_Key > > &public_keys, std::string_view provider) | |
virtual size_t | shared_key_length (size_t desired_shared_key_len) const =0 |
Protected Member Functions | |
virtual void | combine_ciphertexts (std::span< uint8_t > out_ciphertext, const std::vector< std::vector< uint8_t > > &ciphertexts, std::span< const uint8_t > salt) |
Defines how multiple ciphertexts are combined into a single ciphertext. | |
virtual void | combine_shared_secrets (std::span< uint8_t > out_shared_secret, const std::vector< secure_vector< uint8_t > > &shared_secrets, const std::vector< std::vector< uint8_t > > &ciphertexts, size_t desired_shared_key_len, std::span< const uint8_t > salt)=0 |
Describes how the shared secrets are combined to derive the final shared secret. | |
std::vector< PK_KEM_Encryptor > & | encryptors () |
const std::vector< PK_KEM_Encryptor > & | encryptors () const |
Abstract interface for a KEM encryption operation for KEM combiners.
Multiple public keys are used to encapsulate shared secrets. These shared secrets (and maybe the ciphertexts and public keys) are combined using the KEM combiner to derive the final shared secret.
Definition at line 31 of file hybrid_kem_ops.h.
Botan::KEM_Encryption_with_Combiner::KEM_Encryption_with_Combiner | ( | const std::vector< std::unique_ptr< Public_Key > > & | public_keys, |
std::string_view | provider ) |
Definition at line 15 of file hybrid_kem_ops.cpp.
|
protectedvirtual |
Defines how multiple ciphertexts are combined into a single ciphertext.
The default implementation concatenates the ciphertexts.
out_ciphertext | The output buffer for the combined ciphertext |
ciphertexts | The ciphertexts to combine |
salt | The salt. In this default implementation the salt must be empty. |
Definition at line 50 of file hybrid_kem_ops.cpp.
References Botan::BufferStuffer::append(), BOTAN_ARG_CHECK, BOTAN_ASSERT_NOMSG, encapsulated_key_length(), and Botan::BufferStuffer::full().
Referenced by kem_encrypt().
|
protectedpure virtual |
Describes how the shared secrets are combined to derive the final shared secret.
out_shared_secret | the output buffer for the shared secret |
shared_secrets | a list of shared secrets coreesponding to the public keys |
ciphertexts | a list of encapsulated shared secrets |
desired_shared_key_len | the desired shared key length |
salt | the salt (input of kem_encrypt) |
Referenced by kem_encrypt().
|
inlineoverridevirtual |
The default implementation returns the sum of the encapsulated key lengths of the underlying KEMs.
Implements Botan::PK_Ops::KEM_Encryption.
Definition at line 43 of file hybrid_kem_ops.h.
Referenced by combine_ciphertexts(), and kem_encrypt().
|
inlineprotected |
Definition at line 74 of file hybrid_kem_ops.h.
|
inlineprotected |
Definition at line 76 of file hybrid_kem_ops.h.
|
finalvirtual |
Implements Botan::PK_Ops::KEM_Encryption.
Definition at line 25 of file hybrid_kem_ops.cpp.
References BOTAN_ARG_CHECK, combine_ciphertexts(), combine_shared_secrets(), Botan::KEM_Encapsulation::destructure(), encapsulated_key_length(), and Botan::PK_Ops::KEM_Encryption::shared_key_length().
|
pure virtualinherited |
Implemented in Botan::PK_Ops::KEM_Encryption_with_KDF.
Referenced by Botan::KEM_Encryption_with_Combiner::kem_encrypt().