base64.h 1.22 KB
Newer Older
1
/*
2
 *  Copyright (C) 2004-2019 Savoir-faire Linux Inc.
3 4 5 6 7
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
8
 *
9 10 11 12 13 14 15 16 17 18
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
 */

19
#pragma once
20

21 22
#include <stdint.h>
#include <stddef.h>
23

Guillaume Roguez's avatar
Guillaume Roguez committed
24 25
#include <string>
#include <vector>
26
#include <exception>
Guillaume Roguez's avatar
Guillaume Roguez committed
27

Adrien Béraud's avatar
Adrien Béraud committed
28
namespace jami {
Guillaume Roguez's avatar
Guillaume Roguez committed
29 30
namespace base64 {

31 32
class base64_exception : public std::exception { };

33 34 35
std::string encode(const std::vector<uint8_t>::const_iterator begin, const std::vector<uint8_t>::const_iterator end);
std::string encode(const std::vector<uint8_t>& dat);
std::vector<uint8_t> decode(const std::string& str);
Guillaume Roguez's avatar
Guillaume Roguez committed
36

Adrien Béraud's avatar
Adrien Béraud committed
37
}} // namespace jami::base64