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

#include <pubkey.h>

Inheritance diagram for Botan::PK_Encryptor_EME:
Botan::PK_Encryptor

Public Member Functions

std::vector< byteencrypt (const byte in[], size_t length, RandomNumberGenerator &rng) const
 
template<typename Alloc >
std::vector< byteencrypt (const std::vector< byte, Alloc > &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 409 of file pubkey.h.

Constructor & Destructor Documentation

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

Construct an instance.

Parameters
keythe key to use inside the decryptor
emethe EME to use

Definition at line 24 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().

26  {
27  Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory());
28 
29  while(const Engine* engine = i.next())
30  {
31  op = engine->get_encryption_op(key);
32  if(op)
33  break;
34  }
35 
36  if(!op)
37  throw Lookup_Error("PK_Encryptor_EME: No working engine for " +
38  key.algo_name());
39 
40  eme = (eme_name == "Raw") ? nullptr : get_eme(eme_name);
41  }
Botan::PK_Encryptor_EME::~PK_Encryptor_EME ( )
inline

Definition at line 422 of file pubkey.h.

422 { delete op; delete eme; }

Member Function Documentation

std::vector<byte> Botan::PK_Encryptor::encrypt ( const byte  in[],
size_t  length,
RandomNumberGenerator rng 
) const
inlineinherited

Encrypt a message.

Parameters
inthe message as a byte array
lengththe length of the above byte array
rngthe random number source to use
Returns
encrypted message

Definition at line 48 of file pubkey.h.

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

50  {
51  return enc(in, length, rng);
52  }
template<typename Alloc >
std::vector<byte> Botan::PK_Encryptor::encrypt ( const std::vector< byte, Alloc > &  in,
RandomNumberGenerator rng 
) const
inlineinherited

Encrypt a message.

Parameters
inthe message
rngthe random number source to use
Returns
encrypted message

Definition at line 61 of file pubkey.h.

References rng.

63  {
64  return enc(&in[0], in.size(), rng);
65  }
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 73 of file pubkey.cpp.

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

Referenced by Botan::KeyPair::encryption_consistency_check().

74  {
75  if(!eme)
76  return (op->max_input_bits() / 8);
77  else
78  return eme->maximum_input_size(op->max_input_bits());
79  }

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