Działa szyfrowanie, generowanie klucza i zapisywanie klucza do pliku KEY
This commit is contained in:
parent
b80d983bc7
commit
8745ed2e19
7 changed files with 154 additions and 3 deletions
|
|
@ -4,6 +4,11 @@
|
|||
#include <vector>
|
||||
#include <array>
|
||||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <boost/crc.hpp>
|
||||
#include "DataStruct.h"
|
||||
|
||||
class EncryptionManager
|
||||
{
|
||||
|
|
@ -14,7 +19,14 @@ public:
|
|||
std::vector<char> encrypt(const std::vector<char>&);
|
||||
//std::vector<char> decrypt(const std::vector<char>&);
|
||||
|
||||
void saveKey(const std::string&);
|
||||
void loadKey(const std::string&);
|
||||
|
||||
private:
|
||||
std::array<unsigned char, crypto_stream_chacha20_ietf_KEYBYTES> key{};
|
||||
std::array<unsigned char, crypto_stream_chacha20_ietf_NONCEBYTES> nonce{};
|
||||
bool keyReady;
|
||||
|
||||
void generateKeys();
|
||||
uint16_t crc16(const std::vector<char>&);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue