1 /* 2 * ModSecurity, http://www.modsecurity.org/ 3 * Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/) 4 * 5 * You may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * If any of the files related to licensing are missing or if you have any 11 * other questions related to licensing please contact Trustwave Holdings, Inc. 12 * directly using the email address security@modsecurity.org. 13 * 14 */ 15 16 17 #ifndef SRC_UTILS_BASE64_H_ 18 #define SRC_UTILS_BASE64_H_ 19 20 #include <string> 21 22 namespace modsecurity { 23 namespace Utils { 24 25 class Base64 { 26 public: Base64()27 Base64() { } 28 29 static std::string encode(const std::string& data); 30 31 static std::string decode(const std::string& data, bool forgiven); 32 static std::string decode(const std::string& data); 33 static std::string decode_forgiven(const std::string& data); 34 35 static void decode_forgiven_engine(unsigned char *plain_text, 36 size_t plain_text_size, size_t *aiming_size, 37 const unsigned char *encoded, 38 size_t input_len); 39 }; 40 41 42 } // namespace Utils 43 } // namespace modsecurity 44 45 #endif // SRC_UTILS_BASE64_H_ 46 47