diff options
author | Malfurious <m@lfurio.us> | 2024-10-22 02:45:53 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-10-24 06:41:41 -0400 |
commit | d96e828be83f7adf0fe88001da865169cfd573c7 (patch) | |
tree | 5f595c21b371d9ad27d0f04aa65d53838b1b5419 /Cryptor.h | |
parent | d1aea038b08db11d5f12132b2842aba5fff8dd5a (diff) | |
download | compass-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.h | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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);
|