Botan 2.19.1
Crypto and TLS for C&
|
#include <fpe_fe1.h>
Public Member Functions | |
void | clear () override |
BigInt | decrypt (const BigInt &x, const uint8_t tweak[], size_t tweak_len) const |
BigInt | decrypt (const BigInt &x, uint64_t tweak) const |
BigInt | encrypt (const BigInt &x, const uint8_t tweak[], size_t tweak_len) const |
BigInt | encrypt (const BigInt &x, uint64_t tweak) const |
FPE_FE1 (const BigInt &n, size_t rounds=5, bool compat_mode=false, const std::string &mac_algo="HMAC(SHA-256)") | |
Key_Length_Specification | key_spec () const override |
size_t | maximum_keylength () const |
size_t | minimum_keylength () const |
std::string | name () const override |
template<typename Alloc > | |
void | set_key (const std::vector< uint8_t, Alloc > &key) |
void | set_key (const SymmetricKey &key) |
void | set_key (const uint8_t key[], size_t length) |
bool | valid_keylength (size_t length) const |
~FPE_FE1 () | |
Protected Member Functions | |
void | verify_key_set (bool cond) const |
Format Preserving Encryption using the scheme FE1 from the paper "Format-Preserving Encryption" by Bellare, Rogaway, et al (https://eprint.iacr.org/2009/251)
Botan::FPE_FE1::FPE_FE1 | ( | const BigInt & | n, |
size_t | rounds = 5 , |
||
bool | compat_mode = false , |
||
const std::string & | mac_algo = "HMAC(SHA-256)" |
||
) |
n | the modulus. All plaintext and ciphertext values must be less than this. |
rounds | the number of rounds to use. Must be at least 3. |
compat_mode | An error in versions before 2.5.0 chose incorrect values for a and b. Set compat_mode to true to select this version. |
mac_algo | the PRF to use as the encryption function |
Definition at line 59 of file fpe_fe1.cpp.
References Botan::MessageAuthenticationCode::create_or_throw(), and Botan::BigInt::encode().
Botan::FPE_FE1::~FPE_FE1 | ( | ) |
Definition at line 91 of file fpe_fe1.cpp.
|
overridevirtual |
Reset the state.
Implements Botan::SymmetricAlgorithm.
Definition at line 96 of file fpe_fe1.cpp.
Decrypt X from and onto the group Z_n using key and tweak
x | the ciphertext to encrypt <= n |
tweak | must match the value used to encrypt |
tweak_len | length of tweak |
Definition at line 163 of file fpe_fe1.cpp.
References Botan::ct_divide(), and X.
Referenced by decrypt(), and Botan::FPE::fe1_decrypt().
Definition at line 189 of file fpe_fe1.cpp.
References decrypt(), and Botan::store_be().
Encrypt X from and onto the group Z_n using key and tweak
x | the plaintext to encrypt <= n |
tweak | will modify the ciphertext |
tweak_len | length of tweak |
Definition at line 144 of file fpe_fe1.cpp.
References Botan::ct_divide(), and X.
Referenced by encrypt(), and Botan::FPE::fe1_encrypt().
Definition at line 182 of file fpe_fe1.cpp.
References encrypt(), and Botan::store_be().
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 106 of file fpe_fe1.cpp.
|
inlineinherited |
Definition at line 120 of file sym_algo.h.
|
inlineinherited |
Definition at line 128 of file sym_algo.h.
Referenced by botan_block_cipher_get_keyspec(), and botan_mac_get_keyspec().
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 101 of file fpe_fe1.cpp.
References Botan::ASN1::to_string().
|
inlineinherited |
Definition at line 153 of file sym_algo.h.
|
inlineinherited |
Set the symmetric key of this object.
key | the SymmetricKey to be set. |
Definition at line 147 of file sym_algo.h.
References Botan::OctetString::begin(), and Botan::OctetString::length().
Referenced by Botan::aont_package(), Botan::aont_unpackage(), botan_block_cipher_set_key(), botan_cipher_set_key(), botan_mac_set_key(), Botan::Sodium::crypto_stream_salsa20(), Botan::Sodium::crypto_stream_salsa20_xor_ic(), Botan::Sodium::crypto_stream_xsalsa20(), Botan::Sodium::crypto_stream_xsalsa20_xor_ic(), Botan::FPE::fe1_decrypt(), Botan::FPE::fe1_encrypt(), and Botan::Sodium::randombytes_buf_deterministic().
|
inherited |
Set the symmetric key of this object.
key | the to be set as a byte array. |
length | in bytes of key param |
Definition at line 17 of file sym_algo.cpp.
References Botan::SymmetricAlgorithm::name(), and Botan::SymmetricAlgorithm::valid_keylength().
|
inlineinherited |
Check whether a given key length is valid for this algorithm.
length | the key length to be checked. |
Definition at line 138 of file sym_algo.h.
Referenced by Botan::aont_package(), Botan::aont_unpackage(), and Botan::SymmetricAlgorithm::set_key().
|
inlineprotectedinherited |
Definition at line 171 of file sym_algo.h.
Referenced by Botan::ChaCha::cipher(), Botan::CTR_BE::cipher(), Botan::RC4::cipher(), Botan::Salsa20::cipher(), Botan::SHAKE_128_Cipher::cipher(), Botan::AES_128::decrypt_n(), Botan::AES_192::decrypt_n(), Botan::AES_256::decrypt_n(), Botan::ARIA_128::decrypt_n(), Botan::ARIA_192::decrypt_n(), Botan::ARIA_256::decrypt_n(), Botan::Blowfish::decrypt_n(), Botan::Camellia_128::decrypt_n(), Botan::Camellia_192::decrypt_n(), Botan::Camellia_256::decrypt_n(), Botan::CAST_128::decrypt_n(), Botan::CAST_256::decrypt_n(), Botan::DES::decrypt_n(), Botan::TripleDES::decrypt_n(), Botan::DESX::decrypt_n(), Botan::GOST_28147_89::decrypt_n(), Botan::IDEA::decrypt_n(), Botan::KASUMI::decrypt_n(), Botan::Lion::decrypt_n(), Botan::MISTY1::decrypt_n(), Botan::Noekeon::decrypt_n(), Botan::SEED::decrypt_n(), Botan::Serpent::decrypt_n(), Botan::SHACAL2::decrypt_n(), Botan::SM4::decrypt_n(), Botan::Threefish_512::decrypt_n(), Botan::Twofish::decrypt_n(), Botan::XTEA::decrypt_n(), Botan::AES_128::encrypt_n(), Botan::AES_192::encrypt_n(), Botan::AES_256::encrypt_n(), Botan::ARIA_128::encrypt_n(), Botan::ARIA_192::encrypt_n(), Botan::ARIA_256::encrypt_n(), Botan::Blowfish::encrypt_n(), Botan::Camellia_128::encrypt_n(), Botan::Camellia_192::encrypt_n(), Botan::Camellia_256::encrypt_n(), Botan::CAST_128::encrypt_n(), Botan::CAST_256::encrypt_n(), Botan::DES::encrypt_n(), Botan::TripleDES::encrypt_n(), Botan::DESX::encrypt_n(), Botan::GOST_28147_89::encrypt_n(), Botan::IDEA::encrypt_n(), Botan::KASUMI::encrypt_n(), Botan::Lion::encrypt_n(), Botan::MISTY1::encrypt_n(), Botan::Noekeon::encrypt_n(), Botan::SEED::encrypt_n(), Botan::Serpent::encrypt_n(), Botan::SHACAL2::encrypt_n(), Botan::SM4::encrypt_n(), Botan::Threefish_512::encrypt_n(), Botan::Twofish::encrypt_n(), Botan::XTEA::encrypt_n(), Botan::OCB_Encryption::finish(), Botan::OCB_Decryption::finish(), Botan::GHASH::ghash_update(), Botan::CFB_Encryption::process(), Botan::CFB_Decryption::process(), Botan::ChaCha::seek(), Botan::CTR_BE::seek(), Botan::Salsa20::seek(), Botan::OCB_Mode::set_associated_data(), Botan::ChaCha::set_iv(), Botan::Salsa20::set_iv(), Botan::GHASH::update(), Botan::GHASH::update_associated_data(), and Botan::ChaCha::write_keystream().