20#ifndef ORES_SECURITY_CRYPTO_ENCRYPTION_HPP
21#define ORES_SECURITY_CRYPTO_ENCRYPTION_HPP
26namespace ores::security::crypto {
42 static constexpr size_t SALT_LEN = 16;
43 static constexpr size_t IV_LEN = 12;
44 static constexpr size_t TAG_LEN = 16;
45 static constexpr size_t KEY_LEN = 32;
46 static constexpr int PBKDF2_ITERATIONS = 600000;
54 static std::string
encrypt(
const std::string& plaintext,
55 const std::string& password);
64 static std::string
decrypt(
const std::string& encrypted_data,
65 const std::string& password);
74 const std::string& password);
77 static std::vector<unsigned char> derive_key(
78 const std::string& password,
79 const std::vector<unsigned char>& salt);
AES-256-GCM encryption service.
Definition encryption.hpp:40
static std::string encrypt(const std::string &plaintext, const std::string &password)
Encrypt plaintext using a password.
Definition encryption.cpp:48
static bool verify_password(const std::string &encrypted_data, const std::string &password)
Verify if a password can decrypt the given data.
Definition encryption.cpp:181
static std::string decrypt(const std::string &encrypted_data, const std::string &password)
Decrypt ciphertext using a password.
Definition encryption.cpp:114