Local Machine Copy Protected Licensing

by Weifen Luo (DevZest) 14. September 2009 11:55

There are many ways to enforce the software licensing for local machine copy protection: CPU ID, network card mac address, hard disk serial number, etc. But they all have some pitfalls: the first is hard to get these information reliably; the second is these information is the privacy of the users and should not be revealed or recorded.

In our .Net Licensing, we’re using a new, simple and reliable way, probably used by nobody else. The trick is to encrypt any data (a known GUID, for example) using DPAPI, and embed the encrypted data into your license file. Because the encrypted data is copy protected against local machine, your license file, and your application/component relies on the license file is then copy protected.

To encrypt:

// {1F079CBE-96C8-46fd-8631-2C7D7E4DA8CA}
private static readonly Guid Guid = new Guid(0x1f079cbe, 0x96c8, 0x46fd, 0x86, 0x31, 0x2c, 0x7d, 0x7e, 0x4d, 0xa8, 0xca);

 

byte[] protectedDataBytes = ProtectedData.Protect(Guid.ToByteArray(), null, DataProtectionScope.LocalMachine);

To verify:

Byte[] bytes = ProtectedData.Unprotect(encryptedBytes, null, DataProtectionScope.LocalMachine);
if (new Guid(bytes) != Guid)
...

Easy, huh? Some may argue that re-installing the operating system will result in a license file regenerating. Yes, it’s true. But the fact is license file regenerating is not avoidable any way, if you make your software copy protected against local machine. Any identity of the local machine, either hardware or software, can be changed - it’s rude to sell your customer a software not allowing them to change their machine configurations.

Tags: , ,

.Net

Comments

9/14/2009 12:01:54 PM #

Local Machine Copy Protected Licensing

You've been kicked (a good thing) - Trackback from DotNetKicks.com

DotNetKicks.com |

Comments are closed

Copyright DevZest, 2008 - 2017