Botan 3.9.0
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 |
BOTAN_FUTURE_EXPLICIT | FPE_FE1 (const BigInt &n, size_t rounds=5, bool compat_mode=false, std::string_view mac_algo="HMAC(SHA-256)") |
FPE_FE1 (const FPE_FE1 &other)=delete | |
FPE_FE1 (FPE_FE1 &&other) noexcept | |
bool | has_keying_material () const override |
Key_Length_Specification | key_spec () const override |
size_t | maximum_keylength () const |
size_t | minimum_keylength () const |
std::string | name () const override |
FPE_FE1 & | operator= (const FPE_FE1 &other)=delete |
FPE_FE1 & | operator= (FPE_FE1 &&other)=delete |
void | set_key (const OctetString &key) |
void | set_key (const uint8_t key[], size_t length) |
void | set_key (std::span< const uint8_t > key) |
bool | valid_keylength (size_t length) const |
~FPE_FE1 () override |
Protected Member Functions | |
void | assert_key_material_set () const |
void | assert_key_material_set (bool predicate) 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, | ||
std::string_view | 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 71 of file fpe_fe1.cpp.
References Botan::MessageAuthenticationCode::create_or_throw(), and Botan::BigInt::serialize().
Referenced by FPE_FE1(), FPE_FE1(), operator=(), and operator=().
|
overridedefault |
References clear(), decrypt(), encrypt(), has_keying_material(), key_spec(), and name().
|
inlineprotectedinherited |
Definition at line 146 of file sym_algo.h.
References assert_key_material_set(), and has_keying_material().
Referenced by assert_key_material_set(), Botan::Salsa20::cipher_bytes(), Botan::Lion::decrypt_n(), Botan::Lion::encrypt_n(), Botan::GHASH::final(), Botan::GHASH::nonce_hash(), Botan::ChaCha::seek(), Botan::CTR_BE::seek(), Botan::Salsa20::seek(), Botan::GHASH::set_associated_data(), Botan::OCB_Mode::set_associated_data_n(), Botan::Salsa20::set_iv_bytes(), Botan::GHASH::update(), and Botan::GHASH::update_associated_data().
|
inlineprotectedinherited |
Definition at line 148 of file sym_algo.h.
|
overridevirtual |
Reset the internal state. This includes not just the key, but any partial message that may have been in process.
Implements Botan::SymmetricAlgorithm.
Definition at line 101 of file fpe_fe1.cpp.
Referenced by ~FPE_FE1().
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 168 of file fpe_fe1.cpp.
References Botan::ct_divide(), and Botan::ct_modulo().
Referenced by decrypt(), Botan::FPE::fe1_decrypt(), and ~FPE_FE1().
Definition at line 193 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 149 of file fpe_fe1.cpp.
References Botan::ct_divide(), and Botan::ct_modulo().
Referenced by encrypt(), Botan::FPE::fe1_encrypt(), and ~FPE_FE1().
Definition at line 187 of file fpe_fe1.cpp.
References encrypt(), and Botan::store_be().
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 113 of file fpe_fe1.cpp.
Referenced by ~FPE_FE1().
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 109 of file fpe_fe1.cpp.
Referenced by ~FPE_FE1().
|
inlineinherited |
Definition at line 102 of file sym_algo.h.
References key_spec().
|
inlineinherited |
Definition at line 107 of file sym_algo.h.
References key_spec().
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 105 of file fpe_fe1.cpp.
References Botan::fmt().
Referenced by ~FPE_FE1().
|
inherited |
Set the symmetric key of this object.
key | the SymmetricKey to be set. |
Definition at line 14 of file sym_algo.cpp.
References Botan::OctetString::begin(), Botan::OctetString::length(), and set_key().
Referenced by Botan::create_aes_row_generator(), 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(), Botan::Sphincs_Hash_Functions_Sha2::PRF_msg(), Botan::Sodium::randombytes_buf_deterministic(), Botan::TLS::TLS_NULL_HMAC_AEAD_Mode::reset(), and set_key().
|
inlineinherited |
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 133 of file sym_algo.h.
References set_key().
Referenced by set_key().
|
inherited |
Set the symmetric key of this object.
key | the contiguous byte range to be set. |
Definition at line 22 of file sym_algo.cpp.
References name(), and valid_keylength().
|
inlineinherited |
Check whether a given key length is valid for this algorithm.
length | the key length to be checked. |
Definition at line 114 of file sym_algo.h.
References key_spec().
Referenced by set_key().