Where and how to store license information?
I have an application (C #) and I am tasked with creating a simple licensing scheme in it. That being said, I need to save this information somewhere on my computer to restrict usage.
I need to store a date and a counter.
How and where should I save information that in Windows Vista does not require administrative rights to run? (This means storing it in System32, Program Files, HKEY_LOCAL_MACHINE is not an option.)
Please do not flood with “don’t do it” or “it will crack anyway” answers. I understand these logics. I just need to do whatever can be done for this purpose.
a source to share
we are using a signed XML license file. This is a simple XML file that displays what the user has bought.
The good thing about this is that she will be a future compatriot. You can easily add product feature or product line, expiration dates and feature attributes.
It's easy for our commercial site to create and package licenses on demand, just make sure your private keys never go out. The percentages trumped the cons here and the biggest problem we can't get around is just dealing with the license file.
Here is an example XML file
<?xml version="1.0" encoding="utf-8"?>
<ProductName>
<License>
<LicenseId>20025fb9-5349-46d4-a530-55b0295beaaa</LicenseId>
<CustomerName>Scott.Cate@Example.com</CustomerName>
<MajorVersion>2008</MajorVersion>
<Product>Friendly Display Name</Product>
<ProductType>Enterprise</ProductType>
<Features>
<!--Add features here-->
</Features>
<Expires>0001-01-01T00:00:00</Expires>
</License>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>u3{..........}U2jo=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>QFg1kI{...............}DwDIE=</SignatureValue>
</Signature>
</ProductName>
And we use a simple .NET built-in API to sign XML and validate that it is written and valid.
Things I Like ...
.. Easy to read. (for technical support) .. Easy to replace .. Easy to store in the file system or in our case a database for easy access to and exit from the user interface. (we have an in-place upgrade / upgrade system) .. easy to upgrade. We have a service that takes your old license and, after verification, offers an upgrade price based on what has already been purchased. The trading system then registers the old and new license files for reference.
Things I Don't Like ...
.. Can be copied, easily stolen.
a source to share