Botan  1.11.15
src/lib/pubkey/mce/mce_kem.h
Go to the documentation of this file.
00001 /**
00002  * (C) 2014 cryptosource GmbH
00003  * (C) 2014 Falko Strenzke fstrenzke@cryptosource.de
00004  *
00005  * Botan is released under the Simplified BSD License (see license.txt)
00006  *
00007  */
00008 
00009 #ifndef BOTAN_MCE_KEM_H__
00010 #define BOTAN_MCE_KEM_H__
00011 
00012 #include <botan/mceliece.h>
00013 #include <utility>
00014 
00015 namespace Botan {
00016 
00017 class BOTAN_DLL McEliece_KEM_Encryptor
00018    {
00019    public:
00020       McEliece_KEM_Encryptor(const McEliece_PublicKey& public_key);
00021 
00022       /**
00023       * returns the pair (mceliece ciphertext, symmetric key)
00024       */
00025       std::pair<secure_vector<byte>, secure_vector<byte>> encrypt(RandomNumberGenerator& rng);
00026 
00027    private:
00028       McEliece_Public_Operation m_raw_pub_op;
00029    };
00030 
00031 class BOTAN_DLL McEliece_KEM_Decryptor
00032    {
00033     public:
00034       McEliece_KEM_Decryptor(const McEliece_PrivateKey& mce_key);
00035 
00036       /**
00037       * returns the derived 512-bit symmetric key
00038       */
00039       secure_vector<Botan::byte> decrypt(const byte msg[], size_t msg_len);
00040 
00041       /**
00042       * returns the derived 512-bit symmetric key
00043       */
00044       template<typename Alloc>
00045       secure_vector<Botan::byte> decrypt_vec(const std::vector<byte, Alloc>& v)
00046          {
00047          return decrypt(&v[0], v.size());
00048 
00049          }
00050    private:
00051       McEliece_Private_Operation m_raw_priv_op;
00052   };
00053 }
00054 
00055 #endif