views:

118

answers:

3

Hello,

I have a Swing window that has sensitive information in it and I would like to prevent users from taking screenshots, or making by window invisible when they do take the screenshots.

How can I achieve this?

+6  A: 

If someone tried to do this I would run their program in a VM, and then take a screenshot of the VM screen.

So there is no way you could prevent something like this... and why should you?

Gabor Kulcsar
Granted. See my comment above :)
mlaverd
+7  A: 

One clever approach I have seen in the past takes advantage of human's persistance of vision by display only a portion of the image at a time.

As a simple example, imagine that instead of rendering the password 'p455w0rd' in a textbox, you had a special text box that renders three different frames very quickly:

  1. p ␣ ␣ 5 ␣ ␣ r ␣
  2. ␣ 4 ␣ ␣ w ␣ ␣ d
  3. ␣ ␣ 5 ␣ ␣ 0 ␣ ␣

Any screenshot would only capture a portion (1/3) of the data and would require that the capturer take many screenshots, select three that encompass all of the information and then combine them in an image editor to recover the data.

A better solution would use more frames (though flicker will increase as the number of frames increases) or finer granularity (pixels, say, instead of characters).

Remember, though, that this solution just makes it harder, not impossible to store the data. You would be hard pressed to stop the user whipping out a pen or camera. Unless this is for some government or call-centre application that is attempting to protect customer data, I would seriously consider not adding such a feature.

Paul Ruane
This is nifty. However, finer granularity would probably not make it more secure (not without increasing frame count, anyway). I'd say that figuring out a word on an image consisting of 90% noise is a lot easier than figuring out an entire ten-letter word from one of its characters.
gustafc
+2  A: 

Ubnfortunatly, you won't be able to do so in an efficient fashion.

First, operating system don't seems th send event when they take screenshots (which could have given you a handle - or an event).

Sceond, user can always run your application in a VM (preventing the vent from being sent) or, both worse and easier, take a picture with a cameraphone or any other device.

Finally, what is the point of showing informations that the user can see but not memorize ? If you want your informations to be hidden, don't show them to the user, otherwise he will always be able to copy them (think about the entertainment industry and the issues about DVD screeners, as an example).

Finally, if you want to give your boss some positive information, take a look at jintellitype, which will allow you to register a listener for the "Print screen" key.

Riduidel
Since I am building this on Linux right now, I tried JXGrabKey and get the following error: `Each hotkey combination can only be grabbed by one application at a time!`
mlaverd