diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-03-11 09:51:03 +0400 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-03-11 09:51:03 +0400 |
| commit | 783197aaa13abbfb7757ecec912dfe9cb6e52c75 (patch) | |
| tree | 399f42e41babbcf697f21c30f4cabb1f121e6c34 /IOFileClass/FileManIOFile.hpp | |
| parent | 998745fe45c89570bd1d02e0e60199fc535da89b (diff) | |
Implement FileManIOFileClass, general bug correction.
Diffstat (limited to 'IOFileClass/FileManIOFile.hpp')
| -rw-r--r-- | IOFileClass/FileManIOFile.hpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/IOFileClass/FileManIOFile.hpp b/IOFileClass/FileManIOFile.hpp index e69de29..8a102c7 100644 --- a/IOFileClass/FileManIOFile.hpp +++ b/IOFileClass/FileManIOFile.hpp @@ -0,0 +1,90 @@ +/** + * @file FileManIOFile.hpp + * @brief FileManIOFile class definitions + * @author manzerbredes + * @date 9 Mars 2015 + * + * Contain all definitions of FileManIOFile class. + * + */ + +//--- std ----- +#include <iostream> +#include <string> +#include <fstream> + +//----- class ----- +#include "HASHCrypt.hpp" +#include "AESCrypt.hpp" + + +/** + * @class FileManIOFile FileManIOFile.hpp "/CryptClass/FileManIOFile.hpp" + * @brief Class for quick open and close encrypted file. + * @author manzerbredes + * + * -----File organisation----- + * + * 16 first bytes : md5 of decrypted file + * rest of the file : data encrypted (ASE for now) + * + */ +class FileManIOFile { + + public: + FileManIOFile(std::string filename); + ~FileManIOFile(); + + /** + * @brief Read encrypted file. + * + * @param key : key to encrypt data + * + * Read data from "filename" attribute. + * If file fully decrypted, readable var switch to true. + * + */ + void read(std::string key); + + /** + * @brief Read encrypted file. + * + * @param key : key to encrypt data + * + * Save data to "filename" attribute. + * + */ + void write(std::string key, std::string data); + + /** + * @brief True if file fully decrypted. + * + * Return "readable" attribute. + * + */ + bool isReadable(); + + + /** + * @brief Get data attribute. + * + * Return "data" attribute. + * + * **Warning** if data not fully decrypted (readable!=true), + * data will be unreadable. + */ + std::string getData(); + + private: + + std::string filename; ///< Filename attribute + + std::string data; ///< Data attribute + + bool readable; ///< Readable attribute + + + + + +}; |
