|
Botan 3.13.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)" ) |
Create an FE1 format preserving encryption object
| n | the modulus. All plaintext and ciphertext values must be less than this. The value must not be prime and should be easily factored into roughly equal size values. The common case is that the modulus is a power of 10. |
| 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 72 of file fpe_fe1.cpp.
References Botan::MessageAuthenticationCode::create_or_throw().
Referenced by FPE_FE1(), FPE_FE1(), operator=(), and operator=().
|
overridedefault |
References clear(), decrypt(), encrypt(), has_keying_material(), key_spec(), and name().
|
delete |
References FPE_FE1().
|
defaultnoexcept |
Move constructor
References FPE_FE1().
|
inlineprotectedinherited |
Throw Key_Not_Set unless a key has been set on this object
Definition at line 180 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::Polyval::final(), Botan::Salsa20::generate_keystream(), Botan::GHASH::nonce_hash(), Botan::GHASH::reset_associated_data(), 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(), Botan::Polyval::update(), Botan::GHASH::update_associated_data(), and Botan::Polyval::zero_pad().
|
inlineprotectedinherited |
Throw Key_Not_Set unless the predicate holds
| predicate | if false, a Key_Not_Set exception is thrown |
Definition at line 186 of file sym_algo.h.
|
overridevirtual |
Reset the internal state, including the key
Implements Botan::SymmetricAlgorithm.
Definition at line 103 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 decrypt, where 0 <= x < n |
| tweak | must match the value used to encrypt |
| tweak_len | length of tweak |
Definition at line 172 of file fpe_fe1.cpp.
References BOTAN_ARG_CHECK, Botan::ct_divide(), Botan::ct_modulo(), and Botan::BigInt::signum().
Referenced by decrypt(), Botan::FPE::fe1_decrypt(), and ~FPE_FE1().
Decrypt X from and onto the group Z_n using key and tweak
| x | the ciphertext to decrypt, where 0 <= x < n |
| tweak | must match the value used to encrypt |
Definition at line 199 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, where 0 <= x < n |
| tweak | will modify the ciphertext |
| tweak_len | length of tweak |
Definition at line 151 of file fpe_fe1.cpp.
References BOTAN_ARG_CHECK, Botan::ct_divide(), Botan::ct_modulo(), and Botan::BigInt::signum().
Referenced by encrypt(), Botan::FPE::fe1_encrypt(), and ~FPE_FE1().
Encrypt X from and onto the group Z_n using key and tweak
| x | the plaintext to encrypt, where 0 <= x < n |
| tweak | will modify the ciphertext |
Definition at line 193 of file fpe_fe1.cpp.
References encrypt(), and Botan::store_be().
|
overridevirtual |
Test whether a key has been set on this object
Implements Botan::SymmetricAlgorithm.
Definition at line 115 of file fpe_fe1.cpp.
Referenced by ~FPE_FE1().
|
overridevirtual |
Return the key lengths supported by this object
Implements Botan::SymmetricAlgorithm.
Definition at line 111 of file fpe_fe1.cpp.
Referenced by ~FPE_FE1().
|
inlineinherited |
Return the largest acceptable key length
Definition at line 130 of file sym_algo.h.
References key_spec().
|
inlineinherited |
Return the smallest acceptable key length
Definition at line 136 of file sym_algo.h.
References key_spec().
|
overridevirtual |
Return the name of this algorithm
Implements Botan::SymmetricAlgorithm.
Definition at line 107 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 162 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 143 of file sym_algo.h.
References key_spec().
Referenced by set_key().