mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
31 lines
690 B
C++
31 lines
690 B
C++
#include <string>
|
|
#ifdef _WIN32
|
|
#include <aes.h>
|
|
#include <sha.h>
|
|
#include <modes.h>
|
|
#else
|
|
#include <crypto++/aes.h>
|
|
#include <crypto++/sha.h>
|
|
#include <crypto++/modes.h>
|
|
#endif
|
|
|
|
#include "IAESEncryption.h"
|
|
|
|
class AESEncryption : public IAESEncryption
|
|
{
|
|
public:
|
|
AESEncryption(const std::string &password, bool hash_password);
|
|
~AESEncryption();
|
|
|
|
std::string encrypt(const std::string &data);
|
|
virtual std::string encrypt(char *data, size_t data_size);
|
|
virtual std::string encrypt(const char *data, size_t data_size);
|
|
|
|
private:
|
|
|
|
bool iv_done;
|
|
CryptoPP::SecByteBlock m_sbbKey;
|
|
CryptoPP::SecByteBlock m_IV;
|
|
|
|
CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption *enc;
|
|
}; |