Files
clients/aesclass/aesclass.h
admin eb22d21bac 암호화모듈 추가
git-svn-id: svn://192.168.0.12/source@276 8346c931-da38-4b9b-9d4c-e48b93cbd075
2016-06-07 10:07:14 +00:00

44 lines
1.2 KiB
C++

#ifndef AESCLASS
#define AESCLASS
#include <iomanip>
#include "../cryptopp563/cryptlib.h"
#include "../cryptopp563/modes.h"
#include "../cryptopp563/aes.h"
#include "../cryptopp563/filters.h"
#include "../cryptopp563/base64.h"
#include <string>
class AESClass
{
private:
byte key[CryptoPP::AES::DEFAULT_KEYLENGTH];
byte iv[CryptoPP::AES::BLOCKSIZE];
public:
AESClass();
~AESClass();
void setKey(byte* _key);
void setKey(const char *_key);
void setKey(std::string _key);
void setIv(byte* _iv);
void setIv(const char *_iv);
void setIv(std::string _iv);
const byte* getKey() const;
const byte* getIv() const;
const int getKeyLength() const;
const int getBlockSize() const;
std::string AESEncrypt(std::string plaintext);
std::string AESEncrypt(char *_plaintext);
std::string AESDecrypt(byte* _ciphertext);
std::string AESDecrypt(std::string _ciphertext);
static void hex2byte(const char *in, unsigned int len, byte *out);
static std::string toBase64(byte* _ciphertext);
static std::string toBase64(std::string _ciphertext);
void base64toByte(std::string text, byte* out);
std::string base64toString(std::string text);
};
#endif // AESCLASS