#include <pk_ops_impl.h>
Definition at line 55 of file pk_ops_impl.h.
◆ ~Verification_with_Hash()
Botan::PK_Ops::Verification_with_Hash::~Verification_with_Hash |
( |
| ) |
|
|
overridedefault |
◆ Verification_with_Hash() [1/2]
Botan::PK_Ops::Verification_with_Hash::Verification_with_Hash |
( |
std::string_view | hash | ) |
|
|
explicitprotected |
Definition at line 157 of file pk_ops.cpp.
157 :
158 Verification(), m_hash(create_signature_hash(padding)) {}
◆ Verification_with_Hash() [2/2]
Botan::PK_Ops::Verification_with_Hash::Verification_with_Hash |
( |
const AlgorithmIdentifier & | alg_id, |
|
|
std::string_view | pk_algo, |
|
|
bool | allow_null_parameters = false ) |
|
explicitprotected |
Definition at line 166 of file pk_ops.cpp.
168 {
169 const auto oid_info =
split_on(alg_id.oid().to_formatted_string(),
'/');
170
171 if(oid_info.size() != 2 || oid_info[0] != pk_algo) {
172 throw Decoding_Error(
173 fmt(
"Unexpected AlgorithmIdentifier OID {} in association with {} key", alg_id.oid(), pk_algo));
174 }
175
176 if(!alg_id.parameters_are_empty()) {
177 if(alg_id.parameters_are_null()) {
178 if(!allow_null_parameters) {
179 throw Decoding_Error(
fmt(
"Unexpected NULL AlgorithmIdentifier parameters for {}", pk_algo));
180 }
181 } else {
182 throw Decoding_Error(
fmt(
"Unexpected AlgorithmIdentifier parameters for {}", pk_algo));
183 }
184 }
185
187}
static std::unique_ptr< HashFunction > create_or_throw(std::string_view algo_spec, std::string_view provider="")
std::string fmt(std::string_view format, const T &... args)
std::vector< std::string > split_on(std::string_view str, char delim)
References Botan::HashFunction::create_or_throw(), Botan::fmt(), Botan::AlgorithmIdentifier::oid(), Botan::AlgorithmIdentifier::parameters_are_empty(), Botan::AlgorithmIdentifier::parameters_are_null(), Botan::split_on(), and Botan::OID::to_formatted_string().
◆ hash_function()
std::string Botan::PK_Ops::Verification_with_Hash::hash_function |
( |
| ) |
const |
|
finalvirtual |
◆ is_valid_signature()
bool Botan::PK_Ops::Verification_with_Hash::is_valid_signature |
( |
std::span< const uint8_t > | sig | ) |
|
|
overridevirtual |
Perform a verification operation
- Parameters
-
sig | the signature to be checked with respect to the input |
Implements Botan::PK_Ops::Verification.
Definition at line 193 of file pk_ops.cpp.
193 {
194 const std::vector<uint8_t> msg = m_hash->final_stdvec();
196}
virtual bool verify(std::span< const uint8_t > msg, std::span< const uint8_t > sig)=0
◆ update()
void Botan::PK_Ops::Verification_with_Hash::update |
( |
std::span< const uint8_t > | input | ) |
|
|
overridevirtual |
Add more data to the message currently being signed
- Parameters
-
input | the input to be hashed/verified |
Implements Botan::PK_Ops::Verification.
Definition at line 189 of file pk_ops.cpp.
189 {
190 m_hash->update(msg);
191}
◆ verify()
virtual bool Botan::PK_Ops::Verification_with_Hash::verify |
( |
std::span< const uint8_t > | msg, |
|
|
std::span< const uint8_t > | sig ) |
|
protectedpure virtual |
Perform a signature check operation
- Parameters
-
msg | the message |
sig | the signature |
- Returns
- if sig is a valid signature for msg
The documentation for this class was generated from the following files: