Contents - Index


6.5 Licensing a Product

We have a customer who is reporting that he is getting an error message when trying to register our application as a client. I have looked at my code and traced the problem that he is seeing to a SLS_E_SYSTEM_ERROR return code from SLS_Request. He tells me that the license file looks all right, and should be fully accessable. Under what conditions can the SLS_Request function return this error code?
Sheriff issues SLS_E_SYSTEM_ERROR if

  1. it fails to open one of the licence files
  2. it fails to lock a section in one of the licence files
If it worked before, then it is unlikely to be the first possibility. Look in the licence folder where all licence files are kept and see if there is a file with the extension ".lok". If found, delete it and it should then work. ".lok" is a temporary file that only exists during a licence file is being locked. It should be automatically deleted by the system. The only chance that is left in the disk would be that the machine crashed while a file is being locked. The life span of a ".lok" is usually only in the scope of millisecond.

Could you elaborate more on unit metering and concurrency and the differences between them?
Unit metering allows you to rent your application, your users have to buy units from you and when they run your application the units get consumed. Different features in your application may consume different numbers of units E.g. Viewing a document may consume one unit but printing a document may consume two units. Concurrency controls the number of users that can run you application simultaneously. A user is defined as one user name on one PC. In other words, multiple instances of the same user on the same PC is regarded as one user i.e. A one-concurrent-user licence permits only one user to run your application at a time. The user can either be local or remote - see Network Licences Licences FAQ for questions about remote users).

Using the demonstration Product ID I cannot seem to test metered units or concurrent usage. Although I can generate the Licence Key, after installation its properties do not reflect the metered information or number of concurrent users. Furthermore, after I compile your demo application it fails because "Licence units are undefined." How can I test the licence features? What am I doing wrong with the demo application?
With the evaluation product ID, unit metering and concurrency are enabled. The reason why you get "Licence units are undefined." is due to the way that the demo application is implemented - it expects the licence to be unit metered. In other words, the Licence Key you issue for the demo application should be unit metered.

If a licence is set to expire on 01/01 will it still be usable on that date or will it expire at the end of the previous day?
The Expiry Date is inclusive, so a licence set to expire on 01/01 will still work on that date. However, Sheriff has to be able to work across time zones and uses GMT for its internal clock. Therefore the licence could expire earlier or later than midnight on 01/01, depending on the local time zone.

How common is it for the license server computer to give write access to its registry by all workstations? This doesn't seem terribly secure.
With Sheriff, workstations do not need to have access to server's registry but they do need write access to the licence file.

Is it safe to deploy a trial version of our software that automatically generates a licence with the following characteristics:

  • the licence expires after 30 days (day metering)
  • FULL version of the product (no limitations of any kind during the trial period)

Yes, it is safe provided that your application checks to see if such a trial licence has not ever been installed on the PC before it automatically issue a trial licence. The API function "SLS_IsProductLicensed" does just that.

Each application on our CD should have its own token (should be protected independently regardless of the other applications). Is this possible?
Yes. Each application should have its own unique Sheriff Product ID. This is used to distinguish that product from other Sheriff-protected products and permits multiple protected products to be installed on a single machine.

Is it possible for multiple applications to be activated all at once or one by one at different periods of time.
There is no problem with this as the protection for each app is independent (i.e. each has its own Product ID). Multiple users and applications are administered by the end user using the Sheriff Licence Administrator application (SlsAdmin.exe).

If we need to have a pre-determined Licence Key (like the CD-Key in most Microsoft products) with a 'Expiry Date' and 'Number of User' set, is it possible?
No, because the Licence Key is unique to each system it has to be created on the system itself. However it is possible for a Licence Key to be created on installation (i.e. self-generated) without reference to the publisher, although this is less secure.

When registering products using the Sheriff Licence Key Generator and subsequently issuing customer Licence Keys is all this information kept on a permanent basis on the computer that is using the Sheriff Licence Key Generator EXE file (SlsGen.exe)?
Yes, the information about licence keys that you, the publisher, have issued is kept in a log file and there's no problem about backing up or restoring this - or the Sheriff Licence Generator (SlsGen.exe) - to another machine.

Once supplied with the Reference Code for one of our products can we generate Licence Keys for multiple products? i.e. can we secure multiple products via one email transfer thus: user sends us one Reference Code, we generate Licence Keys for multiple products and send back, user uses the set of Licence Keys to licence the products. We ask this because of the concern over lengthy telephone conversations involved when installing multiple applications.
The answer is "No". A Licence key is bound to both the specified product and the machine. The Reference Code contains both the signature of the product and the machine. One Reference Code can be used to generate only one Licence Key, otherwise one could purchase a Licence Key and use it on many different machines.

How do I get my software from a trial licence into a networking licence? After a potential customer has evaluated the software, I want him/her to be able to buy a network, floating licence. What reference code do I need then? I want to register the application programmatically, since I do not want the hassle of distributing the Sheriff Admin tools. Can you explain what I need to do then? Do I need all reference codes from all machines potentially running our software? (which seems unworkable to me). Do I need the reference code from one PC? Or is there no need to supply a reference code?
To switch a user from a trial licence to a full licence you just need to issue a new licence key. If you don't want to distribute SlsAdmin to your users then you need to implement licensing functions in your application which involves two API calls, i.e. SLS_GetReference and SLS_SetLicence. The actual steps are something like this:

  1. If the user wants to buy a new licence, he/she will select a menu item or something similar from your application. Your application will then call SLS_GetReference to generate a new reference code of the machine.
  2. The user will then contact you by phone or email and tell you his/her reference together with the licence options he/she wants to purchase
  3. You will then run SlsGen to generate a licence key for the user and send it back to the user
  4. The user will have to enter the licence key into some sort of dialog box your application provides. Your application will then call SLS_SetLicence to authorise the licence.
