Botan 3.3.0
Crypto and TLS for C&
Public Member Functions | Protected Attributes | List of all members
Botan::TLS::Certificate_Verify Class Reference

#include <tls_messages.h>

Inheritance diagram for Botan::TLS::Certificate_Verify:
Botan::TLS::Handshake_Message Botan::TLS::Certificate_Verify_12 Botan::TLS::Certificate_Verify_13

Public Member Functions

 Certificate_Verify ()=default
 
 Certificate_Verify (const std::vector< uint8_t > &buf)
 
std::vector< uint8_t > serialize () const override
 
Signature_Scheme signature_scheme () const
 
Handshake_Type type () const override
 
std::string type_string () const
 
virtual Handshake_Type wire_type () const
 

Protected Attributes

Signature_Scheme m_scheme
 
std::vector< uint8_t > m_signature
 

Detailed Description

Definition at line 758 of file tls_messages.h.

Constructor & Destructor Documentation

◆ Certificate_Verify() [1/2]

Botan::TLS::Certificate_Verify::Certificate_Verify ( const std::vector< uint8_t > & buf)

Definition at line 45 of file msg_cert_verify.cpp.

45 {
46 TLS_Data_Reader reader("CertificateVerify", buf);
47
48 m_scheme = Signature_Scheme(reader.get_uint16_t());
49 m_signature = reader.get_range<uint8_t>(2, 0, 65535);
50 reader.assert_done();
51
52 if(!m_scheme.is_set()) {
53 throw Decoding_Error("Counterparty did not send hash/sig IDS");
54 }
55}
std::vector< uint8_t > m_signature

References Botan::TLS::TLS_Data_Reader::assert_done(), Botan::TLS::TLS_Data_Reader::get_range(), Botan::TLS::TLS_Data_Reader::get_uint16_t(), Botan::TLS::Signature_Scheme::is_set(), m_scheme, and m_signature.

◆ Certificate_Verify() [2/2]

Botan::TLS::Certificate_Verify::Certificate_Verify ( )
default

Member Function Documentation

◆ serialize()

std::vector< uint8_t > Botan::TLS::Certificate_Verify::serialize ( ) const
overridevirtual
Returns
DER representation of this message

Implements Botan::TLS::Handshake_Message.

Definition at line 60 of file msg_cert_verify.cpp.

60 {
62 std::vector<uint8_t> buf;
63 buf.reserve(2 + 2 + m_signature.size()); // work around GCC warning
64
65 const auto code = m_scheme.wire_code();
66 buf.push_back(get_byte<0>(code));
67 buf.push_back(get_byte<1>(code));
68
69 if(m_signature.size() > 0xFFFF) {
70 throw Encoding_Error("Certificate_Verify signature too long to encode");
71 }
72
73 const uint16_t sig_len = static_cast<uint16_t>(m_signature.size());
74 buf.push_back(get_byte<0>(sig_len));
75 buf.push_back(get_byte<1>(sig_len));
76 buf += m_signature;
77
78 return buf;
79}
#define BOTAN_ASSERT_NOMSG(expr)
Definition assert.h:59
Signature_Scheme::Code wire_code() const noexcept

References BOTAN_ASSERT_NOMSG, Botan::TLS::Signature_Scheme::is_set(), m_scheme, m_signature, and Botan::TLS::Signature_Scheme::wire_code().

◆ signature_scheme()

Signature_Scheme Botan::TLS::Certificate_Verify::signature_scheme ( ) const
inline

Definition at line 762 of file tls_messages.h.

762{ return m_scheme; }

◆ type()

Handshake_Type Botan::TLS::Certificate_Verify::type ( ) const
inlineoverridevirtual
Returns
the message type

Implements Botan::TLS::Handshake_Message.

Definition at line 760 of file tls_messages.h.

◆ type_string()

std::string Botan::TLS::Handshake_Message::type_string ( ) const
inherited
Returns
string representation of this message type

Definition at line 19 of file tls_handshake_state.cpp.

19 {
21}
virtual Handshake_Type type() const =0
const char * handshake_type_to_string(Handshake_Type type)

References Botan::TLS::handshake_type_to_string(), and Botan::TLS::Handshake_Message::type().

◆ wire_type()

virtual Handshake_Type Botan::TLS::Handshake_Message::wire_type ( ) const
inlinevirtualinherited
Returns
the wire representation of the message's type

Reimplemented in Botan::TLS::Hello_Retry_Request.

Definition at line 39 of file tls_handshake_msg.h.

39 {
40 // Usually equal to the Handshake_Type enum value,
41 // with the exception of TLS 1.3 Hello Retry Request.
42 return type();
43 }

Referenced by Botan::TLS::Stream_Handshake_IO::send().

Member Data Documentation

◆ m_scheme

Signature_Scheme Botan::TLS::Certificate_Verify::m_scheme
protected

◆ m_signature

std::vector<uint8_t> Botan::TLS::Certificate_Verify::m_signature
protected

The documentation for this class was generated from the following files: