Cryptography WIP
This commit is contained in:
25
Password_manager/include/Buffer.h
Normal file
25
Password_manager/include/Buffer.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class Buffer
|
||||
{
|
||||
public:
|
||||
unsigned char* buffer = nullptr;
|
||||
size_t size = 0;
|
||||
Buffer(size_t size)
|
||||
{
|
||||
this->size = size;
|
||||
this->buffer = new unsigned char[size];
|
||||
}
|
||||
|
||||
Buffer() {
|
||||
size = 0;
|
||||
buffer = nullptr;
|
||||
}
|
||||
|
||||
~Buffer()
|
||||
{
|
||||
if (buffer) delete[] buffer;
|
||||
}
|
||||
|
||||
};
|
@@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
bool put_data_on_clipboard(const char* text);
|
23
Password_manager/include/cryptography.h
Normal file
23
Password_manager/include/cryptography.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
struct evp_cipher_ctx_st;
|
||||
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
|
||||
|
||||
|
||||
class Cryptography
|
||||
{
|
||||
public:
|
||||
Cryptography(const char* password);
|
||||
~Cryptography();
|
||||
int encrypt(uint8_t* input_buffer, int32_t input_buffer_size);
|
||||
int decrypt(uint8_t* input_buffer);
|
||||
|
||||
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);
|
||||
void handleErrors();
|
||||
};
|
4
Password_manager/include/win.h
Normal file
4
Password_manager/include/win.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
bool put_data_on_clipboard(const char* text);
|
||||
std::string get_passwd();
|
Reference in New Issue
Block a user