|
Botan
1.11.15
|
#include <mceliece.h>
Public Types | |
| typedef PK_Spec< Public_Key > | Spec |
Public Member Functions | |
| secure_vector< byte > | encrypt (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) | |
Definition at line 125 of file mceliece.h.
typedef PK_Spec<Public_Key> Botan::PK_Ops::Encryption::Spec [inherited] |
| Botan::McEliece_Public_Operation::McEliece_Public_Operation | ( | const McEliece_PublicKey & | public_key, |
| u32bit | code_length | ||
| ) |
Definition at line 138 of file mceliece.cpp.
:m_pub_key(public_key),
m_code_length(the_code_length)
{}
| 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;
}
| McEliece_PublicKey const& Botan::McEliece_Public_Operation::get_key | ( | ) | const [inline] |
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(); }
1.7.6.1