about summary refs log tree commit diff stats
path: root/archive/2025/summer/bsc_karidas/include/Crypto.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'archive/2025/summer/bsc_karidas/include/Crypto.hpp')
-rw-r--r--archive/2025/summer/bsc_karidas/include/Crypto.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/archive/2025/summer/bsc_karidas/include/Crypto.hpp b/archive/2025/summer/bsc_karidas/include/Crypto.hpp
new file mode 100644
index 000000000..53e5fa12e
--- /dev/null
+++ b/archive/2025/summer/bsc_karidas/include/Crypto.hpp
@@ -0,0 +1,33 @@
+#ifndef CRYPTO_HPP
+#define CRYPTO_HPP
+
+#include <vector>
+#include <string>
+#include <cstdint>
+#include <memory>
+#include <openssl/evp.h>
+
+class Crypto
+{
+private:
+    EVP_CIPHER_CTX *m_encryptCtx;
+    EVP_CIPHER_CTX *m_decryptCtx;
+
+public:
+    Crypto();
+    ~Crypto();
+
+    static constexpr size_t KEY_SIZE = 32;     // 256 bits
+    static constexpr size_t GCM_IV_SIZE = 12;  // 96 bits (recommended for GCM)
+    static constexpr size_t GCM_TAG_SIZE = 16; // 128 bits
+
+    std::vector<uint8_t> encrypt(std::vector<uint8_t> &&plaintext,
+                                 const std::vector<uint8_t> &key,
+                                 const std::vector<uint8_t> &iv);
+
+    std::vector<uint8_t> decrypt(const std::vector<uint8_t> &encryptedData,
+                                 const std::vector<uint8_t> &key,
+                                 const std::vector<uint8_t> &iv);
+};
+
+#endif
\ No newline at end of file