Unsolved After adding crypto++ lib application is crashing....
-
Hi guys....please help me to slove this problem, i built crypto700 lib and i added .a file to our Qt project and also headers if i run application is crashing....
-
-
@Bharth And it does not crash if you do not add this library?
-
yes if i remove libraries and headers then im getting errors
-
@Bharth Start the program from a debugger, and when it crashes, inspect the call stack.
There is no way for us to debug your program, you will need to do it yourself. Once you have pinpointed the guilty part of the app, we might be able to help with a solution.
-
application crashes in seckey.h file(this is the crypto header file)
.....................................................................
seckey.h
...................
this is line its crashingBlockCipherFinal(const byte *key, size_t length)
{this->SetKey(key, length);} -
@Bharth So, you are not only adding this lib but using it already?
-
yes,for encrypting text i used
-
Hi,
Then please post the stack trace.
-
[2018-10-30 10:18:58] [connect] WebSocket Connection 173.249.31.73:7788 v-2 "WebSocket++/0.5.1" /socket.io/?EIO=4&transport=websocket&t=1540874937 101
Connected.
[2018-10-30 10:18:58] [devel] p = 0 bytes transferred = 0
[2018-10-30 10:18:58] [devel] asio async_read_at_least: 1
[2018-10-30 10:18:58] [devel] open handshake timer cancelled
[2018-10-30 10:18:58] [devel] asio con handle_async_read
[2018-10-30 10:18:58] [devel] p = 0 bytes transferred = 87
[2018-10-30 10:18:58] [devel] calling consume with 87 bytes
[2018-10-30 10:18:58] [devel] bytes left after consume: 0
[2018-10-30 10:18:58] [devel] Complete message received. Dispatching
On handshake,sid:H_zWa2PLBAM64M38AAA1,ping interval:25000,ping timeout5000
[2018-10-30 10:18:58] [devel] asio async_read_at_least: 1
[2018-10-30 10:18:58] [devel] asio con handle_async_read
[2018-10-30 10:18:58] [devel] p = 0 bytes transferred = 4
[2018-10-30 10:18:58] [devel] calling consume with 4 bytes
[2018-10-30 10:18:58] [devel] bytes left after consume: 0
[2018-10-30 10:18:58] [devel] Complete message received. Dispatching
Received Message type (Connect)
10:19:01: The program has unexpectedly finished.
10:19:01: The process was ended forcefully. -
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.