#pragma once #include #ifdef AECRXBASE_EXPORT #define AECDLLIMPEXP __declspec(dllexport) #else #define AECDLLIMPEXP __declspec(dllimport) #endif class AECDLLIMPEXP Base64 { public: static std::string EncodeF2S(CFile *pFile); static std::string Encode(const char *pBuffer, const ULONGLONG &length); static std::string Encode(const std::string &plaintext); static std::string Decode(const std::string &ciphertext); static ULONGLONG Decode(const std::string &ciphertext, char *&pBuffer); static ULONGLONG DecodeS2F(const std::string &ciphertext, CFile *pFile); public: /*注意: plaintext 会在内部转成 utf-8 格式进行base64编码 ciphertext 实际上是ANSII编码,会在内部转为ANSII码 */ static std::wstring Encode(const std::wstring &plaintext); static std::wstring Decode(const std::wstring &ciphertext); static std::wstring EncodeF2W(CFile *pFile); static ULONGLONG DecodeW2F(const std::wstring &ciphertext, CFile *pFile); static std::string unicode2Ansii(LPCTSTR psz, const DWORD &codePage); static std::wstring ansii2Unicode(LPCSTR psz, const DWORD &codePage); };