2 #ifndef ENIGMA_CRYPTOPP_UTILS_H
3 #define ENIGMA_CRYPTOPP_UTILS_H
16 static const std::string
GetErrorString(
const enum CryptoPP::Exception::ErrorType error_type) noexcept {
17 #define CASE_RETURN(e) \
18 case CryptoPP::Exception::ErrorType::e: \
41 static const std::string
GetErrorReason(
const enum CryptoPP::Exception::ErrorType error_type) {
42 using ErrorType = CryptoPP::Exception::ErrorType;
43 #define CASE_RETURN(c, ret) \
48 CASE_RETURN(ErrorType::INVALID_ARGUMENT,
"An invalid argument was detected");
49 CASE_RETURN(ErrorType::CANNOT_FLUSH,
"BufferedTransformation received a Flush(true) signal but can't flush buffers");
50 CASE_RETURN(ErrorType::DATA_INTEGRITY_CHECK_FAILED,
"Data integerity check, such as CRC or MAC, failed");
51 CASE_RETURN(ErrorType::INVALID_DATA_FORMAT,
"Input data was received that did not conform to expected format");
52 CASE_RETURN(ErrorType::IO_ERROR,
"Error reading from input device or writing to output device");
54 return "<unknown crypto++ error>";
60 std::ostringstream oss{};
62 <<
"Message: " << e.GetWhat() <<
'\n'
#define NS_ENIGMA_BEGIN
Enable/Disable Assertions.
static const std::string GetErrorString(const enum CryptoPP::Exception::ErrorType error_type) noexcept
static const std::string GetFullErrorMessage(const CryptoPP::Exception &e)
static const std::string GetErrorReason(const enum CryptoPP::Exception::ErrorType error_type)