Implement FileManIOFileClass, general bug correction.
This commit is contained in:
parent
998745fe45
commit
783197aaa1
8 changed files with 228 additions and 18 deletions
|
@ -8,8 +8,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
//----- class -----
|
||||
#include "AESCrypt.hpp"
|
||||
|
||||
|
||||
|
||||
|
||||
//Constructor
|
||||
AESCrypt::AESCrypt(){
|
||||
this->hash=HASHCrypt(); //Init hash attribute
|
||||
|
@ -20,6 +24,8 @@ AESCrypt::~AESCrypt(){
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Encrypt string
|
||||
std::string AESCrypt::encrypt(std::string key, std::string data){
|
||||
|
||||
|
@ -30,6 +36,7 @@ std::string AESCrypt::encrypt(std::string key, std::string data){
|
|||
//Contain data encrypted
|
||||
std::string cipher;
|
||||
|
||||
|
||||
//Use try, catch to be ensure no problems happening
|
||||
try{
|
||||
//Create encoder to encrypt data
|
||||
|
@ -56,6 +63,8 @@ std::string AESCrypt::encrypt(std::string key, std::string data){
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Decrypt string
|
||||
std::string AESCrypt::decrypt(std::string key, std::string data){
|
||||
|
||||
|
@ -78,7 +87,7 @@ std::string AESCrypt::decrypt(std::string key, std::string data){
|
|||
CryptoPP::StringSource ss3( data, true,
|
||||
new CryptoPP::StreamTransformationFilter( decoder,
|
||||
new CryptoPP::StringSink( cipher ),
|
||||
CryptoPP::StreamTransformationFilter::ZEROS_PADDING
|
||||
CryptoPP::StreamTransformationFilter::NO_PADDING
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue