summaryrefslogtreecommitdiffstats
path: root/Cryptor.h
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-10-22 02:45:53 -0400
committerMalfurious <m@lfurio.us>2024-10-24 06:41:41 -0400
commitd96e828be83f7adf0fe88001da865169cfd573c7 (patch)
tree5f595c21b371d9ad27d0f04aa65d53838b1b5419 /Cryptor.h
parentd1aea038b08db11d5f12132b2842aba5fff8dd5a (diff)
downloadcompass-d96e828be83f7adf0fe88001da865169cfd573c7.tar.gz
compass-d96e828be83f7adf0fe88001da865169cfd573c7.zip
Refactor AES functions to use mbedtls
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'Cryptor.h')
-rw-r--r--Cryptor.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/Cryptor.h b/Cryptor.h
index 8ba1c16..1fcac36 100644
--- a/Cryptor.h
+++ b/Cryptor.h
@@ -4,6 +4,7 @@
#include <iostream>
#include <string>
#include <fstream>
+#include <vector>
#ifdef WIN32
#include <windows.h>
@@ -12,17 +13,16 @@
#include <unistd.h>
#endif // WIN32
-#include "cryptopp562/osrng.h"
-#include "cryptopp562/cryptlib.h"
-#include "cryptopp562/hex.h"
-#include "cryptopp562/filters.h"
-#include "cryptopp562/aes.h"
-#include "cryptopp562/ccm.h"
+#include "mbedtls/cipher.h"
+#include "mbedtls/ctr_drbg.h"
+#include "mbedtls/entropy.h"
#include "Socket.h"
#define DEF_PASSWD_LENGTH 50
+#define AES_BLOCK_LENGTH 16
+
#define KEYCHAIN_FILE ".compasskeychain"
#define PASSWORD_PROMPT "ComPASS Password: "
#define PASSWORD_CONF "Confirm Password: "
@@ -49,9 +49,10 @@ public:
private:
static bool haveKey;
- static unsigned char key[CryptoPP::AES::DEFAULT_KEYLENGTH];
+ static unsigned char key[AES_BLOCK_LENGTH];
static void sha256(std::string str);
+ static void generateRandom(void *output, size_t size);
static std::string readPassword(bool confirm);
static std::string readPassword();
static void assembleKey(bool confirm);