-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencryption.hpp
More file actions
31 lines (24 loc) · 788 Bytes
/
Copy pathencryption.hpp
File metadata and controls
31 lines (24 loc) · 788 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
30
31
#ifndef ENCRYPTION_HPP
#define ENCRYPTION_HPP
#include <string>
#include <vector>
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
class Encryption {
public:
// Initialize encryption with a password
static bool initialize(const std::string& password);
// Encrypt a string
static std::string encrypt(const std::string& plaintext);
// Decrypt a string
static std::string decrypt(const std::string& ciphertext);
private:
static const int KEY_SIZE = 32; // 256 bits
static const int IV_SIZE = 16; // 128 bits
static std::vector<unsigned char> key;
static bool initialized;
// Derive key from password using PBKDF2
static bool deriveKey(const std::string& password);
};
#endif // ENCRYPTION_HPP