Botan 3.6.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, std::string_view mac_algo="HMAC(SHA-256)") | |
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 |
void | set_key (const SymmetricKey &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 61 of file fpe_fe1.cpp.
References Botan::MessageAuthenticationCode::create_or_throw(), and Botan::BigInt::serialize().
|
overridedefault |
|
inlineprotectedinherited |
Definition at line 139 of file sym_algo.h.
References Botan::SymmetricAlgorithm::assert_key_material_set().
Referenced by Botan::SymmetricAlgorithm::assert_key_material_set(), Botan::Salsa20::cipher_bytes(), 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::DES::decrypt_n(), Botan::GOST_28147_89::decrypt_n(), Botan::IDEA::decrypt_n(), Botan::Kuznyechik::decrypt_n(), Botan::Lion::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::TripleDES::decrypt_n(), Botan::Twofish::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::DES::encrypt_n(), Botan::GOST_28147_89::encrypt_n(), Botan::IDEA::encrypt_n(), Botan::Kuznyechik::encrypt_n(), Botan::Lion::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::TripleDES::encrypt_n(), Botan::Twofish::encrypt_n(), Botan::GHASH::final(), Botan::GHASH::ghash_update(), Botan::ChaCha::seek(), Botan::CTR_BE::seek(), Botan::Salsa20::seek(), 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 141 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 91 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 156 of file fpe_fe1.cpp.
References Botan::ct_divide(), and X.
Referenced by decrypt(), and Botan::FPE::fe1_decrypt().
Definition at line 179 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 139 of file fpe_fe1.cpp.
References Botan::ct_divide(), and X.
Referenced by encrypt(), and Botan::FPE::fe1_encrypt().
Definition at line 173 of file fpe_fe1.cpp.
References encrypt(), and Botan::store_be().
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 103 of file fpe_fe1.cpp.
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 99 of file fpe_fe1.cpp.
|
inlineinherited |
Definition at line 95 of file sym_algo.h.
|
inlineinherited |
Definition at line 100 of file sym_algo.h.
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 95 of file fpe_fe1.cpp.
References Botan::fmt().
|
inlineinherited |
Set the symmetric key of this object.
key | the SymmetricKey to be set. |
Definition at line 113 of file sym_algo.h.
References Botan::OctetString::begin(), Botan::OctetString::length(), and Botan::SymmetricAlgorithm::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(), and Botan::SymmetricAlgorithm::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 126 of file sym_algo.h.
References Botan::SymmetricAlgorithm::set_key().
Referenced by Botan::SymmetricAlgorithm::set_key().
|
inherited |
Set the symmetric key of this object.
key | the contiguous byte range to be set. |
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 107 of file sym_algo.h.
Referenced by Botan::SymmetricAlgorithm::set_key().