11#include <botan/cipher_mode.h>
12#include <botan/ec_group.h>
13#include <botan/ec_point.h>
14#include <botan/ecdh.h>
16#include <botan/pubkey.h>
17#include <botan/secmem.h>
18#include <botan/symkey.h>
25class RandomNumberGenerator;
47 return static_cast<ECIES_Flags>(
static_cast<uint32_t
>(a) |
static_cast<uint32_t
>(
b));
51 return static_cast<ECIES_Flags>(
static_cast<uint32_t
>(a) &
static_cast<uint32_t
>(
b));
67 std::string_view kdf_spec,
82 return (m_flags & ECIES_Flags::SingleHashMode) == ECIES_Flags::SingleHashMode;
85 inline bool cofactor_mode()
const {
return (m_flags & ECIES_Flags::CofactorMode) == ECIES_Flags::CofactorMode; }
88 return (m_flags & ECIES_Flags::OldCofactorMode) == ECIES_Flags::OldCofactorMode;
91 inline bool check_mode()
const {
return (m_flags & ECIES_Flags::CheckMode) == ECIES_Flags::CheckMode; }
95 const std::string&
kdf_spec()
const {
return m_kdf_spec; }
99 const std::string m_kdf_spec;
100 const size_t m_length;
116 std::string_view kdf_spec,
117 std::string_view dem_algo_spec,
119 std::string_view mac_spec,
133 std::string_view kdf_spec,
134 std::string_view dem_algo_spec,
136 std::string_view mac_spec,
146 std::unique_ptr<MessageAuthenticationCode> create_mac()
const;
149 std::unique_ptr<Cipher_Mode> create_cipher(
Cipher_Dir direction)
const;
158 const std::string m_dem_spec;
159 const size_t m_dem_keylen;
160 const std::string m_mac_spec;
161 const size_t m_mac_keylen;
186 SymmetricKey derive_secret(
const std::vector<uint8_t>& eph_public_key_bin,
187 const EC_Point& other_public_key_point)
const;
222 inline void set_label(std::string_view label) { m_label = std::vector<uint8_t>(label.begin(), label.end()); }
225 std::vector<uint8_t> enc(
const uint8_t data[],
size_t length,
RandomNumberGenerator&)
const override;
227 size_t maximum_input_size()
const override;
229 size_t ciphertext_length(
size_t ptext_len)
const override;
233 std::unique_ptr<MessageAuthenticationCode> m_mac;
234 std::unique_ptr<Cipher_Mode> m_cipher;
235 std::vector<uint8_t> m_eph_public_key_bin;
238 std::vector<uint8_t> m_label;
259 inline void set_label(std::string_view label) { m_label = std::vector<uint8_t>(label.begin(), label.end()); }
264 size_t plaintext_length(
size_t ctext_len)
const override;
268 std::unique_ptr<MessageAuthenticationCode> m_mac;
269 std::unique_ptr<Cipher_Mode> m_cipher;
271 std::vector<uint8_t> m_label;
void set_label(std::string_view label)
Set the label which is appended to the input for the message authentication code.
void set_initialization_vector(const InitializationVector &iv)
Set the initialization vector for the data encryption method.
void set_other_key(const EC_Point &public_point)
Set the public key of the other party.
void set_initialization_vector(const InitializationVector &iv)
Set the initialization vector for the data encryption method.
void set_label(std::string_view label)
Set the label which is appended to the input for the message authentication code.
ECIES_KA_Params(const ECIES_KA_Params &)=default
size_t secret_length() const
bool old_cofactor_mode() const
EC_Point_Format compression_type() const
bool cofactor_mode() const
virtual ~ECIES_KA_Params()=default
bool single_hash_mode() const
const std::string & kdf_spec() const
const EC_Group & domain() const
ECIES_KA_Params & operator=(const ECIES_KA_Params &)=delete
ECIES_System_Params(const ECIES_System_Params &)=default
~ECIES_System_Params() override=default
size_t dem_keylen() const
returns the length of the key used by the data encryption method
size_t mac_keylen() const
returns the length of the key used by the message authentication code
ECIES_System_Params & operator=(const ECIES_System_Params &)=delete
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_DEPRECATED(msg)
ASN1_Type operator|(ASN1_Type x, ASN1_Type y)
@ CofactorMode
(decryption only) if set: use cofactor multiplication during (ecdh) key agreement
@ OldCofactorMode
if set: use ecdhc instead of ecdh
@ CheckMode
(decryption only) if set: test if the (ephemeral) public key is on the curve
@ SingleHashMode
if set: prefix the input of the (ecdh) key agreement with the encoded (ephemeral) public key
std::vector< T, secure_allocator< T > > secure_vector
ECIES_Flags operator&(ECIES_Flags a, ECIES_Flags b)