8#include <botan/tls_alert.h>
9#include <botan/tls_exceptn.h>
17 ") for TLS alert message");
19 if(buf[0] == 1) m_fatal =
false;
20 else if(buf[0] == 2) m_fatal =
true;
22 throw TLS_Exception(Alert::IllegalParameter,
"Bad code for TLS alert level");
24 const uint8_t dc = buf[1];
26 m_type_code =
static_cast<Type>(dc);
31 return std::vector<uint8_t>({
32 static_cast<uint8_t
>(
is_fatal() ? 2 : 1),
33 static_cast<uint8_t
>(
type())
39const char* alert_type_to_string(
AlertType type)
44 return "close_notify";
46 return "unexpected_message";
48 return "bad_record_mac";
50 return "decryption_failed";
52 return "record_overflow";
54 return "decompression_failure";
56 return "handshake_failure";
58 return "no_certificate";
60 return "bad_certificate";
62 return "unsupported_certificate";
64 return "certificate_revoked";
66 return "certificate_expired";
68 return "certificate_unknown";
70 return "illegal_parameter";
74 return "access_denied";
76 return "decode_error";
78 return "decrypt_error";
80 return "export_restriction";
82 return "protocol_version";
84 return "insufficient_security";
86 return "internal_error";
88 return "inappropriate_fallback";
90 return "user_canceled";
92 return "no_renegotiation";
94 return "missing_extension";
96 return "unsupported_extension";
98 return "certificate_unobtainable";
100 return "unrecognized_name";
102 return "bad_certificate_status_response";
104 return "bad_certificate_hash_value";
106 return "unknown_psk_identity";
108 return "certificate_required";
110 return "no_application_protocol";
123 if(
const char* known_alert = alert_type_to_string(
type()))
124 return std::string(known_alert);
126 return "unrecognized_alert_" + std::to_string(
static_cast<size_t>(
type()));
std::vector< uint8_t > serialize() const
std::string type_string() const
@ BadCertificateHashValue
@ BadCertificateStatusResponse
@ CertificateUnobtainable
std::vector< T, secure_allocator< T > > secure_vector