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. Integrity data fails on the recompile
Forum Updated to NodeBB v4.3 + New Features

Integrity data fails on the recompile

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.3k Views 1 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.
  • Cobra91151C Offline
    Cobra91151C Offline
    Cobra91151
    wrote on last edited by
    #1

    Hi! I have a program that encrypt the password, stores it in the registry and displays it later.

    I use SimpleCrypt to encrypt and decrypt the password. It works well, but the strange issue is when recompile the application. Then, it displays the empty string. I have checked:

    bool integrityOk(true);
        if (flags.testFlag(CryptoFlagChecksum)) {
            if (ba.length() < 2) {
                m_lastError = ErrorIntegrityFailed;
                return QByteArray();
            }
            quint16 storedChecksum;
            {
                QDataStream s(&ba, QIODevice::ReadOnly);
                s >> storedChecksum;
            }
            ba = ba.mid(2);
            quint16 checksum = qChecksum(ba.constData(), ba.length());
    
            qDebug() << checksum;
            qDebug() << storedChecksum;
    
            integrityOk = (checksum == storedChecksum);
    
            qDebug() << integrityOk; // false
        }
    
        if (!integrityOk) {
            qDebug() << "Test";
            m_lastError = ErrorIntegrityFailed;
            return QByteArray();
        }
    

    Integrity check fails and it return the empty string. Any ideas? Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Check your seeding, also, you should fix the version of the QDataStream you are using otherwise you might hit compatibility problem using different version of Qt.

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

      Cobra91151C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Check your seeding, also, you should fix the version of the QDataStream you are using otherwise you might hit compatibility problem using different version of Qt.

        Cobra91151C Offline
        Cobra91151C Offline
        Cobra91151
        wrote on last edited by
        #3

        @SGaist

        I have set the version.

        Code:

        QDataStream s(&ba, QIODevice::ReadOnly);
        s.setVersion(QDataStream::Qt_5_7);
        

        But the same issue exists. What do you mean by: Check your seeding?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Check how you are initialising your SimpleCrypt object.

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

          Cobra91151C 1 Reply Last reply
          1
          • SGaistS SGaist

            Check how you are initialising your SimpleCrypt object.

            Cobra91151C Offline
            Cobra91151C Offline
            Cobra91151
            wrote on last edited by
            #5

            @SGaist

            I have fixed the problem. The problem was with the wrong key implementation. Thank you.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You're welcome !

              Out of curiosity, what do you mean by "wrong key implementation" ?

              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

              • Login

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