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

#include <pubkey.h>

Inheritance diagram for Botan::PK_Decryptor_EME:
Botan::PK_Decryptor

Public Member Functions

secure_vector< bytedecrypt (const byte in[], size_t length) const
 
template<typename Alloc >
secure_vector< bytedecrypt (const std::vector< byte, Alloc > &in) const
 
 PK_Decryptor_EME (const Private_Key &key, const std::string &eme)
 

Detailed Description

Decryption with an MR algorithm and an EME.

Definition at line 417 of file pubkey.h.

Constructor & Destructor Documentation

Botan::PK_Decryptor_EME::PK_Decryptor_EME ( const Private_Key key,
const std::string &  eme 
)

Construct an instance.

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

Definition at line 82 of file pubkey.cpp.

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

84  {
85  Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory());
86  RandomNumberGenerator& rng = global_state().global_rng();
87 
88  while(const Engine* engine = i.next())
89  {
90  m_op.reset(engine->get_decryption_op(key, rng));
91  if(m_op)
92  break;
93  }
94 
95  if(!m_op)
96  throw Lookup_Error("Decryption with " + key.algo_name() + " not supported");
97 
98  m_eme.reset(get_eme(eme_name));
99  }
BOTAN_DLL EME * get_eme(const std::string &algo_spec)
Definition: get_pk_pad.cpp:114
RandomNumberGenerator & global_rng()
Definition: libstate.cpp:56
friend class Engine_Iterator
Definition: algo_factory.h:205
Library_State & global_state()

Member Function Documentation

secure_vector<byte> Botan::PK_Decryptor::decrypt ( const byte  in[],
size_t  length 
) const
inlineinherited

Decrypt a ciphertext.

Parameters
inthe ciphertext as a byte array
lengththe length of the above byte array
Returns
decrypted message

Definition at line 97 of file pubkey.h.

Referenced by Botan::KeyPair::encryption_consistency_check(), and Botan::PK_Decryptor_Filter::end_msg().

98  {
99  return dec(in, length);
100  }
template<typename Alloc >
secure_vector<byte> Botan::PK_Decryptor::decrypt ( const std::vector< byte, Alloc > &  in) const
inlineinherited

Decrypt a ciphertext.

Parameters
inthe ciphertext
Returns
decrypted message

Definition at line 108 of file pubkey.h.

109  {
110  return dec(&in[0], in.size());
111  }

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