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>
18 #include <botan/mac.h>
25 class 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));
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.
(decryption only) if set: test if the (ephemeral) public key is on the curve
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
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