diff --git a/Password_manager/include/cryptography.h b/Password_manager/include/cryptography.h index f03ce8f..07bdfdb 100644 --- a/Password_manager/include/cryptography.h +++ b/Password_manager/include/cryptography.h @@ -13,12 +13,11 @@ public: ~Cryptography(); bool encrypt(Buffer* plain, Buffer* encrypted); bool decrypt(Buffer* encrypted, Buffer* decrypted); + bool generate_key_and_iv_from_password(const char* password, size_t size); private: uint8_t key[32] = { 0 }; uint8_t iv[16] = { 0 }; EVP_CIPHER_CTX* ctx = nullptr; - - bool generate_key_and_iv_from_password(const char* password, size_t size); bool handleErrors(); }; diff --git a/Password_manager/include/func.h b/Password_manager/include/func.h index 7b98705..2f59dbb 100644 --- a/Password_manager/include/func.h +++ b/Password_manager/include/func.h @@ -20,6 +20,8 @@ enum class Args Delete, // delete password for label Print_all_p, // print all passwords Input, // input password for label + Change, // change main password + Show, // show password for label Error // error }; diff --git a/Password_manager/source/buffer.cpp b/Password_manager/source/buffer.cpp index 6507822..fcaf6b6 100644 --- a/Password_manager/source/buffer.cpp +++ b/Password_manager/source/buffer.cpp @@ -21,6 +21,7 @@ Buffer::~Buffer() bool Buffer::resize(size_t new_size) { + if(size >= new_size) return true; uint8_t* new_buffer = (uint8_t*)realloc(buffer, new_size); if (!new_buffer) { diff --git a/Password_manager/source/func.cpp b/Password_manager/source/func.cpp index fb1447e..27e7fe3 100644 --- a/Password_manager/source/func.cpp +++ b/Password_manager/source/func.cpp @@ -70,8 +70,10 @@ void print_usage() printf_s(" -g