Normally if you want a single installation that users in multiple places want to use, then I would recommend a web-application. But since you already have a Swing application, how about a WebStart application?
Turning your application into a WebStart app normally doesn't require making any changes to it, although you do have some limitations wrt access to the file system. You just need to provide a file that basically says which jars your app needs, what is the main class, etc. (This is the JNLP file.)
I've never done anything with encryption, so I wouldn't know how to encrypt a file, stick it in a jar and decrypt it from your program. But you can put the file on a web-server (normal HTTP with regular username and password authentication which you hard-code into your app?) and retrieve it when the program runs.
SCJP 1.4 -- SCJD Java 2 -- OCM JEA 5
posted 11 years ago
My application would be sent via email . I dont have a site to host my application as a Web application or via Webstart.
Kindly suggest me some way to prevent users installing the same application over multiple machines.
posted 11 years ago
Oh I see. I thought the problem was you wanted to prevent users (or yourself) from having to make many installations on many different computers, for convenience basically. But you want some sort of copyright protection - even if users want to make multiple installations, you want to inhibit them from doing that.
Is that correct?
And you don't have any kind of server that you can have users connect to, to "activate" your program, such that each e-mail address is allowed to "activate" only once.
I know it can be done, because DRM (digital rights management) does this: You buy a song in the wrong music store, and if they want, they can only allow you to listen to it only n times. The idea would be that you use the same technique to allow installation only 1 time. But I don't know how it works. Anyone?
It's not really a Swing topic but more something of a security issue, by the way.
If the files are part of the application, then ultimately there is no way to protect them. You can make it harder using encryption and code obfuscation, but a determined attacker will be able to prevail. If the target audience is not very experienced very few may be able to do that, though; depends on who uses the application.
I am not an advanced user and this may sound stupid, but for "file encription" I just use a custom method to turn whatever text file I want into a different base (let's say hex-16), I then do a bit shift on it x number of positions (pref odd number), and then I save the file with a .bmp extension and mislabel it. Why? Because who out there ever sees a .bmp file in a directory and thinks "I wonder if this picture is really the answers to this program just in disguise"? Also, even if they did try and open it in a Hex editor it would be shifted out of place... someone would have to know that the base was changed and the shift amount, and if someone is going through that much trouble then they can have it, lol. I wouldn't recommend this method for any corporate software or anything but if this is your own small project and you need a quick and dirty method that's what I use. :P