Botan 3.6.1
Crypto and TLS for C&
|
#include <pubkey.h>
Public Member Functions | |
secure_vector< uint8_t > | decrypt (const uint8_t in[], size_t length) const |
secure_vector< uint8_t > | decrypt (std::span< const uint8_t > in) const |
secure_vector< uint8_t > | decrypt_or_random (const uint8_t in[], size_t length, size_t expected_pt_len, RandomNumberGenerator &rng) const |
secure_vector< uint8_t > | decrypt_or_random (const uint8_t in[], size_t length, size_t expected_pt_len, RandomNumberGenerator &rng, const uint8_t required_content_bytes[], const uint8_t required_content_offsets[], size_t required_contents) const |
PK_Decryptor_EME & | operator= (const PK_Decryptor_EME &)=delete |
PK_Decryptor_EME & | operator= (PK_Decryptor_EME &&) noexcept |
PK_Decryptor_EME (const PK_Decryptor_EME &)=delete | |
PK_Decryptor_EME (const Private_Key &key, RandomNumberGenerator &rng, std::string_view eme, std::string_view provider="") | |
PK_Decryptor_EME (PK_Decryptor_EME &&) noexcept | |
size_t | plaintext_length (size_t ptext_len) const override |
~PK_Decryptor_EME () override | |
Botan::PK_Decryptor_EME::PK_Decryptor_EME | ( | const Private_Key & | key, |
RandomNumberGenerator & | rng, | ||
std::string_view | eme, | ||
std::string_view | provider = "" ) |
Construct an instance.
key | the key to use inside the decryptor |
rng | the random generator to use |
eme | the EME to use |
provider | the provider to use |
Definition at line 114 of file pubkey.cpp.
References Botan::Asymmetric_Key::algo_name(), Botan::Private_Key::create_decryption_op(), and Botan::fmt().
|
overridedefault |
|
delete |
|
defaultnoexcept |
|
inherited |
Decrypt a ciphertext, throwing an exception if the input seems to be invalid (eg due to an accidental or malicious error in the ciphertext).
in | the ciphertext as a byte array |
length | the length of the above byte array |
Definition at line 23 of file pubkey.cpp.
Referenced by Botan::KeyPair::encryption_consistency_check().
|
inlineinherited |
Same as above, but taking a vector
in | the ciphertext |
Definition at line 96 of file pubkey.h.
References Botan::PK_Decryptor::decrypt().
Referenced by Botan::PK_Decryptor::decrypt().
|
inherited |
Decrypt a ciphertext. If the ciphertext is invalid (eg due to invalid padding) or is not the expected length, instead returns a random string of the expected length. Use to avoid oracle attacks, especially against PKCS #1 v1.5 decryption.
Definition at line 80 of file pubkey.cpp.
References Botan::PK_Decryptor::decrypt_or_random().
Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), and Botan::PK_Decryptor::decrypt_or_random().
|
inherited |
Decrypt a ciphertext. If the ciphertext is invalid (eg due to invalid padding) or is not the expected length, instead returns a random string of the expected length. Use to avoid oracle attacks, especially against PKCS #1 v1.5 decryption.
Additionally checks (also in const time) that: contents[required_content_offsets[i]] == required_content_bytes[i] for 0 <= i < required_contents
Used for example in TLS, which encodes the client version in the content bytes: if there is any timing variation the version check can be used as an oracle to recover the key.
Definition at line 35 of file pubkey.cpp.
References BOTAN_ASSERT, Botan::CT::Mask< T >::is_equal(), and Botan::RandomNumberGenerator::random_vec().
|
delete |
|
defaultnoexcept |
|
overridevirtual |
Return an upper bound on the plaintext length for a particular ciphertext input length
Implements Botan::PK_Decryptor.
Definition at line 129 of file pubkey.cpp.
References plaintext_length().
Referenced by plaintext_length().