8#include <botan/dlies.h>
9#include <botan/internal/xor_buf.h>
46 out.copy(&my_key[0], my_key.
size());
47 out.copy(my_key.
size(), in, length);
52 const size_t K_LENGTH = length + mac_keylen;
56 throw Encoding_Error(
"DLIES: KDF did not provide sufficient output");
57 byte* C = &out[my_key.
size()];
63 for(
size_t j = 0; j != 8; ++j)
66 mac->
final(C + length);
114 throw Decoding_Error(
"DLIES decryption: ciphertext is too short");
125 const size_t K_LENGTH = C.
size() + mac_keylen;
127 if(K.
length() != K_LENGTH)
128 throw Encoding_Error(
"DLIES: KDF did not provide sufficient output");
132 for(
size_t j = 0; j != 8; ++j)
void update(const byte in[], size_t length)
virtual size_t output_length() const =0
DLIES_Decryptor(const PK_Key_Agreement_Key &, KDF *kdf, MessageAuthenticationCode *mac, size_t mac_key_len=20)
DLIES_Encryptor(const PK_Key_Agreement_Key &, KDF *kdf, MessageAuthenticationCode *mac, size_t mac_key_len=20)
void set_other_key(const MemoryRegion< byte > &)
SecureVector< byte > derive_key(size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
SecureVector< byte > bits_of() const
const byte * begin() const
virtual size_t maximum_input_size() const =0
virtual MemoryVector< byte > public_value() const =0
SymmetricKey derive_key(size_t key_len, const byte in[], size_t in_len, const byte params[], size_t params_len) const
void set_key(const SymmetricKey &key)
void xor_buf(byte out[], const byte in[], size_t length)
std::invalid_argument Invalid_Argument
Decoding_Error(const std::string &name)
Encoding_Error(const std::string &name)
Invalid_State(const std::string &err)