8 #ifndef BOTAN_ECIES_H__
9 #define BOTAN_ECIES_H__
11 #include <botan/ecdh.h>
12 #include <botan/ec_group.h>
13 #include <botan/kdf.h>
14 #include <botan/cipher_mode.h>
15 #include <botan/mac.h>
16 #include <botan/point_gfp.h>
17 #include <botan/pubkey.h>
18 #include <botan/secmem.h>
19 #include <botan/symkey.h>
26 class RandomNumberGenerator;
47 return static_cast<ECIES_Flags>(
static_cast<uint32_t
>(a) | static_cast<uint32_t>(b));
52 return static_cast<ECIES_Flags>(
static_cast<uint32_t
>(a) & static_cast<uint32_t>(b));
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 inline size_t maximum_input_size()
const override
262 const ECIES_KA_Operation m_ka;
263 const ECIES_System_Params m_params;
264 std::vector<uint8_t> m_eph_public_key_bin;
266 PointGFp m_other_point;
267 std::vector<uint8_t> m_label;
295 m_label = std::vector<uint8_t>(label.begin(), label.end());
304 std::vector<uint8_t> m_label;
OctetString InitializationVector
void set_initialization_vector(const InitializationVector &iv)
Set the initialization vector for the data encryption method.
(decryption only) if set: test if the (ephemeral) public key is on the curve
if set: prefix the input of the (ecdh) key agreement with the encoded (ephemeral) public key ...
size_t dem_keylen() const
returns the length of the key used by the data encryption method
bool single_hash_mode() const
const EC_Group & domain() const
void set_initialization_vector(const InitializationVector &iv)
Set the initialization vector for the data encryption method.
std::vector< T, secure_allocator< T >> secure_vector
size_t secret_length() const
void set_label(const std::string &label)
Set the label which is appended to the input for the message authentication code. ...
ECIES_Flags operator&(ECIES_Flags a, ECIES_Flags b)
size_t mac_keylen() const
returns the length of the key used by the message authentication code
bool cofactor_mode() const
if set: use ecdhc instead of ecdh
(decryption only) if set: use cofactor multiplication during (ecdh) key agreement ...
const std::string & kdf_spec() const
PointGFp::Compression_Type compression_type() const
void set_other_key(const Botan::PointGFp &public_point)
Set the public key of the other party.
void set_label(const std::string &label)
Set the label which is appended to the input for the message authentication code. ...
ECIES_Flags operator|(ECIES_Flags a, ECIES_Flags b)
bool old_cofactor_mode() const