aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/mce/mce_kem.h
diff options
context:
space:
mode:
authorfstrenzke <[email protected]>2014-12-06 15:22:46 +0000
committerlloyd <[email protected]>2014-12-06 15:22:46 +0000
commit6082d3937f842ecebf0cb208b27a366917af0876 (patch)
tree04470173e6f69de12fafd0aec07a7c05bd08b6dd /src/lib/pubkey/mce/mce_kem.h
parent8a166c6a74e8818442fefcc452fdcf7752a0f239 (diff)
Add KEM scheme for McEliece
Diffstat (limited to 'src/lib/pubkey/mce/mce_kem.h')
-rw-r--r--src/lib/pubkey/mce/mce_kem.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/lib/pubkey/mce/mce_kem.h b/src/lib/pubkey/mce/mce_kem.h
new file mode 100644
index 000000000..4e46a0fab
--- /dev/null
+++ b/src/lib/pubkey/mce/mce_kem.h
@@ -0,0 +1,45 @@
+/**
+ * (C) 2014 cryptosource GmbH
+ * (C) 2014 Falko Strenzke [email protected]
+ *
+ * Distributed under the terms of the Botan license
+ *
+ */
+
+#ifndef BOTAN_MCE_KEM_H__
+#define BOTAN_MCE_KEM_H__
+
+#include <botan/mceliece.h>
+#include <utility>
+
+namespace Botan {
+
+class BOTAN_DLL McEliece_KEM_Encryptor
+ {
+ public:
+ McEliece_KEM_Encryptor(const McEliece_PublicKey& public_key);
+
+ /**
+ * returns the pair (mceliece ciphertext, symmetric key)
+ */
+ std::pair<secure_vector<byte>, secure_vector<byte>> encrypt(RandomNumberGenerator& rng);
+
+ private:
+ McEliece_Public_Operation m_raw_pub_op;
+ };
+
+class BOTAN_DLL McEliece_KEM_Decryptor
+ {
+ public:
+ McEliece_KEM_Decryptor(const McEliece_PrivateKey& mce_key);
+
+ /**
+ * returns the derived 512-bit symmetric key
+ */
+ secure_vector<Botan::byte> decrypt(const byte msg[], size_t msg_len);
+ private:
+ McEliece_Private_Operation m_raw_priv_op;
+ };
+}
+
+#endif /* h-guard */