Obfuscating images

前端 未结 6 1812
遥遥无期
遥遥无期 2021-02-09 15:46

I want to distribute a few images and not allow others to see them unless they are using my program. My intention will be to use JPG files in which I will alter the header so ot

相关标签:
6条回答
  • 2021-02-09 15:54

    You could make it more difficult for them by byte packing the images as encrypted resources. But like anything else if they have access to the files that could get the images out. It just depends on how much effort the are willing to use.

    0 讨论(0)
  • 2021-02-09 15:58

    Depending on how secure you need it to be you could do something as simple as obfuscate the file extension to an extension that is only opened with your application. This will only work if its not super secret images that you are changing.

    0 讨论(0)
  • 2021-02-09 16:13

    Encrypt them. Load the encrypted image, decrypt in memory and then do the loadfromstream like mghie suggested.

    0 讨论(0)
  • 2021-02-09 16:13

    Why not just encrypt the images with a private key and distribute your public key to the people you want to view the images? much easier to distribute a public key than writing some custom software and distributing that. Don't forget; anything displayed on screen can be screen captured. The fact a custom-mangled JPEG can only be displayed with your app is no protection. Also don't forget; people can simply distribute your software with the mangled image.

    0 讨论(0)
  • 2021-02-09 16:14

    Mghie's answer is about as good as you'll find, but it's not likely to be too effective. If someone wants to look at your images and they know anything about image formats, they'll open it in a hex editor and most likely recognize what they see as a JPEG with the magic header removed.

    If you really want to keep someone from viewing your images, construct your own image format, (it's not as hard as it sounds, really,) and put as little metadata in as possible, and then hope that works. Or encrypt them, or put them into an archive, (construct your own archive format for best results,) and hope that works.

    Thing is, ultimately, anything that's encoded has to be decoded before it can be shown, and any sufficiently-talented hacker can trace their way through your decoding routine and figure out how it works. Why are you trying to hide things from your users anyway?

    0 讨论(0)
  • 2021-02-09 16:19

    Load the "broken" file into a TMemoryStream, patch the bytes in-memory, and use TGraphic.LoadFromStream() to load the fixed JPG file.

    0 讨论(0)
提交回复
热议问题