Implement GenerateKeyfile module
This commit is contained in:
parent
191b17c631
commit
93be4d9cdc
14
GCryptCLI/include/ModuleGenerateKeyfile.h
Normal file
14
GCryptCLI/include/ModuleGenerateKeyfile.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef GCRYPTCLI_MODULE_GENERATEKEYFILE_H
|
||||
#define GCRYPTCLI_MODULE_GENERATEKEYFILE_H
|
||||
|
||||
namespace Module {
|
||||
// This class has the task to prepare and supply the encryption key.
|
||||
class GenerateKeyfile {
|
||||
public:
|
||||
//! Will write the key to a file
|
||||
static void Run();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
17
GCryptCLI/src/ModuleGenerateKeyfile.cpp
Normal file
17
GCryptCLI/src/ModuleGenerateKeyfile.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "ModuleGenerateKeyfile.h"
|
||||
|
||||
#include "KeyManager.h"
|
||||
#include "CommandlineInterface.h"
|
||||
|
||||
using namespace Leonetienne::GCrypt;
|
||||
using namespace Module;
|
||||
|
||||
void GenerateKeyfile::Run() {
|
||||
|
||||
KeyManager::GetKey().WriteToFile(
|
||||
CommandlineInterface::Get()["--generate-keyfile"].GetString()
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "CommandlineInterface.h"
|
||||
#include "Configuration.h"
|
||||
#include "KeyManager.h"
|
||||
#include "ModuleGenerateKeyfile.h"
|
||||
|
||||
int main(int argc, char* const* argv) {
|
||||
|
||||
@ -13,6 +14,12 @@ int main(int argc, char* const* argv) {
|
||||
// Prepare the key
|
||||
KeyManager::PrepareKey();
|
||||
|
||||
// Launch our module
|
||||
switch (Configuration::activeModule) {
|
||||
case Configuration::MODULE::GENERATE_KEYFILE:
|
||||
Module::GenerateKeyfile::Run();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user