10#include <botan/tls_messages_13.h>
12#include <botan/credentials_manager.h>
13#include <botan/pk_keys.h>
14#include <botan/tls_callbacks.h>
15#include <botan/tls_exceptn.h>
16#include <botan/tls_policy.h>
17#include <botan/internal/stl_util.h>
24 std::vector<uint8_t> msg(64, 0x20);
25 msg.reserve(64 + 33 + 1 + hash.size());
28 :
"TLS 1.3, client CertificateVerify";
30 msg.insert(msg.end(), context_string.cbegin(), context_string.cend());
33 msg.insert(msg.end(), hash.cbegin(), hash.cend());
38 const std::vector<Signature_Scheme>& allowed_schemes,
39 const std::vector<Signature_Scheme>& peer_allowed_schemes) {
41 if(scheme.is_available() && scheme.is_suitable_for(key) &&
value_exists(peer_allowed_schemes, scheme)) {
46 throw TLS_Exception(Alert::HandshakeFailure,
"Failed to agree on a signature algorithm");
55 const std::vector<Signature_Scheme>& peer_allowed_schemes,
56 std::string_view hostname,
67 const auto context = std::string(hostname);
73 throw TLS_Exception(Alert::InternalError,
"Application did not provide a private key for its credential");
81 *private_key, rng,
m_scheme.padding_string(),
m_scheme.format().value(), message(m_side, hash));
87 throw TLS_Exception(Alert::IllegalParameter,
"Peer sent unknown signature scheme");
90 if(!
m_scheme.is_compatible_with(Protocol_Version::TLS_V13)) {
91 throw TLS_Exception(Alert::IllegalParameter,
"Peer sent signature algorithm that is not suitable for TLS 1.3");
107 throw TLS_Exception(Alert::IllegalParameter,
"Signature algorithm does not match certificate's public key");
113#if defined(BOTAN_UNSAFE_FUZZER_MODE)
117 return signature_valid;
#define BOTAN_ASSERT_NOMSG(expr)
virtual std::shared_ptr< Private_Key > private_key_for(const X509_Certificate &cert, const std::string &type, const std::string &context)
virtual AlgorithmIdentifier algorithm_identifier() const =0
virtual std::vector< uint8_t > tls_sign_message(const Private_Key &key, RandomNumberGenerator &rng, std::string_view padding, Signature_Format format, const std::vector< uint8_t > &msg)
virtual bool tls_verify_message(const Public_Key &key, std::string_view padding, Signature_Format format, const std::vector< uint8_t > &msg, const std::vector< uint8_t > &sig)
const X509_Certificate & leaf() const
std::shared_ptr< const Public_Key > public_key() const
bool has_certificate_chain() const
bool verify(const Public_Key &public_key, Callbacks &callbacks, const Transcript_Hash &transcript_hash) const
Certificate_Verify_13(const std::vector< uint8_t > &buf, Connection_Side side)
Signature_Scheme m_scheme
Certificate_Verify(const std::vector< uint8_t > &buf)
std::vector< uint8_t > m_signature
virtual std::vector< Signature_Scheme > allowed_signature_schemes() const
std::vector< uint8_t > Transcript_Hash
bool value_exists(const std::vector< T > &vec, const V &val)