Botan  2.13.0
Crypto and TLS for C++11
Functions
Botan::FPE Namespace Reference

Functions

BigInt fe1_decrypt (const BigInt &n, const BigInt &X, const SymmetricKey &key, const std::vector< uint8_t > &tweak)
 
BigInt fe1_encrypt (const BigInt &n, const BigInt &X, const SymmetricKey &key, const std::vector< uint8_t > &tweak)
 

Function Documentation

◆ fe1_decrypt()

BigInt Botan::FPE::fe1_decrypt ( const BigInt n,
const BigInt X,
const SymmetricKey key,
const std::vector< uint8_t > &  tweak 
)

Decrypt X from and onto the group Z_n using key and tweak

Parameters
nthe modulus
Xthe ciphertext as a BigInt
keyis the key used for encryption
tweakthe same tweak used for encryption
Warning
This function is hardcoded to use only 3 rounds which may be insecure for some values of n. Prefer FPE_FE1 class

Definition at line 207 of file fpe_fe1.cpp.

References Botan::FPE_FE1::decrypt(), Botan::SymmetricAlgorithm::set_key(), and X.

210  {
211  FPE_FE1 fpe(n, 3, true, "HMAC(SHA-256)");
212  fpe.set_key(key);
213  return fpe.decrypt(X, tweak.data(), tweak.size());
214  }
fe X
Definition: ge.cpp:27

◆ fe1_encrypt()

BigInt Botan::FPE::fe1_encrypt ( const BigInt n,
const BigInt X,
const SymmetricKey key,
const std::vector< uint8_t > &  tweak 
)

Format Preserving Encryption using the scheme FE1 from the paper "Format-Preserving Encryption" by Bellare, Rogaway, et al (https://eprint.iacr.org/2009/251)

Encrypt X from and onto the group Z_n using key and tweak

Parameters
nthe modulus
Xthe plaintext as a BigInt
keya random key
tweakwill modify the ciphertext (think of as an IV)
Warning
This function is hardcoded to use only 3 rounds which may be insecure for some values of n. Prefer FPE_FE1 class

Definition at line 198 of file fpe_fe1.cpp.

References Botan::FPE_FE1::encrypt(), Botan::SymmetricAlgorithm::set_key(), and X.

201  {
202  FPE_FE1 fpe(n, 3, true, "HMAC(SHA-256)");
203  fpe.set_key(key);
204  return fpe.encrypt(X, tweak.data(), tweak.size());
205  }
fe X
Definition: ge.cpp:27