Code base obscuration (for images) 1.0
It implements different obscuration methods on portable images (.pgm and .ppm)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PaillierController.hpp
Go to the documentation of this file.
1
9#ifndef PAILLIERCONTROLLER
10#define PAILLIERCONTROLLER
11
12#include <stdio.h>
13#include <cctype>
14#include <fstream>
15#include <string>
16#include <string_view>
17#include <ctype.h>
18#include <cinttypes>
19#include <cstring>
20
23
31{
32protected:
33 char *c_key_file;
34
37
47 bool endsWith(const std::string &str, const std::string &suffix);
48
57 void convertToLower(char *arg_in[], int size_arg_in);
67 bool isPrime(uint64_t n, uint64_t i = 2);
68
77 uint64_t check_p_q_arg(char *arg);
78
85 virtual void init() {}
86
94
102
103public:
112 {
113 // model = PaillierModel::getInstance();
114 return model;
115 }
116
125 {
126 // view = commandLineInterface::getInstance();
127 return view;
128 }
129
137 const char *getCKeyFile() const;
138
146 void setCKeyFile(char *newCKeyFile);
147
155
163 void readKeyFile(bool isEncryption);
164};
165
166#endif // PAILLIERCONTROLLER
Header of singleton of https://www.geeksforgeeks.org/implementation-of-singleton-class-in-cpp/ using ...
Superclass of Paillier main that contains common methods between subclasses.
Definition PaillierController.hpp:31
PaillierModel * getModel()
Gets the model.
Definition PaillierController.hpp:111
commandLineInterface * getView()
Gets the view.
Definition PaillierController.hpp:124
bool endsWith(const std::string &str, const std::string &suffix)
Checks if the given string ends with the specified suffix.
Definition PaillierController.cpp:33
PaillierModel * model
Instance of PaillierModel.
Definition PaillierController.hpp:35
void setCKeyFile(char *newCKeyFile)
Sets the key file.
Definition PaillierController.cpp:26
void readKeyFile(bool isEncryption)
Reads the key file.
Definition PaillierController.cpp:175
commandLineInterface * view
Instance of commandLineInterface.
Definition PaillierController.hpp:36
void convertToLower(char *arg_in[], int size_arg_in)
Converts the given arguments to lower case.
Definition PaillierController.cpp:45
void generateAndSaveKeyPair()
Generates and saves the key pair.
Definition PaillierController.cpp:97
PaillierController()
Constructor for PaillierController.
Definition PaillierController.cpp:18
uint64_t check_p_q_arg(char *arg)
Checks if the given argument is a prime number.
Definition PaillierController.cpp:71
const char * getCKeyFile() const
Gets the key file.
Definition PaillierController.cpp:21
~PaillierController()
Destructor for PaillierController.
Definition PaillierController.cpp:19
char * c_key_file
Pointer to the key file.
Definition PaillierController.hpp:33
virtual void init()
Initializes the controller.
Definition PaillierController.hpp:85
bool isPrime(uint64_t n, uint64_t i=2)
Checks if the given number is prime.
Definition PaillierController.cpp:59
This class represents a singleton model for the Paillier cryptosystem.
Definition Paillier_model.hpp:32
static PaillierModel * getInstance()
Static function to get the singleton instance of the PaillierModel class.
Definition Paillier_model.hpp:73
This class provides a command line interface for the Paillier cryptosystem. It is a singleton class,...
Definition commandLineInterface.hpp:26
static commandLineInterface * getInstance()
This function returns the singleton instance of the class.
Definition commandLineInterface.hpp:51
This file contains the command line interface for the Paillier cryptosystem.