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

    jsulmJ 1 Reply Last reply
    0
    • M Offline
      M Offline
      mostefa
      wrote on 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

        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.

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

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

          1 Reply Last reply
          4
          • jsulmJ jsulm

            @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 last edited by
            #5

            @jsulm thank you. It worked like a charm.

            1 Reply Last reply
            0
            • jsulmJ jsulm

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

              jsulmJ 1 Reply Last reply
              0
              • C CroCo

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

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

                • Login

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