Files
2024-09-23 12:00:04 -04:00

51 lines
2.0 KiB
C++

#pragma once
/*
* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
*
* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
* and international copyright treaties.
*
* Access to and use of the software is governed by the terms of the applicable OnixS Software
* Services Agreement (the Agreement) and Customer end user license agreements granting
* a non-assignable, non-transferable and non-exclusive license to use the software
* for it's own data processing purposes under the terms defined in the Agreement.
*
* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
* of this source code or associated reference material to any other location for further reproduction
* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
*
* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
* the terms of the Agreement is a violation of copyright law.
*/
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Cryptography/Definitions.h>
#include <string>
namespace OnixS {
namespace Cryptography {
/// The BASE64 encoding service.
class ONIXS_FIXENGINE_API Base64Encoding
{
public:
/// Returns the BASE64 presentation of the binary data.
/// @note Encoding throws nothing.
static std::string encode(const void * data, const size_t dataSize);
/// Reconstructs the binary data from the BASE64-encoded text.
/// @throw An exception if the text is corrupted or not BASE64-encoded.
static void decode(ByteArray & decoded, const std::string & encoded);
/// Returns the BASE64URL presentation of the binary data.
/// @note Encoding throws nothing.
static std::string encodeUrl(const void * data, const size_t dataSize);
/// Reconstructs the binary data from the BASE64URL-encoded text.
/// @throw An exception if the text is corrupted or not BASE64URL-encoded.
static void decodeUrl(ByteArray & decoded, const std::string & encoded);
};
}
}