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>
33 std::string_view provider);
35 void kem_encrypt(std::span<uint8_t> out_encapsulated_key,
36 std::span<uint8_t> out_shared_key,
38 size_t desired_shared_key_len,
39 std::span<const uint8_t> salt)
final;
55 const std::vector<std::vector<uint8_t>>& ciphertexts,
56 std::span<const uint8_t> salt);
69 const std::vector<std::vector<uint8_t>>& ciphertexts,
70 size_t desired_shared_key_len,
71 std::span<const uint8_t> salt) = 0;
73 std::vector<PK_KEM_Encryptor>&
encryptors() {
return m_encryptors; }
75 const std::vector<PK_KEM_Encryptor>&
encryptors()
const {
return m_encryptors; }
78 std::vector<PK_KEM_Encryptor> m_encryptors;
79 size_t m_encapsulated_key_length;
94 std::string_view provider);
97 std::span<const uint8_t> encapsulated_key,
98 size_t desired_shared_key_len,
99 std::span<const uint8_t> salt)
final;
112 virtual std::vector<std::vector<uint8_t>>
split_ciphertexts(std::span<const uint8_t> concat_ciphertext);
125 const std::vector<std::vector<uint8_t>>& ciphertexts,
126 size_t desired_shared_key_len,
127 std::span<const uint8_t> salt) = 0;
129 std::vector<PK_KEM_Decryptor>&
decryptors() {
return m_decryptors; }
131 const std::vector<PK_KEM_Decryptor>&
decryptors()
const {
return m_decryptors; }
134 std::vector<PK_KEM_Decryptor> m_decryptors;
135 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