Added encryption module, and data output layer

This commit is contained in:
Leonetienne
2022-05-31 17:35:05 +02:00
parent a00b8cc310
commit fd75678ea3
6 changed files with 274 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ namespace IO {
// Indicates whether EOF has been reached
static bool reachedEof;
// Indicates whether this class is initialized
// Indicates whether this class has been initialized
static bool initialized;
// All read blocks, that haven't been given out yet

View File

@@ -0,0 +1,60 @@
#ifndef GCRYPTCLI_DATAOUTPUTLAYER_H
#define GCRYPTCLI_DATAOUTPUTLAYER_H
#include <iosfwd>
#include <queue>
#include <GCrypt/Block.h>
#include "Configuration.h"
using namespace Leonetienne::GCrypt;
namespace IO {
// This class is used to read in data.
class DataOutputLayer {
public:
//! Will initialize the output
static void Init();
//! Will destruct the output layer (like, closing file handles)
static void Destruct();
//! Will queue a block for writing
static void Enqueue(const Block& block);
//! Will attempt to write the next block
static void WriteBlock();
//! Indicates that no more blocks will be enqueued
static void ReachedEOF();
//! Returns true, if all blocks have been written, and an EOF signal as been received
static bool IsFinished();
private:
static std::ostream* out;
// The format to write data in
static Configuration::IOBASE_FORMAT outFormat;
// We have to hold on to a reference to a filestream,
// even if we're always just reading from in.
// We still have to CLOSE the file handle afterwards!
static std::ofstream ofs;
// Indicates whether EOF has been reached
static bool reachedEof;
// Indicates whether this class has been initialized
static bool initialized;
// All blocks, that haven't been written yet
static std::queue<Block> blocks;
//! No instanciation >:(
DataOutputLayer() {};
};
}
#endif

View File

@@ -0,0 +1,18 @@
#ifndef GCRYPTCLI_MODULE_ENCRYPTION_H
#define GCRYPTCLI_MODULE_ENCRYPTION_H
namespace Module {
//! This module will encrypt supplied input
class Encryption {
public:
//! Will run the module
static void Run();
private:
// No instanciation! >:(
Encryption() {};
};
}
#endif