Unsolved After adding crypto++ lib application is crashing....
-
this is for encrypting
......................................
std::string EncryptManager::encode(QString text)
{CryptoPP::byte key[MAX_ENCRYPT_KEY_SIZE], iv[MAX_ENCRYPT_IV_SIZE];
for(int i = 0; i < MAX_ENCRYPT_KEY_SIZE; i++)
key[i] = mKey[i];for(int i = 0; i < MAX_ENCRYPT_IV_SIZE; i++) iv[i] = DEFAULT_ENCRYPT_IV[i]; std::string plaintext = text.toStdString(); std::string ciphertext; CryptoPP::AES::Encryption aesEncryption(key, MAX_ENCRYPT_KEY_SIZE); CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption(aesEncryption, iv); CryptoPP::StreamTransformationFilter stfEncryptor(cbcEncryption, new CryptoPP::StringSink( ciphertext ) ); stfEncryptor.Put( reinterpret_cast<const unsigned char*>( plaintext.c_str() ), plaintext.length()); stfEncryptor.MessageEnd(); return encode64(ciphertext);
}
this is for decrypting
.....................................
QString EncryptManager::decode(std::string text)
{
CryptoPP::byte key[MAX_ENCRYPT_KEY_SIZE], iv[MAX_ENCRYPT_IV_SIZE];for(int i = 0; i < MAX_ENCRYPT_KEY_SIZE; i++) key[i] = mKey[i]; for(int i = 0; i < MAX_ENCRYPT_IV_SIZE; i++) iv[i] = DEFAULT_ENCRYPT_IV[i]; std::string encrypted_text = decode64(text); std::string decryptedtext; CryptoPP::AES::Decryption aesDecryption(key, MAX_ENCRYPT_KEY_SIZE); CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption(aesDecryption, iv); CryptoPP::StreamTransformationFilter stfDecryptor(cbcDecryption, new CryptoPP::StringSink(decryptedtext)); stfDecryptor.Put( reinterpret_cast<const unsigned char*>( encrypted_text.c_str() ), encrypted_text.size() ); stfDecryptor.MessageEnd(); return QString(decryptedtext.c_str());
}
-
@Bharth You did not post stack trace.
Did you actually try to debug your app to see where EXACTLY it is crashing? This is first thing to do... -
@Bharth said in After adding crypto++ lib application is crashing....:
i built crypto700 lib and i added .a file to our Qt project and also headers if i run application is crashing....
In addition to provide the stack trace as asked before, are you using the same compiler to build the library and your Qt project?
-
i used QT command prompt
-
while building boost library i used windows command prompt,,,,and while building crypto++ library i have used qt command prompt
-
@Bharth Please just say whether you used SAME compiler to build both...
-
@Bharth said in After adding crypto++ lib application is crashing....:
while building boost library i used windows command prompt,,,,and while building crypto++ library i have used qt command prompt
Could it be possible you share the actual command/settings used for every build you did (Boost, libcrypto, Qt app)?
-
@jsulm No different for boost i used windows and for cryptoo i used qt command prompt because in windows command prompt im not able to generate .a file
-
@Pablo-J.-Rogina for boost build
............................................................
In command prompt
cd boost-1-68-0
boostrap.bat
b2 toolset=gccfor crypto++
...................
cd crypto
mingw32-make CXXFLAGS="-DNDEBUG-g2-O3-std=c++11" -
@Bharth mmm no debug settings for Boost... I'm suspicious that you might be mixing release and debug version of the application and libraries.