From 5a8727e34b938b70623ca865273fd81c7604b461 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 13 Mar 2018 06:26:06 +0100 Subject: Expose include dir --- include/Encryption.hpp | 64 -------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 include/Encryption.hpp (limited to 'include/Encryption.hpp') diff --git a/include/Encryption.hpp b/include/Encryption.hpp deleted file mode 100644 index 4697b35..0000000 --- a/include/Encryption.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -/* - * Encrypts/decrypts data using xchacha20-poly1305 ietf - */ - -#include "DataView.hpp" -#include "utils.hpp" -#include -#include - -namespace odhtdb -{ - const int NONCE_BYTE_SIZE = 24; - const int KEY_BYTE_SIZE = 32; - - class EncryptionException : public std::runtime_error - { - public: - EncryptionException(const std::string &errMsg) : std::runtime_error(errMsg) {} - }; - - class DecryptionException : public std::runtime_error - { - public: - DecryptionException(const std::string &errMsg) : std::runtime_error(errMsg) {} - }; - - class Encryption - { - DISABLE_COPY(Encryption) - public: - // Throws EncryptionException on failure (or std::bad_alloc on failed memory allocation) - Encryption(const DataView &data, const DataView &additionalData = DataView(), const DataView &key = DataView()); - ~Encryption(); - - DataView getKey() const; - DataView getNonce() const; - DataView getCipherText() const; - private: - unsigned char key[KEY_BYTE_SIZE]; - unsigned char nonce[NONCE_BYTE_SIZE]; - unsigned char *cipherText; - unsigned long long cipherTextLength; - }; - - class Decryption - { - DISABLE_COPY(Decryption) - public: - Decryption() : decryptedText(nullptr), decryptedTextLength(0) {} - - // Throws DecryptionException on failure - Decryption(const DataView &data, const DataView &nonce, const DataView &key); - Decryption(Decryption &&other); - Decryption& operator=(Decryption &&other); - ~Decryption(); - - DataView getDecryptedText() const; - private: - unsigned char *decryptedText; - unsigned long long decryptedTextLength; - }; -} -- cgit v1.2.3