10#ifndef BOTAN_HYBRID_KEM_OPS_H_
11#define BOTAN_HYBRID_KEM_OPS_H_
13#include <botan/pk_algs.h>
14#include <botan/pubkey.h>
15#include <botan/internal/pk_ops_impl.h>
16#include <botan/internal/stl_util.h>
34 std::string_view provider);
36 void kem_encrypt(std::span<uint8_t> out_encapsulated_key,
37 std::span<uint8_t> out_shared_key,
39 size_t desired_shared_key_len,
40 std::span<const uint8_t> salt)
final;
56 const std::vector<std::vector<uint8_t>>& ciphertexts,
57 std::span<const uint8_t> salt);
70 const std::vector<std::vector<uint8_t>>& ciphertexts,
71 size_t desired_shared_key_len,
72 std::span<const uint8_t> salt) = 0;
74 std::vector<PK_KEM_Encryptor>&
encryptors() {
return m_encryptors; }
76 const std::vector<PK_KEM_Encryptor>&
encryptors()
const {
return m_encryptors; }
79 std::vector<PK_KEM_Encryptor> m_encryptors;
80 size_t m_encapsulated_key_length;
95 std::string_view provider);
98 std::span<const uint8_t> encapsulated_key,
99 size_t desired_shared_key_len,
100 std::span<const uint8_t> salt)
final;
113 virtual std::vector<std::vector<uint8_t>>
split_ciphertexts(std::span<const uint8_t> concat_ciphertext);
126 const std::vector<std::vector<uint8_t>>& ciphertexts,
127 size_t desired_shared_key_len,
128 std::span<const uint8_t> salt) = 0;
130 std::vector<PK_KEM_Decryptor>&
decryptors() {
return m_decryptors; }
132 const std::vector<PK_KEM_Decryptor>&
decryptors()
const {
return m_decryptors; }
135 std::vector<PK_KEM_Decryptor> m_decryptors;
136 size_t m_encapsulated_key_length;
std::vector< PK_KEM_Decryptor > & decryptors()
const std::vector< PK_KEM_Decryptor > & decryptors() const
void kem_decrypt(std::span< uint8_t > out_shared_key, std::span< const uint8_t > encapsulated_key, size_t desired_shared_key_len, std::span< const uint8_t > salt) final
KEM_Decryption_with_Combiner(const std::vector< std::unique_ptr< Private_Key > > &private_keys, RandomNumberGenerator &rng, std::string_view provider)
size_t encapsulated_key_length() const override
The default implementation returns the sum of the encapsulated key lengths of the underlying KEMs.
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.
virtual std::vector< std::vector< uint8_t > > split_ciphertexts(std::span< const uint8_t > concat_ciphertext)
Defines how the individual ciphertexts are extracted from the combined ciphertext.
KEM_Encryption_with_Combiner(const std::vector< std::unique_ptr< Public_Key > > &public_keys, std::string_view provider)
std::vector< PK_KEM_Encryptor > & encryptors()
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.
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
const std::vector< PK_KEM_Encryptor > & encryptors() const
size_t encapsulated_key_length() const override
The default implementation returns the sum of the encapsulated key lengths of the underlying KEMs.
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< T, secure_allocator< T > > secure_vector