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. Decrypt file before loading
Forum Updated to NodeBB v4.3 + New Features

Decrypt file before loading

Scheduled Pinned Locked Moved Unsolved General and Desktop
27 Posts 9 Posters 2.7k 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.
  • J Offline
    J Offline
    JoeCFD
    wrote on 14 Nov 2022, 16:42 last edited by JoeCFD
    #15

    I need this feature as well. It would be nice if Qt can provide this function. The idea of DerReisende is not bad. But if the file is big and loading takes long, the tmp file can be copied and encryption does not make sense anymore.

    J 1 Reply Last reply 14 Nov 2022, 17:27
    0
    • J JoeCFD
      14 Nov 2022, 16:42

      I need this feature as well. It would be nice if Qt can provide this function. The idea of DerReisende is not bad. But if the file is big and loading takes long, the tmp file can be copied and encryption does not make sense anymore.

      J Offline
      J Offline
      JonB
      wrote on 14 Nov 2022, 17:27 last edited by JonB
      #16

      @JoeCFD
      So try it using memory instead of external file.

      Goodness knows what you guys are trying to encrypt to hide from the user, an image that you're presumably going to show anyway. You would be talking about a symmetric encryption/decryption algorithm, right? So between that, and whether it be Qt's code or your code both likely to be publicly visible, isn't it likely that a user who wants to see the image file decrypted could do so anyway?

      J 1 Reply Last reply 14 Nov 2022, 22:03
      1
      • R Offline
        R Offline
        Roberrt
        wrote on 14 Nov 2022, 18:13 last edited by
        #17

        Well I didn't expect it was going to be a 'hard' task, the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

        J J D J C 5 Replies Last reply 14 Nov 2022, 18:15
        0
        • R Roberrt
          14 Nov 2022, 18:13

          Well I didn't expect it was going to be a 'hard' task, the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

          J Offline
          J Offline
          JonB
          wrote on 14 Nov 2022, 18:15 last edited by
          #18

          @Roberrt
          OK, but then for you the issue @JoeCFD raised about unencrypting to a temporary file (if it is even needed) should not be an issue.

          1 Reply Last reply
          0
          • R Roberrt
            14 Nov 2022, 13:47

            kkoehne i would like to hardcode the decryption into the sources, then I wouldn't need to care about coding anything else in the project as mostly of the pictures are added using stylesheet.

            I have added some OutputDebugString into the functions under qfsfileengine_win.cpp, but none of them got called.

            R Offline
            R Offline
            Roberrt
            wrote on 14 Nov 2022, 18:17 last edited by
            #19

            @Roberrt said in Decrypt file before loading:

            kkoehne i would like to hardcode the decryption into the sources, then I wouldn't need to care about coding anything else in the project as most of the pictures are added using stylesheet.

            Doing this also would work when testing the UI in qt designer, with encrypted files.

            1 Reply Last reply
            0
            • R Roberrt
              14 Nov 2022, 18:13

              Well I didn't expect it was going to be a 'hard' task, the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

              J Offline
              J Offline
              JoeCFD
              wrote on 14 Nov 2022, 19:16 last edited by
              #20

              @Roberrt Maybe save the temp files into an invisible dir.

              1 Reply Last reply
              0
              • R Roberrt
                14 Nov 2022, 18:13

                Well I didn't expect it was going to be a 'hard' task, the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

                D Offline
                D Offline
                DerReisende
                wrote on 14 Nov 2022, 21:23 last edited by
                #21

                @Roberrt said in Decrypt file before loading:

                Well I didn't expect it was going to be a 'hard' task, the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

                Well AFAIK unless you are using a commercial license of Qt, every modification of Qt source you make must be made available to other users - including your encryption modification. If that is the case you win nothing and your customers may easily decrypt the resources...but I guess it will be a lot easier for them to just make screenshots and edit those.

                1 Reply Last reply
                0
                • J JonB
                  14 Nov 2022, 17:27

                  @JoeCFD
                  So try it using memory instead of external file.

                  Goodness knows what you guys are trying to encrypt to hide from the user, an image that you're presumably going to show anyway. You would be talking about a symmetric encryption/decryption algorithm, right? So between that, and whether it be Qt's code or your code both likely to be publicly visible, isn't it likely that a user who wants to see the image file decrypted could do so anyway?

                  J Offline
                  J Offline
                  JoeCFD
                  wrote on 14 Nov 2022, 22:03 last edited by
                  #22

                  @JonB How to use memory for the encrypted files?

                  D 1 Reply Last reply 14 Nov 2022, 22:17
                  0
                  • J JoeCFD
                    14 Nov 2022, 22:03

                    @JonB How to use memory for the encrypted files?

                    D Offline
                    D Offline
                    DerReisende
                    wrote on 14 Nov 2022, 22:17 last edited by
                    #23

                    @JoeCFD QImage::loadFromData() with a byte array.

                    J 1 Reply Last reply 14 Nov 2022, 22:25
                    1
                    • D DerReisende
                      14 Nov 2022, 22:17

                      @JoeCFD QImage::loadFromData() with a byte array.

                      J Offline
                      J Offline
                      JoeCFD
                      wrote on 14 Nov 2022, 22:25 last edited by
                      #24

                      @DerReisende said in Decrypt file before loading:

                      QImage::loadFromData()

                      Thanks. Then it is doable for images. How about videos?

                      D 1 Reply Last reply 15 Nov 2022, 08:58
                      0
                      • R Roberrt
                        14 Nov 2022, 18:13

                        Well I didn't expect it was going to be a 'hard' task, the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 15 Nov 2022, 06:30 last edited by
                        #25

                        @Roberrt said in Decrypt file before loading:

                        the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

                        One can do a simple screen shot of running app and cut all the icons, personal art, logo. Don't see how encryption can help here...

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

                        1 Reply Last reply
                        0
                        • R Roberrt
                          14 Nov 2022, 18:13

                          Well I didn't expect it was going to be a 'hard' task, the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

                          C Offline
                          C Offline
                          ChrisW67
                          wrote on 15 Nov 2022, 07:04 last edited by
                          #26

                          @Roberrt said in Decrypt file before loading:

                          Well I didn't expect it was going to be a 'hard' task, the reason to encrypt is to avoid easily copy of icons, personal art, logo, etc

                          For my money, using the Qt resource system is going to achieve this goal. There is no on-disk file to copy. Anyone savvy enough, and with enough motivation, to find and decompress the image data embedded in your executable or DLL is probably going to be able to subvert this several ways.

                          @DerReisende 's suggestion is a good one if it is only images involved. This has the benefit of working anywhere the encrypted image is used.

                          A QImageIOPlugin should be quite quick to produce. The plugin create() method would have to create your QImageIOHandler subclass for *.enc images and ensure it gets a decryption key if one is needed.
                          The QImageIOHandler may be more involved but could be as simple as the read() method loading the target QIODevice data into a QByteArray, decrypting/de-obfuscating in-place, calling QImage::loadFromData(), and destroying the interim QByteArray.

                          1 Reply Last reply
                          2
                          • J JoeCFD
                            14 Nov 2022, 22:25

                            @DerReisende said in Decrypt file before loading:

                            QImage::loadFromData()

                            Thanks. Then it is doable for images. How about videos?

                            D Offline
                            D Offline
                            DerReisende
                            wrote on 15 Nov 2022, 08:58 last edited by
                            #27

                            @JoeCFD One guy did it this way with PyQt5.

                            1 Reply Last reply
                            1

                            24/27

                            14 Nov 2022, 22:25

                            • Login

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