Botan 2.19.3
Crypto and TLS for C&
|
#include <pubkey.h>
Public Member Functions | |
template<typename Alloc > | |
bool | check_signature (const std::vector< uint8_t, Alloc > &sig) |
bool | check_signature (const uint8_t sig[], size_t length) |
PK_Verifier & | operator= (const PK_Verifier &)=delete |
PK_Verifier (const PK_Verifier &)=delete | |
PK_Verifier (const Public_Key &pub_key, const std::string &emsa, Signature_Format format=IEEE_1363, const std::string &provider="") | |
void | set_input_format (Signature_Format format) |
void | update (const std::string &in) |
template<typename Alloc > | |
void | update (const std::vector< uint8_t, Alloc > &in) |
void | update (const uint8_t msg_part[], size_t length) |
void | update (uint8_t in) |
template<typename Alloc , typename Alloc2 > | |
bool | verify_message (const std::vector< uint8_t, Alloc > &msg, const std::vector< uint8_t, Alloc2 > &sig) |
bool | verify_message (const uint8_t msg[], size_t msg_length, const uint8_t sig[], size_t sig_length) |
~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, |
const std::string & | emsa, | ||
Signature_Format | format = IEEE_1363 , |
||
const std::string & | provider = "" |
||
) |
Construct a PK Verifier.
pub_key | the public key to verify against |
emsa | the EMSA to use (eg "EMSA3(SHA-1)") |
format | the signature format to use |
provider | the provider to use |
Definition at line 309 of file pubkey.cpp.
References Botan::Public_Key::algo_name(), Botan::Public_Key::create_verification_op(), Botan::Public_Key::message_part_size(), and Botan::Public_Key::message_parts().
Botan::PK_Verifier::~PK_Verifier | ( | ) |
Definition at line 323 of file pubkey.cpp.
|
delete |
|
inline |
Check the signature of the buffered message, i.e. the one build by successive calls to update.
sig | the signature to be verified |
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 343 of file pubkey.cpp.
References BOTAN_ASSERT_NOMSG, Botan::BER_Decoder::decode(), Botan::DER_SEQUENCE, Botan::BigInt::encode_1363(), Botan::IEEE_1363, Botan::BER_Decoder::more_items(), Botan::same_mem(), Botan::SEQUENCE, and Botan::BER_Decoder::start_cons().
Referenced by botan_pk_op_verify_finish(), Botan::Roughtime::Response::validate(), and verify_message().
|
delete |
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 325 of file pubkey.cpp.
|
inline |
Add a message part of the message corresponding to the signature to be verified.
Definition at line 372 of file pubkey.h.
References Botan::cast_char_ptr_to_uint8(), and update.
|
inline |
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 338 of file pubkey.cpp.
|
inline |
Add a message part (single byte) of the message corresponding to the signature to be verified.
in | the byte to add |
Definition at line 347 of file pubkey.h.
References update().
Referenced by botan_pk_op_verify_update(), update(), and Botan::Roughtime::Response::validate().
|
inline |
Verify a signature.
msg | the message that the signature belongs to |
sig | the signature |
Definition at line 335 of file pubkey.h.
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 331 of file pubkey.cpp.
References check_signature(), and update.
Referenced by Botan::KeyPair::signature_consistency_check(), Botan::TLS::Callbacks::tls_verify_message(), Botan::X509_Object::verify_signature(), and Botan::OCSP::Response::verify_signature().