8#ifndef BOTAN_PK_OPERATION_IMPL_H_
9#define BOTAN_PK_OPERATION_IMPL_H_
11#include <botan/hash.h>
13#include <botan/pk_ops.h>
14#include <botan/internal/eme.h>
30 virtual size_t max_ptext_input_bits()
const = 0;
32 virtual std::vector<uint8_t> raw_encrypt(std::span<const uint8_t> msg,
RandomNumberGenerator& rng) = 0;
33 std::unique_ptr<EME> m_eme;
47 std::unique_ptr<EME> m_eme;
54 void update(std::span<const uint8_t> input)
override;
63 std::string_view pk_algo,
64 bool allow_null_parameters =
false);
74 virtual bool verify(std::span<const uint8_t> input, std::span<const uint8_t> sig) = 0;
77 std::unique_ptr<HashFunction> m_hash;
82 void update(std::span<const uint8_t> input)
override;
93#if defined(BOTAN_HAS_RFC6979_GENERATOR)
94 std::string rfc6979_hash_function()
const;
98 virtual std::vector<uint8_t> raw_sign(std::span<const uint8_t> input,
RandomNumberGenerator& rng) = 0;
100 std::unique_ptr<HashFunction> m_hash;
106 std::span<const uint8_t> other_key,
107 std::span<const uint8_t> salt)
override;
116 std::unique_ptr<KDF> m_kdf;
121 void kem_encrypt(std::span<uint8_t> out_encapsulated_key,
122 std::span<uint8_t> out_shared_key,
124 size_t desired_shared_key_len,
125 std::span<const uint8_t> salt)
final;
133 std::span<uint8_t> out_raw_shared_key,
141 std::unique_ptr<KDF> m_kdf;
146 void kem_decrypt(std::span<uint8_t> out_shared_key,
147 std::span<const uint8_t> encapsulated_key,
148 size_t desired_shared_key_len,
149 std::span<const uint8_t> salt)
final;
157 std::span<const uint8_t> encapsulated_key) = 0;
164 std::unique_ptr<KDF> m_kdf;
~Decryption_with_EME() override=default
Decryption_with_EME(std::string_view eme)
secure_vector< uint8_t > decrypt(uint8_t &valid_mask, std::span< const uint8_t > ctext) override
std::vector< uint8_t > encrypt(std::span< const uint8_t > ptext, RandomNumberGenerator &rng) override
size_t max_input_bits() const override
~Encryption_with_EME() override=default
Encryption_with_EME(std::string_view eme)
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_KDF() override=default
KEM_Decryption_with_KDF(std::string_view kdf)
virtual void raw_kem_decrypt(std::span< uint8_t > out_raw_shared_key, std::span< const uint8_t > encapsulated_key)=0
size_t shared_key_length(size_t desired_shared_key_len) const final
virtual size_t raw_kem_shared_key_length() const =0
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
virtual size_t raw_kem_shared_key_length() const =0
size_t shared_key_length(size_t desired_shared_key_len) const final
~KEM_Encryption_with_KDF() override=default
virtual void raw_kem_encrypt(std::span< uint8_t > out_encapsulated_key, std::span< uint8_t > out_raw_shared_key, RandomNumberGenerator &rng)=0
KEM_Encryption_with_KDF(std::string_view kdf)
Key_Agreement_with_KDF(std::string_view kdf)
~Key_Agreement_with_KDF() override=default
secure_vector< uint8_t > agree(size_t key_len, std::span< const uint8_t > other_key, std::span< const uint8_t > salt) override
std::vector< uint8_t > sign(RandomNumberGenerator &rng) override
~Signature_with_Hash() override=default
std::string hash_function() const final
Signature_with_Hash(std::string_view hash)
~Verification_with_Hash() override=default
std::string hash_function() const final
virtual bool verify(std::span< const uint8_t > input, std::span< const uint8_t > sig)=0
Verification_with_Hash(std::string_view hash)
bool is_valid_signature(std::span< const uint8_t > sig) override
int(* update)(CTX *, const void *, CC_LONG len)
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector