add cryptopp lib

This commit is contained in:
lucaspalomodevelop 2023-10-19 18:24:34 +02:00
parent b110973917
commit 3570ecefe2
3 changed files with 32 additions and 1 deletions

1
libs/cryptopp Submodule

@ -0,0 +1 @@
Subproject commit af7d1050bf2287072edd629be133da458a3cf978

View File

@ -111,12 +111,18 @@ void runScript(int argc, char *argv[])
}
// encrypt a script in the autom directory
std::string encrypt(std::string content, std::string pass)
{
}
void encryptScript(int argc, char *argv[])
{
std::string password = "";
std::string password2 = "";
std::string script = home_dir + "/" + argv[1];
std::string scriptContent = "";
std::string encryptScriptContent = "CRYPT;AES256\n";
std::cout << "encrypting file " << script << std::endl;
std::cout << "Enter password: ";
password = EnterPassword();
@ -140,9 +146,24 @@ void encryptScript(int argc, char *argv[])
std::cout << "Script " << argv[1] << " does not exist" << std::endl;
return;
}
std::fstream file(script);
std::string line;
while (getline(file, line))
{
scriptContent += line + "\n";
}
file.close();
encryptScriptContent += encrypt(scriptContent, password);
}
// encrypt a script in the autom directory
std::string decrypt(std::string content, std::string pass)
{
}
void decryptScript(int argc, char *argv[])
{
std::cout << "decrypting file " << argv[1] << std::endl;

View File

@ -10,6 +10,13 @@
#include <fstream>
#include <conio.h>
#include "../libs/cryptopp/cryptlib.h"
#include "../libs/cryptopp/rijndael.h"
#include "../libs/cryptopp/modes.h"
#include "../libs/cryptopp/files.h"
#include "../libs/cryptopp/osrng.h"
#include "../libs/cryptopp/hex.h"
#include "inputparser.h"
#include "command.h"
#include "settings.h"
@ -35,8 +42,10 @@ void removeScript(int argc, char *argv[]);
// show a script in the autom directory
void showScript(int argc, char *argv[]);
// encrypt a script in the autom directory
std::string encrypt(std::string content, std::string pass);
void encryptScript(int argc, char *argv[]);
// decrypt a script in the autom directory
std::string decrypt(std::string content, std::string pass);
void decryptScript(int argc, char *argv[]);
std::string EnterPassword();