2

I have to protect with a validation Key an application written in Java, the key should work only on a specified PC, so for example a machine ID serial number should be generated by the application based on a unique identifier (for example : hard disk serial, MainBoard serial and so on ... ); then based on this unique identifier another program will generate a validation key.

I have already implemented a similar activation system on a .NET application generating Machine identifier, getting hardware serial numbers from WMI, How can i get this values in Java ? The solution should work independently on Windows, Linux and Mac Os X .

How can i retrieve a unique identifier of a machine in Java ? Is there some library out there, that allow to do it ?

dsolimano
  • 8,600
  • 3
  • 47
  • 62
aleroot
  • 68,849
  • 28
  • 172
  • 209
  • Possible duplicate: http://stackoverflow.com/questions/1986732/how-to-get-a-unique-computer-identifier-in-java-like-disk-id-or-motherboard-id – TPete Mar 05 '12 at 10:48

3 Answers3

3

The machines MAC address (or one of the machines MAC addresses) is a good candidate. It is unique and probably changes less often then other hardware identifiers. Here's a code snippet:

Andreas Dolk
  • 111,016
  • 17
  • 174
  • 259
1

I dont think you can get CPU Id or Harddisk/motherboard Ids in pure java. The closest you have is network mac address:

NetworkInterface.getNetworkInterfaces().nextElement().getHardwareAddress();
Yoni Roit
  • 27,462
  • 7
  • 34
  • 32
0

You need to call something platform specific. For example on Windows you can call a VB script which calls the WMI to get this information.

Note: what ever approach you use should be easy to fool if you know what you are doing.

Peter Lawrey
  • 513,304
  • 74
  • 731
  • 1,106