8 #include <botan/dlies.h>
9 #include <botan/internal/xor_buf.h>
40 if(length > maximum_input_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");
63 for(
size_t j = 0; j != 8; ++j)
66 mac->
final(C + length);
82 size_t DLIES_Encryptor::maximum_input_size()
const
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)
SymmetricKey derive_key(size_t key_len, const byte in[], size_t in_len, const byte params[], size_t params_len) const
std::invalid_argument Invalid_Argument
void copy(const T in[], size_t n)
SecureVector< byte > bits_of() const
DLIES_Encryptor(const PK_Key_Agreement_Key &, KDF *kdf, MessageAuthenticationCode *mac, size_t mac_key_len=20)
void set_key(const SymmetricKey &key)
const byte * begin() const
MessageAuthenticationCode * mac
void update(const byte in[], size_t length)
SecureVector< byte > derive_key(size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
virtual MemoryVector< byte > public_value() const =0
void set_other_key(const MemoryRegion< byte > &)
DLIES_Decryptor(const PK_Key_Agreement_Key &, KDF *kdf, MessageAuthenticationCode *mac, size_t mac_key_len=20)
void xor_buf(byte out[], const byte in[], size_t length)
virtual size_t output_length() const =0