4
* Botan is released under the Simplified BSD License (see license.txt)
7
#include <botan/exceptn.h>
11
Exception::Exception(const std::string& msg) : m_msg(msg)
14
Exception::Exception(const char* prefix, const std::string& msg) :
15
m_msg(std::string(prefix) + " " + msg)
18
Invalid_Argument::Invalid_Argument(const std::string& msg) :
19
Exception("Invalid argument", msg)
22
Invalid_Argument::Invalid_Argument(const std::string& msg, const std::string& where) :
23
Exception("Invalid argument", msg + " in " + where)
26
Lookup_Error::Lookup_Error(const std::string& type,
27
const std::string& algo,
28
const std::string& provider) :
29
Exception("Unavailable " + type + " " + algo +
30
(provider.empty() ? std::string("") : (" for provider " + provider)))
33
Internal_Error::Internal_Error(const std::string& err) :
34
Exception("Internal error: " + err)
37
Invalid_Key_Length::Invalid_Key_Length(const std::string& name, size_t length) :
38
Invalid_Argument(name + " cannot accept a key of length " +
39
std::to_string(length))
42
Invalid_IV_Length::Invalid_IV_Length(const std::string& mode, size_t bad_len) :
43
Invalid_Argument("IV length " + std::to_string(bad_len) +
44
" is invalid for " + mode)
47
Key_Not_Set::Key_Not_Set(const std::string& algo) :
48
Invalid_State("Key not set in " + algo)
51
Policy_Violation::Policy_Violation(const std::string& err) :
52
Invalid_State("Policy violation: " + err) {}
54
PRNG_Unseeded::PRNG_Unseeded(const std::string& algo) :
55
Invalid_State("PRNG not seeded: " + algo)
58
Algorithm_Not_Found::Algorithm_Not_Found(const std::string& name) :
59
Lookup_Error("Could not find any algorithm named \"" + name + "\"")
62
No_Provider_Found::No_Provider_Found(const std::string& name) :
63
Exception("Could not find any provider for algorithm named \"" + name + "\"")
66
Provider_Not_Found::Provider_Not_Found(const std::string& algo, const std::string& provider) :
67
Lookup_Error("Could not find provider '" + provider + "' for " + algo)
70
Invalid_Algorithm_Name::Invalid_Algorithm_Name(const std::string& name):
71
Invalid_Argument("Invalid algorithm name: " + name)
74
Encoding_Error::Encoding_Error(const std::string& name) :
75
Invalid_Argument("Encoding error: " + name)
78
Decoding_Error::Decoding_Error(const std::string& name) :
79
Invalid_Argument("Decoding error: " + name)
82
Decoding_Error::Decoding_Error(const std::string& name, const char* exception_message) :
83
Invalid_Argument("Decoding error: " + name + " failed with exception " + exception_message) {}
85
Integrity_Failure::Integrity_Failure(const std::string& msg) :
86
Exception("Integrity failure: " + msg)
89
Invalid_OID::Invalid_OID(const std::string& oid) :
90
Decoding_Error("Invalid ASN.1 OID: " + oid)
93
Stream_IO_Error::Stream_IO_Error(const std::string& err) :
94
Exception("I/O error: " + err)
97
Self_Test_Failure::Self_Test_Failure(const std::string& err) :
98
Internal_Error("Self test failed: " + err)
101
Not_Implemented::Not_Implemented(const std::string& err) :
102
Exception("Not implemented", err)