Botan: Botan::PK_Encryptor_EME Class Reference

Botan 1.10.17

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

`#include <pubkey.h>`

Inheritance diagram for Botan::PK_Encryptor_EME:

## Public Member Functions
SecureVector< byte > | encrypt (const byte in[], size_t length, RandomNumberGenerator &rng) const
SecureVector< byte > | encrypt (const MemoryRegion< byte > &in, RandomNumberGenerator &rng) const
size_t | maximum_input_size () const
| PK_Encryptor_EME (const Public_Key &key, const std::string &eme)
| ~PK_Encryptor_EME ()

## Detailed Description

Encryption with an MR algorithm and an EME.

Definition at line 398 of file pubkey.h.

## Constructor & Destructor Documentation

## ◆ PK_Encryptor_EME()

Botan::PK_Encryptor_EME::PK_Encryptor_EME | ( | const Public_Key & | key,
|  | const std::string & | eme
| ) |  |

Construct an instance.

Parameters

  key | the key to use inside the decryptor
  eme | the EME to use

Definition at line 25 of file pubkey.cpp.

References Botan::Public_Key::algo_name(), Botan::get_eme(), Botan::Global_State_Management::global_state(), and Botan::Algorithm_Factory::Engine_Iterator::next().

27 {
28 Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory());
29
30 op = 0;
31
32 while(const Engine* engine = i.next())
33 {
34 op = engine->get_encryption_op(key);
35 if(op)
36 break;
37 }
38
39 if(!op)
40 throw Lookup_Error("Encryption with " + key.algo_name() + " not supported");
41
42 eme = (eme_name == "Raw") ? 0 : get_eme(eme_name);
43 }
Botan::Algorithm_Factory::Engine_Iterator
friend class Engine_Iterator
Definition: algo_factory.h:207
Botan::Global_State_Management::global_state
Library_State & global_state()
Definition: global_state.cpp:32
Botan::get_eme
EME * get_eme(const std::string &algo_spec)
Definition: get_enc.cpp:143

## ◆ ~PK_Encryptor_EME()

Botan::PK_Encryptor_EME::~PK_Encryptor_EME | ( |  | ) |
| inline

Definition at line 411 of file pubkey.h.

411 { delete op; delete eme; }

## Member Function Documentation

## ◆ encrypt() [1/2]

SecureVector<byte> Botan::PK_Encryptor::encrypt | ( | const byte | in[],
|  | size_t | length,
|  | RandomNumberGenerator & | rng
| ) |  | const
| inlineinherited

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 48 of file pubkey.h.

Referenced by Botan::PK_Encryptor_Filter::end_msg().

50 {
51 return enc(in, length, rng);
52 }

## ◆ encrypt() [2/2]

SecureVector<byte> Botan::PK_Encryptor::encrypt | ( | const MemoryRegion< byte > & | in,
|  | RandomNumberGenerator & | rng
| ) |  | const
| inlineinherited

Encrypt a message.

Parameters

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

Returns
  encrypted message

Definition at line 60 of file pubkey.h.

62 {
63 return enc(&in[0], in.size(), rng);
64 }
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29

## ◆ maximum_input_size()

size_t Botan::PK_Encryptor_EME::maximum_input_size | ( |  | ) | const
| virtual

Return the maximum allowed message size in bytes.

Returns
  maximum message size in bytes

Implements Botan::PK_Encryptor.

Definition at line 75 of file pubkey.cpp.

References Botan::PK_Ops::Encryption::max_input_bits(), and Botan::EME::maximum_input_size().

76 {
77 if(!eme)
78 return (op->max_input_bits() / 8);
79 else
80 return eme->maximum_input_size(op->max_input_bits());
81 }
Botan::PK_Ops::Encryption::max_input_bits
virtual size_t max_input_bits() const =0
Botan::EME::maximum_input_size
virtual size_t maximum_input_size(size_t keybits) const =0

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

- src/pubkey/pubkey.h
- src/pubkey/pubkey.cpp