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.4k 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 Bharth

    0_1540798810951_Capture.PNG

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on 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 last edited by
      #4

      yes if i remove libraries and headers then im getting errors

      aha_1980A 1 Reply Last reply
      0
      • B Bharth

        yes if i remove libraries and headers then im getting errors

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on 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 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);}

          jsulmJ 1 Reply Last reply
          0
          • B Bharth

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

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on 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 last edited by
              #8

              yes,for encrypting text i used

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on 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 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 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());
                    

                    }

                    jsulmJ 1 Reply Last reply
                    0
                    • B Bharth

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

                      }

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 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

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

                        Pablo J. RoginaP Offline
                        Pablo J. RoginaP Offline
                        Pablo J. Rogina
                        wrote on 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 last edited by
                          #14

                          i used QT command prompt

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            Bharth
                            wrote on last edited by
                            #15

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

                            jsulmJ Pablo J. RoginaP 2 Replies Last reply
                            0
                            • B Bharth

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

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 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
                              2
                              • B Bharth

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

                                Pablo J. RoginaP Offline
                                Pablo J. RoginaP Offline
                                Pablo J. Rogina
                                wrote on 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
                                0
                                • jsulmJ jsulm

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

                                  B Offline
                                  B Offline
                                  Bharth
                                  wrote on 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
                                  • Pablo J. RoginaP Pablo J. Rogina

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

                                    Pablo J. RoginaP 1 Reply Last reply
                                    0
                                    • B Bharth

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

                                      Pablo J. RoginaP Offline
                                      Pablo J. RoginaP Offline
                                      Pablo J. Rogina
                                      wrote on 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

                                      • Login

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