-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFileEncryptor.hpp
More file actions
29 lines (22 loc) · 801 Bytes
/
Copy pathFileEncryptor.hpp
File metadata and controls
29 lines (22 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# pragma once
#include <cryptopp/aes.h>
#include <cryptopp/crc.h>
#include <cryptopp/hex.h>
#include <cryptopp/modes.h>
#include <tuple>
using CryptoPP::byte;
class FileEncryptor
{
public:
FileEncryptor(const std::string &keyHex, const std::string &inputFileName);
void decryptToFile(const std::string &cipherText,
const std::string &outputFileName);
std::string decryptString(const std::string &encryptedContent);
std::tuple<std::string, uint32_t> encryptAndComputeCRC();
private:
CryptoPP::byte key_[CryptoPP::AES::DEFAULT_KEYLENGTH];
CryptoPP::byte iv_[CryptoPP::AES::BLOCKSIZE];
std::string inputFileName_;
std::string decryptToString(const std::string &cipherText, const byte *key,
const byte *iv);
};