As far as network licence is concerned, it is sitting on a network server. The only reference code you need to get is from the server PC. Once the network licence is authorised then it can be shared by other workstations across the network.

What can the user do between generating the Reference Code and entering the Licence Key? E.g. Exit our installation program? Reboot his machine? We ask this because of the concern that the user will have to leave his computer turned on at the Licence Key prompt until the Licence Key is obtained from us.
The user does not have to leave the machine turned on once the Reference Code has been generated. The Reference Code remain unchanged until a valid Licence Key has been authorised against the Reference Code on that machine. In other words, the user can install the application, get the Reference Code and email it to you and turn the machine off. When the user has got the Licence Key back from you, he/she can then turn the machine on and the Reference Code will be the same. He/she can then enter the Licence Key and at that point the Reference Code will change.

(a) Is it possible to tell whether a Reference Code has been generated on the same machine?
The first 12 digits are the user's machine signature, the next 4 digits are the product signature and the remaining 8 digits are the run-time signature. It is possible to tell whether or not two Reference Codes are generated from the same machine by comparing the machine signatures.
(b) If the hard disk is reformatted, will it still give the same machine signature?
No. The machine signature is also bound to the Operating System.

I am implementing a Terminate procedure. I note that SlSAdmin.exe tells you to save the code. Why? Do you use it later if you want to reinstate the key? I thought License() or SetLicence() could be used for that.
The only reason that SlsAdmin tells the user to save termination code is that a software publisher, such as yourself, might want to confirm that the licence was genuinely terminated. You can verify a termination code by running SlsGen and select Tools|Verify Termination Code.

If we have the user send us a termination code as proof of termination, then do you have functionality such that I can input that code and parse it into the server code, AccesFeature, ConcUser, Etc? Or would I have to do it by hand?
The API function you need is called "SLS_VerifyTerminationCode". It is located in the Extended Library SlsLocalEx.dll and documented in the topic "Developers' Guide|Windows Library|Extended Library.

I have been able to successfully export a licence from a source machine and to import it to a target machine. However, I am never able to import the licence back to the source machine - the error I get when trying to import a licence back to the source machine is "Import licence key has expired".
In the "exporting licence" dialog box there is a field called "expiry date" which defaults to the current date. Unless you change the expiry date the licence you export will have the expiry date of the date it is created.

Is it possible for us to provide our customers with an non-expiring licence but they can enter an expiry date in the licence when they temporarily export that licence?
Yes. For example, a user can export a licence key from the 'pool' of keys on the server. The exported key will expire after the period set by the user and the key on the server will be revived at that time.

Can the publisher place limits (e.g. 3 months…) on the maximum time that an exported licence can 'live' in the exported state, while the main licence does not expire?
No. Only the user has control of an exported licence key.

Why is the Publisher Data accessible to a user? We assumed this would be useable only by the publisher to securely transfer certain useful values via the licence key codes assigned in SlsGen.exe. User access seems to thwart that...
Publishers may want the users to report the data to them. You could try encrypting the data if this is a problem. Note that the Licence Key does not pass these values to the client - Publisher Data is stored with the Licence Key but does not form part of it.

I currently trying incorporate additional information into the installation about the customer, and the Publisher Data field seems to be the idea tool to do this but whatever I place in this field within the Licence Key Generator, I always get the same value back from the API or the Sheriff Administrator...
The sole function of that Publisher Data edit box is to allow the Publisher Data to be logged together with the Licence Key. In other words, the Publisher Data entered into the License Key Generator does not become part of the Licence Key, it is only logged in the "slsgen.log". To use the Publisher Data you have to call "Sls_SetPublisherData" function, similar to the way that you would need to call SLS_SetLicence to set the Licence Key.

Let's say that I want to sell my software through a distributor. I want to give him the ability to issue a limited number of keys and then he would have to come back to me for more. Does your software handle this situation and if so, is only one license purchase required?
You will need to write your own clone of the Sheriff Licence Generator (SlsGen) application and protect it with Sheriff. You will need two Serial Numbers, one for the SlsGen clone and another for your product. To implement this you must use a Sheriff extended library, such as SlsLocalEx.dll, and call SLS_GenerateLicenceKey in order to issue licence keys with your own application. You will also need to control the number of keys that can be generated, which means that you have to somehow meter the application (which is why you need to protect your licence generating application too, using a separate Serial Number).

We are developing a product which is version based and we need to be able to give a trial period for all versions:

  1. For the Version 1, we have a 30 day eval period. So, from the application we check the licence and, using this 30 day information, we distinguish between registered and unregistered users. Is there any way for us to provide the trial version again for Version 2?
  2. For people who pay for Version 2, is there a way to avoid going through the registration process again. Can they enter the same licence key they registered for Version 1?
  1. A trial Licence Key is generated (issued) in the same way as a normal Licence Key. So it is up to you to generate a Licence Key that fufills the requirements of a "trial" licence
  2. Normally, to generate (issue) a new Licence Key you will have to ask the user to generate a new Reference Code. However, Sheriff does offer an option by which the user can re-use the Reference Code. In the Licence Generator you'll find an option called "Reusable Reference Code". This option is only available when Expiry Date metering has been selected. It is used when you want to be able to extend the date on which the licence will expire without first contacting the user for a new Reference Code. In this way you can at any time extend the period for which your application will run simply by generating a new Licence Key for the user.