2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2004-01-15 23:53:13 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2004-01-15 23:53:13 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2004-01-15 23:53:13 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2004-01-15 23:53:13 +00:00
|
|
|
|
2017-04-08 06:54:49 +00:00
|
|
|
#ifndef BOINC_BASE64_H
|
|
|
|
#define BOINC_BASE64_H
|
2004-01-15 23:53:13 +00:00
|
|
|
|
2004-06-13 23:17:33 +00:00
|
|
|
#ifndef _WIN32
|
2004-01-15 23:53:13 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <string>
|
2004-06-13 23:17:33 +00:00
|
|
|
#endif
|
2004-01-15 23:53:13 +00:00
|
|
|
|
2004-01-15 20:56:32 +00:00
|
|
|
class InvalidBase64Exception
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2016-06-13 02:20:55 +00:00
|
|
|
|
|
|
|
std::string r_base64_encode(const char* from, size_t length);
|
|
|
|
std::string r_base64_decode(const char* from, size_t length);
|
|
|
|
|
|
|
|
|
|
|
|
inline std::string r_base64_encode(std::string const& from)
|
|
|
|
{
|
|
|
|
return r_base64_encode(from.c_str(), from.length());
|
|
|
|
}
|
|
|
|
inline std::string r_base64_decode(std::string const& from)
|
2004-01-15 20:56:32 +00:00
|
|
|
{
|
|
|
|
return r_base64_decode(from.c_str(), from.length());
|
|
|
|
}
|
|
|
|
|
2004-01-15 23:53:13 +00:00
|
|
|
#endif
|