Applications Licensing using the .NET Framework, Page 4
More Exotic Licensing
The technique I've shown here is still fairly rudimentary. While many users couldn't open the Registry and find the key without significant assistance, still others are quite capable of breaking this scheme. There are other things you could do, however, that make it much more difficult to break your licensing arrangements.
The most obvious thing you could do is replace my simple "Installed" string with an expiration date and time (and encrypt the values as well). Or you could write even more complex license providers that call a Windows or Web Service to request permission to execute the application. I've written both and they're extremely effective. And as I mentioned, the license object itself could invalidate itself and force the application to shut down, given some invalidating criteria. Perhaps it checks a licensing Web Service or database to determine the application's daily license status. In any case be sure to obfuscate your production assemblies!
If you've read this far and studied the basic Framework licensing process, you may be wondering why I went to such lengths to work within the Framework. After all, couldn't I simply create my own licensing manager and process? Aren't there non-Framework like oddities in the licensing architecture, such as the boolean value passed into GetLicense() to enable exceptions? (I would expect an attribute or property assigned to the LicenseManger or licensed class rather than a boolean value passed to GetLicense()... there isn't any way I can see to change the default Framework behavior otherwise!)
I can only imagine that using the Framework's licensing architecture versus rolling your own will have benefit to you in the future. After all, you would be following the Framework's prescribed pattern, and changes to the Framework might be of consequence to you. You also would utilize some Framework components, thereby deriving reuse and saving some (albeit slight) maintenance costs.
As for licensing itself, though, the only limit is your own imagination. Now, go and collect that revenue you've been losing!
Download Source Code
Download source code: LicensedApps.zip - 76 kb
About the Author...
Kenn Scribner finds himself consulting and helping other developers understand the complexities of Windows and COM programming. Kenn considers himself fortunate to pursue his hobby as a career and enjoys sharing his experiences with other developers. To that end, Kenn has written four books: MFC Programming with Visual C++ 6 Unleashed, Teach Yourself ATL in 21 Days, Understanding SOAP, and his newest, Applied SOAP: Implementing .NET Web Services. He has contributed to several other books, including Mike Blasczak's Professional MFC with Visual C++ 6. Kenn has also contributed numerous XML and SOAP articles to Visual C++ Developer, which you can find (along with many products and code samples) at his personal Web site, EnduraSoft.
# # #