Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::DLIES_Encryptor Class Reference

`#include <dlies.h>`

Inheritance diagram for Botan::DLIES_Encryptor:

## Public Member Functions
| DLIES_Encryptor (const DH_PrivateKey &own_priv_key, RandomNumberGenerator &rng, KDF *kdf, MessageAuthenticationCode *mac, size_t mac_key_len=20)
| DLIES_Encryptor (const DH_PrivateKey &own_priv_key, RandomNumberGenerator &rng, KDF *kdf, Cipher_Mode *cipher, size_t cipher_key_len, MessageAuthenticationCode *mac, size_t mac_key_len=20)
std::vector< uint8_t > | encrypt (const uint8_t in[], size_t length, RandomNumberGenerator &rng) const
template<typename Alloc >
std::vector< uint8_t > | encrypt (const std::vector< uint8_t, Alloc > &in, RandomNumberGenerator &rng) const
void | set_initialization_vector (const InitializationVector &iv)
| Set the initialization vector for the data encryption method. More...
void | set_other_key (const std::vector< uint8_t > &other_pub_key)

## Detailed Description

DLIES Encryption

Definition at line 23 of file dlies.h.

## Constructor & Destructor Documentation

Botan::DLIES_Encryptor::DLIES_Encryptor | ( | const DH_PrivateKey & | own_priv_key,
|  | RandomNumberGenerator & | rng,
|  | KDF * | kdf,
|  | MessageAuthenticationCode * | mac,
|  | size_t | mac_key_len = `20`
| ) |  |

Stream mode: use KDF to provide a stream of bytes to xor with the message

Parameters

  own_priv_key | own (ephemeral) DH private key
  rng | the RNG to use
  kdf | the KDF that should be used
  mac | the MAC function that should be used
  mac_key_len | key length of the MAC function. Default = 20 bytes

output = (ephemeral) public key + ciphertext + tag

Definition at line 14 of file dlies.cpp.

18 :
19 DLIES_Encryptor(own_priv_key, rng, kdf, nullptr, 0, mac, mac_key_length)
20 {
21 }
Botan::DLIES_Encryptor::DLIES_Encryptor
DLIES_Encryptor(const DH_PrivateKey &own_priv_key, RandomNumberGenerator &rng, KDF *kdf, MessageAuthenticationCode *mac, size_t mac_key_len=20)
Definition: dlies.cpp:14

Botan::DLIES_Encryptor::DLIES_Encryptor | ( | const DH_PrivateKey & | own_priv_key,
|  | RandomNumberGenerator & | rng,
|  | KDF * | kdf,
|  | Cipher_Mode * | cipher,
|  | size_t | cipher_key_len,
|  | MessageAuthenticationCode * | mac,
|  | size_t | mac_key_len = `20`
| ) |  |

Block cipher mode

Parameters

  own_priv_key | own (ephemeral) DH private key
  rng | the RNG to use
  kdf | the KDF that should be used
  cipher | the block cipher that should be used
  cipher_key_len | the key length of the block cipher
  mac | the MAC function that should be used
  mac_key_len | key length of the MAC function. Default = 20 bytes

output = (ephemeral) public key + ciphertext + tag

Definition at line 23 of file dlies.cpp.

References BOTAN_ASSERT_NONNULL.

29 :
30 m_other_pub_key(),
31 m_own_pub_key(own_priv_key.public_value()),
32 m_ka(own_priv_key, rng, "Raw"),
33 m_kdf(kdf),
34 m_cipher(cipher),
35 m_cipher_key_len(cipher_key_len),
36 m_mac(mac),
37 m_mac_keylen(mac_key_length),
38 m_iv()
39 {
40 BOTAN_ASSERT_NONNULL(kdf);
41 BOTAN_ASSERT_NONNULL(mac);
42 }
BOTAN_ASSERT_NONNULL
#define BOTAN_ASSERT_NONNULL(ptr)
Definition: assert.h:79

## Member Function Documentation

std::vector<uint8_t> Botan::PK_Encryptor::encrypt | ( | const uint8_t | in[],
|  | size_t | length,
|  | RandomNumberGenerator & | rng
| ) |  | const
| inline inherited

Encrypt a message.

Parameters

  in | the message as a byte array
  length | the length of the above byte array
  rng | the random number source to use

Returns
  encrypted message

Definition at line 46 of file pubkey.h.

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), and Botan::KeyPair::encryption_consistency_check().

48 {
49 return enc(in, length, rng);
50 }
template<typename Alloc >

std::vector<uint8_t> Botan::PK_Encryptor::encrypt | ( | const std::vector< uint8_t, Alloc > & | in,
|  | RandomNumberGenerator & | rng
| ) |  | const
| inline inherited

Encrypt a message.

Parameters

  in | the message
  rng | the random number source to use

Returns
  encrypted message

Definition at line 59 of file pubkey.h.

61 {
62 return enc(in.data(), in.size(), rng);
63 }

void Botan::DLIES_Encryptor::set_initialization_vector | ( | const InitializationVector & | iv | ) |
| inline

Set the initialization vector for the data encryption method.

Definition at line 71 of file dlies.h.

72 {
73 m_iv = iv;
74 }

void Botan::DLIES_Encryptor::set_other_key | ( | const std::vector< uint8_t > & | other_pub_key | ) |
| inline

Definition at line 65 of file dlies.h.

66 {
67 m_other_pub_key = other_pub_key;
68 }

The documentation for this class was generated from the following files:

- src/lib/pubkey/dlies/dlies.h
- src/lib/pubkey/dlies/dlies.cpp