Botan  2.4.0
Crypto and TLS for C++11
fpe_fe1.h
Go to the documentation of this file.
1 /*
2 * Format Preserving Encryption (FE1 scheme)
3 * (C) 2009 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_FPE_FE1_H_
9 #define BOTAN_FPE_FE1_H_
10 
11 #include <botan/bigint.h>
12 #include <botan/symkey.h>
13 
14 namespace Botan {
15 
16 namespace FPE {
17 
18 /**
19 * Format Preserving Encryption using the scheme FE1 from the paper
20 * "Format-Preserving Encryption" by Bellare, Rogaway, et al
21 * (https://eprint.iacr.org/2009/251)
22 *
23 * Encrypt X from and onto the group Z_n using key and tweak
24 * @param n the modulus
25 * @param X the plaintext as a BigInt
26 * @param key a random key
27 * @param tweak will modify the ciphertext (think of as an IV)
28 */
29 BigInt BOTAN_PUBLIC_API(2,0) fe1_encrypt(const BigInt& n, const BigInt& X,
30  const SymmetricKey& key,
31  const std::vector<uint8_t>& tweak);
32 
33 /**
34 * Decrypt X from and onto the group Z_n using key and tweak
35 * @param n the modulus
36 * @param X the ciphertext as a BigInt
37 * @param key is the key used for encryption
38 * @param tweak the same tweak used for encryption
39 */
40 BigInt BOTAN_PUBLIC_API(2,0) fe1_decrypt(const BigInt& n, const BigInt& X,
41  const SymmetricKey& key,
42  const std::vector<uint8_t>& tweak);
43 
44 }
45 
46 }
47 
48 #endif
fe X
Definition: ge.cpp:27
BigInt fe1_decrypt(const BigInt &n, const BigInt &X0, const SymmetricKey &key, const std::vector< uint8_t > &tweak)
Definition: fpe_fe1.cpp:159
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: bigint.h:635
Definition: alg_id.cpp:13
OctetString SymmetricKey
Definition: symkey.h:136
BigInt fe1_encrypt(const BigInt &n, const BigInt &X0, const SymmetricKey &key, const std::vector< uint8_t > &tweak)
Definition: fpe_fe1.cpp:131