Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. After adding crypto++ lib application is crashing....
Forum Updated to NodeBB v4.3 + New Features

After adding crypto++ lib application is crashing....

Scheduled Pinned Locked Moved Unsolved General and Desktop
20 Posts 5 Posters 2.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bharth
    wrote on 29 Oct 2018, 07:26 last edited by
    #1

    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....

    P 1 Reply Last reply 30 Oct 2018, 16:59
    0
    • B Offline
      B Offline
      Bharth
      wrote on 29 Oct 2018, 07:40 last edited by
      #2

      0_1540798810951_Capture.PNG

      J 1 Reply Last reply 29 Oct 2018, 07:48
      0
      • B Bharth
        29 Oct 2018, 07:40

        0_1540798810951_Capture.PNG

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 29 Oct 2018, 07:48 last edited by
        #3

        @Bharth And it does not crash if you do not add this library?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • B Offline
          B Offline
          Bharth
          wrote on 29 Oct 2018, 10:58 last edited by
          #4

          yes if i remove libraries and headers then im getting errors

          A 1 Reply Last reply 29 Oct 2018, 11:09
          0
          • B Bharth
            29 Oct 2018, 10:58

            yes if i remove libraries and headers then im getting errors

            A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 29 Oct 2018, 11:09 last edited by
            #5

            @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.

            Qt has to stay free or it will die.

            1 Reply Last reply
            4
            • B Offline
              B Offline
              Bharth
              wrote on 29 Oct 2018, 11:47 last edited by
              #6

              application crashes in seckey.h file(this is the crypto header file)
              .....................................................................
              seckey.h
              ...................
              this is line its crashing

              BlockCipherFinal(const byte *key, size_t length)
              {this->SetKey(key, length);}

              J 1 Reply Last reply 29 Oct 2018, 12:27
              0
              • B Bharth
                29 Oct 2018, 11:47

                application crashes in seckey.h file(this is the crypto header file)
                .....................................................................
                seckey.h
                ...................
                this is line its crashing

                BlockCipherFinal(const byte *key, size_t length)
                {this->SetKey(key, length);}

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 29 Oct 2018, 12:27 last edited by
                #7

                @Bharth So, you are not only adding this lib but using it already?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • B Offline
                  B Offline
                  Bharth
                  wrote on 29 Oct 2018, 13:03 last edited by
                  #8

                  yes,for encrypting text i used

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 29 Oct 2018, 21:34 last edited by
                    #9

                    Hi,

                    Then please post the stack trace.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      Bharth
                      wrote on 30 Oct 2018, 05:03 last edited by
                      #10

                      [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.

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        Bharth
                        wrote on 30 Oct 2018, 05:21 last edited by
                        #11

                        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());
                        

                        }

                        J 1 Reply Last reply 30 Oct 2018, 05:39
                        0
                        • B Bharth
                          30 Oct 2018, 05:21

                          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());
                          

                          }

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 30 Oct 2018, 05:39 last edited by
                          #12

                          @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...

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          4
                          • B Bharth
                            29 Oct 2018, 07:26

                            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....

                            P Offline
                            P Offline
                            Pablo J. Rogina
                            wrote on 30 Oct 2018, 16:59 last edited by
                            #13

                            @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?

                            Upvote the answer(s) that helped you solve the issue
                            Use "Topic Tools" button to mark your post as Solved
                            Add screenshots via postimage.org
                            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                            1 Reply Last reply
                            1
                            • B Offline
                              B Offline
                              Bharth
                              wrote on 31 Oct 2018, 05:26 last edited by
                              #14

                              i used QT command prompt

                              1 Reply Last reply
                              0
                              • B Offline
                                B Offline
                                Bharth
                                wrote on 31 Oct 2018, 06:31 last edited by
                                #15

                                while building boost library i used windows command prompt,,,,and while building crypto++ library i have used qt command prompt

                                J P 2 Replies Last reply 31 Oct 2018, 07:22
                                0
                                • B Bharth
                                  31 Oct 2018, 06:31

                                  while building boost library i used windows command prompt,,,,and while building crypto++ library i have used qt command prompt

                                  J Offline
                                  J Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on 31 Oct 2018, 07:22 last edited by
                                  #16

                                  @Bharth Please just say whether you used SAME compiler to build both...

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  B 1 Reply Last reply 1 Nov 2018, 06:28
                                  2
                                  • B Bharth
                                    31 Oct 2018, 06:31

                                    while building boost library i used windows command prompt,,,,and while building crypto++ library i have used qt command prompt

                                    P Offline
                                    P Offline
                                    Pablo J. Rogina
                                    wrote on 31 Oct 2018, 11:54 last edited by
                                    #17

                                    @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)?

                                    Upvote the answer(s) that helped you solve the issue
                                    Use "Topic Tools" button to mark your post as Solved
                                    Add screenshots via postimage.org
                                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                    B 1 Reply Last reply 1 Nov 2018, 08:35
                                    0
                                    • J jsulm
                                      31 Oct 2018, 07:22

                                      @Bharth Please just say whether you used SAME compiler to build both...

                                      B Offline
                                      B Offline
                                      Bharth
                                      wrote on 1 Nov 2018, 06:28 last edited by
                                      #18

                                      @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

                                      1 Reply Last reply
                                      0
                                      • P Pablo J. Rogina
                                        31 Oct 2018, 11:54

                                        @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)?

                                        B Offline
                                        B Offline
                                        Bharth
                                        wrote on 1 Nov 2018, 08:35 last edited by
                                        #19

                                        @Pablo-J.-Rogina for boost build
                                        ............................................................
                                        In command prompt
                                        cd boost-1-68-0
                                        boostrap.bat
                                        b2 toolset=gcc

                                        for crypto++
                                        ...................
                                        cd crypto
                                        mingw32-make CXXFLAGS="-DNDEBUG-g2-O3-std=c++11"

                                        P 1 Reply Last reply 1 Nov 2018, 11:53
                                        0
                                        • B Bharth
                                          1 Nov 2018, 08:35

                                          @Pablo-J.-Rogina for boost build
                                          ............................................................
                                          In command prompt
                                          cd boost-1-68-0
                                          boostrap.bat
                                          b2 toolset=gcc

                                          for crypto++
                                          ...................
                                          cd crypto
                                          mingw32-make CXXFLAGS="-DNDEBUG-g2-O3-std=c++11"

                                          P Offline
                                          P Offline
                                          Pablo J. Rogina
                                          wrote on 1 Nov 2018, 11:53 last edited by
                                          #20

                                          @Bharth mmm no debug settings for Boost... I'm suspicious that you might be mixing release and debug version of the application and libraries.

                                          Upvote the answer(s) that helped you solve the issue
                                          Use "Topic Tools" button to mark your post as Solved
                                          Add screenshots via postimage.org
                                          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                          1 Reply Last reply
                                          2

                                          1/20

                                          29 Oct 2018, 07:26

                                          • Login

                                          • Login or register to search.
                                          1 out of 20
                                          • First post
                                            1/20
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved