11#include <botan/ecdh.h>
12#include <botan/ec_group.h>
13#include <botan/cipher_mode.h>
14#include <botan/point_gfp.h>
15#include <botan/pubkey.h>
16#include <botan/secmem.h>
17#include <botan/symkey.h>
25class RandomNumberGenerator;
46 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));
87 return (m_flags & ECIES_Flags::SINGLE_HASH_MODE) == ECIES_Flags::SINGLE_HASH_MODE;
92 return (m_flags & ECIES_Flags::COFACTOR_MODE) == ECIES_Flags::COFACTOR_MODE;
97 return (m_flags & ECIES_Flags::OLD_COFACTOR_MODE) == ECIES_Flags::OLD_COFACTOR_MODE;
102 return (m_flags & ECIES_Flags::CHECK_MODE) == ECIES_Flags::CHECK_MODE;
107 return m_compression_mode;
117 const std::string m_kdf_spec;
118 const size_t m_length;
136 size_t dem_key_len,
const std::string& mac_spec,
size_t mac_key_len);
149 size_t dem_key_len,
const std::string& mac_spec,
size_t mac_key_len,
157 std::unique_ptr<MessageAuthenticationCode> create_mac()
const;
175 const std::string m_dem_spec;
176 const size_t m_dem_keylen;
177 const std::string m_mac_spec;
178 const size_t m_mac_keylen;
205 SymmetricKey derive_secret(
const std::vector<uint8_t>& eph_public_key_bin,
206 const PointGFp& other_public_key_point)
const;
239 m_other_point = public_point;
251 m_label = std::vector<uint8_t>(label.begin(), label.end());
255 std::vector<uint8_t> enc(
const uint8_t data[],
size_t length,
RandomNumberGenerator&)
const override;
257 size_t maximum_input_size()
const override;
259 size_t ciphertext_length(
size_t ptext_len)
const override;
263 std::unique_ptr<MessageAuthenticationCode> m_mac;
264 std::unique_ptr<Cipher_Mode> m_cipher;
265 std::vector<uint8_t> m_eph_public_key_bin;
268 std::vector<uint8_t> m_label;
296 m_label = std::vector<uint8_t>(label.begin(), label.end());
302 size_t plaintext_length(
size_t ctext_len)
const override;
306 std::unique_ptr<MessageAuthenticationCode> m_mac;
307 std::unique_ptr<Cipher_Mode> m_cipher;
309 std::vector<uint8_t> m_label;
void set_initialization_vector(const InitializationVector &iv)
Set the initialization vector for the data encryption method.
void set_label(const std::string &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_label(const std::string &label)
Set the label which is appended to the input for the message authentication code.
void set_other_key(const Botan::PointGFp &public_point)
Set the public key of the other party.
ECIES_KA_Params(const ECIES_KA_Params &)=default
size_t secret_length() const
bool old_cofactor_mode() const
bool cofactor_mode() const
virtual ~ECIES_KA_Params()=default
bool single_hash_mode() const
const std::string & kdf_spec() const
PointGFp::Compression_Type compression_type() const
const EC_Group & domain() const
ECIES_KA_Params & operator=(const ECIES_KA_Params &)=delete
ECIES_System_Params(const ECIES_System_Params &)=default
virtual ~ECIES_System_Params()=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)
@ OLD_COFACTOR_MODE
if set: use ecdhc instead of ecdh
@ CHECK_MODE
(decryption only) if set: test if the (ephemeral) public key is on the curve
@ COFACTOR_MODE
(decryption only) if set: use cofactor multiplication during (ecdh) key agreement
@ SINGLE_HASH_MODE
if set: prefix the input of the (ecdh) key agreement with the encoded (ephemeral) public key
ECIES_Flags operator|(ECIES_Flags a, ECIES_Flags b)
std::vector< T, secure_allocator< T > > secure_vector
ECIES_Flags operator&(ECIES_Flags a, ECIES_Flags b)