Botan 3.6.1
Crypto and TLS for C&
|
#include <pubkey.h>
Public Member Functions | |
bool | check_signature (const uint8_t sig[], size_t length) |
bool | check_signature (std::span< const uint8_t > sig) |
std::string | hash_function () const |
PK_Verifier & | operator= (const PK_Verifier &)=delete |
PK_Verifier & | operator= (PK_Verifier &&) noexcept |
PK_Verifier (const PK_Verifier &)=delete | |
PK_Verifier (const Public_Key &pub_key, const AlgorithmIdentifier &signature_algorithm, std::string_view provider="") | |
PK_Verifier (const Public_Key &pub_key, std::string_view padding, Signature_Format format=Signature_Format::Standard, std::string_view provider="") | |
PK_Verifier (PK_Verifier &&) noexcept | |
void | set_input_format (Signature_Format format) |
void | update (const uint8_t msg_part[], size_t length) |
void | update (std::span< const uint8_t > in) |
void | update (std::string_view in) |
void | update (uint8_t in) |
bool | verify_message (const uint8_t msg[], size_t msg_length, const uint8_t sig[], size_t sig_length) |
bool | verify_message (std::span< const uint8_t > msg, std::span< const uint8_t > sig) |
~PK_Verifier () | |
Public Key Verifier. Use the verify_message() functions for small messages. Use multiple calls update() to process large messages and verify the signature by finally calling check_signature().
Botan::PK_Verifier::PK_Verifier | ( | const Public_Key & | pub_key, |
std::string_view | padding, | ||
Signature_Format | format = Signature_Format::Standard, | ||
std::string_view | provider = "" ) |
Construct a PK Verifier.
pub_key | the public key to verify against |
padding | the padding/hash to use (eg "EMSA_PKCS1(SHA-256)") |
format | the signature format to use |
provider | the provider to use |
Definition at line 328 of file pubkey.cpp.
References Botan::Asymmetric_Key::algo_name(), Botan::Public_Key::create_verification_op(), Botan::fmt(), Botan::Public_Key::message_part_size(), and Botan::Public_Key::message_parts().
Botan::PK_Verifier::PK_Verifier | ( | const Public_Key & | pub_key, |
const AlgorithmIdentifier & | signature_algorithm, | ||
std::string_view | provider = "" ) |
Construct a PK Verifier (X.509 specific)
This constructor will attempt to decode signature_format relative to the public key provided. If they seem to be inconsistent or otherwise unsupported, a Decoding_Error is thrown.
pub_key | the public key to verify against |
signature_algorithm | the supposed signature algorithm |
provider | the provider to use |
Definition at line 342 of file pubkey.cpp.
References Botan::Asymmetric_Key::algo_name(), Botan::Public_Key::create_x509_verification_op(), Botan::Public_Key::default_x509_signature_format(), Botan::fmt(), Botan::Public_Key::message_part_size(), and Botan::Public_Key::message_parts().
|
default |
|
delete |
|
defaultnoexcept |
bool Botan::PK_Verifier::check_signature | ( | const uint8_t | sig[], |
size_t | length ) |
Check the signature of the buffered message, i.e. the one build by successive calls to update.
sig | the signature to be verified as a byte array |
length | the length of the above byte array |
Definition at line 416 of file pubkey.cpp.
References Botan::DerSequence, and Botan::Standard.
Referenced by Botan::Roughtime::Response::validate(), and verify_message().
|
inline |
Check the signature of the buffered message, i.e. the one build by successive calls to update.
sig | the signature to be verified |
Definition at line 372 of file pubkey.h.
References check_signature().
Referenced by check_signature().
std::string Botan::PK_Verifier::hash_function | ( | ) | const |
Return the hash function which is being used to verify signatures. This should never return an empty string however it may return a string which does not map directly to a hash function, in particular if "Raw" (unhashed) encoding is being used.
Definition at line 362 of file pubkey.cpp.
References hash_function().
Referenced by hash_function(), and Botan::X509_Object::verify_signature().
|
delete |
|
defaultnoexcept |
void Botan::PK_Verifier::set_input_format | ( | Signature_Format | format | ) |
Set the format of the signatures fed to this verifier.
format | the signature format to use |
Definition at line 366 of file pubkey.cpp.
void Botan::PK_Verifier::update | ( | const uint8_t | msg_part[], |
size_t | length ) |
Add a message part of the message corresponding to the signature to be verified.
msg_part | the new message part as a byte array |
length | the length of the above byte array |
Definition at line 380 of file pubkey.cpp.
|
inline |
void Botan::PK_Verifier::update | ( | std::string_view | in | ) |
Add a message part of the message corresponding to the signature to be verified.
Definition at line 376 of file pubkey.cpp.
References Botan::cast_char_ptr_to_uint8(), and update.
|
inline |
bool Botan::PK_Verifier::verify_message | ( | const uint8_t | msg[], |
size_t | msg_length, | ||
const uint8_t | sig[], | ||
size_t | sig_length ) |
Verify a signature.
msg | the message that the signature belongs to, as a byte array |
msg_length | the length of the above byte array msg |
sig | the signature as a byte array |
sig_length | the length of the above byte array sig |
Definition at line 371 of file pubkey.cpp.
References check_signature(), and update.
Referenced by Botan::KeyPair::signature_consistency_check(), Botan::TLS::Callbacks::tls_verify_message(), Botan::OCSP::Response::verify_signature(), and Botan::X509_Object::verify_signature().
|
inline |
Verify a signature.
msg | the message that the signature belongs to |
sig | the signature |
Definition at line 325 of file pubkey.h.