Botan  1.11.15
src/lib/misc/fpe_fe1/fpe_fe1.h
Go to the documentation of this file.
00001 /*
00002 * Format Preserving Encryption (FE1 scheme)
00003 * (C) 2009 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_FPE_FE1_H__
00009 #define BOTAN_FPE_FE1_H__
00010 
00011 #include <botan/bigint.h>
00012 #include <botan/symkey.h>
00013 
00014 namespace Botan {
00015 
00016 namespace FPE {
00017 
00018 /**
00019 * Format Preserving Encryption using the scheme FE1 from the paper
00020 * "Format-Preserving Encryption" by Bellare, Rogaway, et al
00021 * (http://eprint.iacr.org/2009/251)
00022 *
00023 * Encrypt X from and onto the group Z_n using key and tweak
00024 * @param n the modulus
00025 * @param X the plaintext as a BigInt
00026 * @param key a random key
00027 * @param tweak will modify the ciphertext (think of as an IV)
00028 */
00029 BigInt BOTAN_DLL fe1_encrypt(const BigInt& n, const BigInt& X,
00030                              const SymmetricKey& key,
00031                              const std::vector<byte>& tweak);
00032 
00033 /**
00034 * Decrypt X from and onto the group Z_n using key and tweak
00035 * @param n the modulus
00036 * @param X the ciphertext as a BigInt
00037 * @param key is the key used for encryption
00038 * @param tweak the same tweak used for encryption
00039 */
00040 BigInt BOTAN_DLL fe1_decrypt(const BigInt& n, const BigInt& X,
00041                              const SymmetricKey& key,
00042                              const std::vector<byte>& tweak);
00043 
00044 }
00045 
00046 }
00047 
00048 #endif