aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/misc/fpe_fe1/fpe_fe1.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-02-05 07:44:25 +0000
committerlloyd <[email protected]>2015-02-05 07:44:25 +0000
commitcb0f83ae63c4555cbdd0607e3a5f6e9260c0d19c (patch)
tree4981027a25fa8074177b97c3a3ca7431f3337deb /src/lib/misc/fpe_fe1/fpe_fe1.h
parent2c14faf0aa1cfe0f8d70af1938dcad5b4d6d3b59 (diff)
Clean up root dir, remove some unneeded dependencies
Diffstat (limited to 'src/lib/misc/fpe_fe1/fpe_fe1.h')
-rw-r--r--src/lib/misc/fpe_fe1/fpe_fe1.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/misc/fpe_fe1/fpe_fe1.h b/src/lib/misc/fpe_fe1/fpe_fe1.h
new file mode 100644
index 000000000..a1cae9917
--- /dev/null
+++ b/src/lib/misc/fpe_fe1/fpe_fe1.h
@@ -0,0 +1,48 @@
+/*
+* Format Preserving Encryption (FE1 scheme)
+* (C) 2009 Jack Lloyd
+*
+* Botan is released under the Simplified BSD License (see license.txt)
+*/
+
+#ifndef BOTAN_FPE_FE1_H__
+#define BOTAN_FPE_FE1_H__
+
+#include <botan/bigint.h>
+#include <botan/symkey.h>
+
+namespace Botan {
+
+namespace FPE {
+
+/**
+* Format Preserving Encryption using the scheme FE1 from the paper
+* "Format-Preserving Encryption" by Bellare, Rogaway, et al
+* (http://eprint.iacr.org/2009/251)
+*
+* Encrypt X from and onto the group Z_n using key and tweak
+* @param n the modulus
+* @param X the plaintext as a BigInt
+* @param key a random key
+* @param tweak will modify the ciphertext (think of as an IV)
+*/
+BigInt BOTAN_DLL fe1_encrypt(const BigInt& n, const BigInt& X,
+ const SymmetricKey& key,
+ const std::vector<byte>& tweak);
+
+/**
+* Decrypt X from and onto the group Z_n using key and tweak
+* @param n the modulus
+* @param X the ciphertext as a BigInt
+* @param key is the key used for encryption
+* @param tweak the same tweak used for encryption
+*/
+BigInt BOTAN_DLL fe1_decrypt(const BigInt& n, const BigInt& X,
+ const SymmetricKey& key,
+ const std::vector<byte>& tweak);
+
+}
+
+}
+
+#endif