Botan  1.11.15
Public Types | Public Member Functions
Botan::McEliece_Public_Operation Class Reference

#include <mceliece.h>

Inheritance diagram for Botan::McEliece_Public_Operation:
Botan::PK_Ops::Encryption

List of all members.

Public Types

typedef PK_Spec< Public_KeySpec

Public Member Functions

secure_vector< byteencrypt (const byte msg[], size_t msg_len, RandomNumberGenerator &)
McEliece_PublicKey const & get_key () const
size_t max_input_bits () const
 McEliece_Public_Operation (const McEliece_PublicKey &public_key, u32bit code_length)

Detailed Description

Definition at line 125 of file mceliece.h.


Member Typedef Documentation

typedef PK_Spec<Public_Key> Botan::PK_Ops::Encryption::Spec [inherited]

Definition at line 47 of file pk_ops.h.


Constructor & Destructor Documentation

Definition at line 138 of file mceliece.cpp.

   :m_pub_key(public_key),
    m_code_length(the_code_length)
   {}

Member Function Documentation

secure_vector< byte > Botan::McEliece_Public_Operation::encrypt ( const byte  msg[],
size_t  msg_len,
RandomNumberGenerator  
) [virtual]

Implements Botan::PK_Ops::Encryption.

Definition at line 143 of file mceliece.cpp.

References Botan::copy_mem(), Botan::McEliece_PublicKey::get_code_length(), Botan::mceliece_message_parts::get_error_positions(), Botan::McEliece_PublicKey::get_public_matrix(), and Botan::mceliece_encrypt().

Referenced by Botan::McEliece_PrivateKey::check_key(), and Botan::McEliece_KEM_Encryptor::encrypt().

   {
   mceliece_message_parts parts(msg, msg_len, m_pub_key.get_code_length());
   secure_vector<gf2m> err_pos = parts.get_error_positions();
   secure_vector<byte> message_word = parts.get_message_word();
   secure_vector<byte> ciphertext((m_pub_key.get_code_length()+7)/8);


   std::vector<byte> ciphertext_tmp = mceliece_encrypt( message_word,  m_pub_key.get_public_matrix(), err_pos, m_code_length);

   copy_mem(&ciphertext[0], &ciphertext_tmp[0], ciphertext.size());
   return ciphertext;
   }

Definition at line 133 of file mceliece.h.

Referenced by Botan::McEliece_KEM_Encryptor::encrypt().

{ return m_pub_key; }
size_t Botan::McEliece_Public_Operation::max_input_bits ( ) const [inline, virtual]

Implements Botan::PK_Ops::Encryption.

Definition at line 130 of file mceliece.h.

{ return m_pub_key.max_input_bits(); }

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