3
* (C) 2004-2006,2011,2012 Jack Lloyd
5
* Botan is released under the Simplified BSD License (see license.txt)
8
#ifndef BOTAN_TLS_ALERT_H_
9
#define BOTAN_TLS_ALERT_H_
11
#include <botan/secmem.h>
19
* SSL/TLS Alert Message
21
class BOTAN_PUBLIC_API(2,0) Alert final
25
* Type codes for TLS alerts
29
UNEXPECTED_MESSAGE = 10,
31
DECRYPTION_FAILED = 21,
33
DECOMPRESSION_FAILURE = 30,
34
HANDSHAKE_FAILURE = 40,
35
NO_CERTIFICATE = 41, // SSLv3 only
37
UNSUPPORTED_CERTIFICATE = 43,
38
CERTIFICATE_REVOKED = 44,
39
CERTIFICATE_EXPIRED = 45,
40
CERTIFICATE_UNKNOWN = 46,
41
ILLEGAL_PARAMETER = 47,
46
EXPORT_RESTRICTION = 60,
47
PROTOCOL_VERSION = 70,
48
INSUFFICIENT_SECURITY = 71,
50
INAPPROPRIATE_FALLBACK = 86,
52
NO_RENEGOTIATION = 100,
53
UNSUPPORTED_EXTENSION = 110,
54
CERTIFICATE_UNOBTAINABLE = 111,
55
UNRECOGNIZED_NAME = 112,
56
BAD_CERTIFICATE_STATUS_RESPONSE = 113,
57
BAD_CERTIFICATE_HASH_VALUE = 114,
58
UNKNOWN_PSK_IDENTITY = 115,
60
NO_APPLICATION_PROTOCOL = 120, // RFC 7301
62
// pseudo alert values
67
* @return true iff this alert is non-empty
69
bool is_valid() const { return (m_type_code != NULL_ALERT); }
72
* @return if this alert is a fatal one or not
74
bool is_fatal() const { return m_fatal; }
77
* @return type of alert
79
Type type() const { return m_type_code; }
82
* @return type of alert
84
std::string type_string() const;
89
std::vector<uint8_t> serialize() const;
92
* Deserialize an Alert message
93
* @param buf the serialized alert
95
explicit Alert(const secure_vector<uint8_t>& buf);
99
* @param type_code the type of alert
100
* @param fatal specifies if this is a fatal alert
102
Alert(Type type_code, bool fatal = false) :
103
m_fatal(fatal), m_type_code(type_code) {}
105
Alert() : m_fatal(false), m_type_code(NULL_ALERT) {}