summaryrefslogtreecommitdiff
path: root/CryptClass/AESCrypt.hpp
blob: 5e16672fd6f4e91443a52c77b00aade0e139165c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
 * @file AESCrypt.hpp
 * @brief AESCrypt class header
 * @author manzerbredes
 * @date 8 Mars 2015
 *
 * Contain all prototypes of AESCrypt class.
 *
 */

#ifndef __AESCrypt__
#define __AESCrypt__

//----- std -----
#include "AbstractSKA.hpp"
#include "HASHCrypt.hpp"
#include <iostream>

//----- crypto++ -----
#include <crypto++/aes.h>
#include <crypto++/modes.h>
#include <crypto++/filters.h>


/**
 * @class AESCrypt AESCrypt.hpp "/CryptClass/AESCrypt.hpp"
 * @brief Class  for Advanced Encryption Standard (AES) algorithm
 * @author manzerbredes
 *
 * This class provide AES encrypt and decrypt.
 *
 * \bug Find another solution for managing padding.
 */

class AESCrypt : public AbstractSKA {


    public:
        AESCrypt();
        ~AESCrypt();


       /**
        * @brief Run encryptRoutine.
        *
        * @param key : key used to encrypt data
        * @param data : contain data to encrypt.
        *
        * @return string : correspond to crypted data
        *
        * Run encryptRoutine with byte* key or string key
        *
        */
        std::string encrypt(std::string key, std::string data);
        std::string encrypt(byte* key, std::string data);


       /**
        * @brief Encrypt data with AES algorithm.
        *
        * @param key : key used to encrypt data
        * @param data : contain data to encrypt.
        *
        * @return string : correspond to crypted data
        *
        * Encrypt data, and return them into a string.
        * Padding are blank space.
        *
        */
        std::string encryptRoutine(std::string data, byte* digest, int size);



        /**
        * @brief Decrypt data from AES algorithm.
        *
        * @param key : key used to encrypt data
        * @param data : contain data to decrypt from AES encrypt.
        *
        * @return string : correspond to decrypted data
        *
        * Decrypt data, and return them into a string.
        *
        */
        virtual std::string decrypt(std::string key, std::string data);



    private:
        HASHCrypt hash; ///< hash instance to generate SHA-256 hash code.


};

#endif