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. How to encrypt a file that stores password and user name locally?
QtWS25 Last Chance

How to encrypt a file that stores password and user name locally?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 1.8k Views
  • 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.
  • C Offline
    C Offline
    CroCo
    wrote on 6 Nov 2017, 12:51 last edited by
    #1

    I'm developing a PC application (i.e. GUI app). This file will be used by several users. Modifying settings is protected by a password but the admin is the only person who can modify the password. Files are stored in the PC. I need to allow the admin to modify the password. This password must be saved in the PC in a encrypted file. How can I achieve this? Saving the file in a binary mode can be converted to txt mode easily. Any suggestions? Currently, I'm using Window OS.

    J 1 Reply Last reply 6 Nov 2017, 13:41
    0
    • M Offline
      M Offline
      mostefa
      wrote on 6 Nov 2017, 13:31 last edited by
      #2

      Hi @CroCo

      What about using QCryptographicsHash ?

      Also you can be interested with this wiki

      1 Reply Last reply
      0
      • C CroCo
        6 Nov 2017, 12:51

        I'm developing a PC application (i.e. GUI app). This file will be used by several users. Modifying settings is protected by a password but the admin is the only person who can modify the password. Files are stored in the PC. I need to allow the admin to modify the password. This password must be saved in the PC in a encrypted file. How can I achieve this? Saving the file in a binary mode can be converted to txt mode easily. Any suggestions? Currently, I'm using Window OS.

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 6 Nov 2017, 13:41 last edited by
        #3

        @CroCo Instead of storing the password store its checksum. Such checksums (like MD5) work one way: you cannot get the password from its checksum. This is how operating systems store passwords. To validate the password which user enters you calculate its checksum and compare it with the stored checksum - if both are identical then the correct password was entered. So, no need to encrypt the file (where would you store the key safely?).

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

        C 2 Replies Last reply 6 Nov 2017, 18:44
        3
        • S Offline
          S Offline
          sneubert
          wrote on 6 Nov 2017, 16:26 last edited by
          #4

          @jsulm
          and don´t forget to salt it!
          John catches plain checksums at breakfast :-)

          1 Reply Last reply
          4
          • J jsulm
            6 Nov 2017, 13:41

            @CroCo Instead of storing the password store its checksum. Such checksums (like MD5) work one way: you cannot get the password from its checksum. This is how operating systems store passwords. To validate the password which user enters you calculate its checksum and compare it with the stored checksum - if both are identical then the correct password was entered. So, no need to encrypt the file (where would you store the key safely?).

            C Offline
            C Offline
            CroCo
            wrote on 6 Nov 2017, 18:44 last edited by
            #5

            @jsulm thank you. It worked like a charm.

            1 Reply Last reply
            0
            • J jsulm
              6 Nov 2017, 13:41

              @CroCo Instead of storing the password store its checksum. Such checksums (like MD5) work one way: you cannot get the password from its checksum. This is how operating systems store passwords. To validate the password which user enters you calculate its checksum and compare it with the stored checksum - if both are identical then the correct password was entered. So, no need to encrypt the file (where would you store the key safely?).

              C Offline
              C Offline
              CroCo
              wrote on 6 Nov 2017, 19:13 last edited by
              #6

              @jsulm do you know which checksum is the strongest? It seems MD5 is very weak. Online crackers did succeeded to crack stored passwords but they failed with Sha3_512. Any suggestions!

              J 1 Reply Last reply 7 Nov 2017, 05:17
              0
              • C CroCo
                6 Nov 2017, 19:13

                @jsulm do you know which checksum is the strongest? It seems MD5 is very weak. Online crackers did succeeded to crack stored passwords but they failed with Sha3_512. Any suggestions!

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 7 Nov 2017, 05:17 last edited by
                #7

                @CroCo I think SHA512 should be fine

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

                1 Reply Last reply
                2

                1/7

                6 Nov 2017, 12:51

                • Login

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