Developer Zone

License Management

Revulytics Usage Intelligence allows you to maintain your own license key registry on the Revulytics Usage Intelligence server in order to track license key usage and verify the status/validity of license keys used on your clients.

There are multiple ways the key registry is populated with license keys.

  1. Keys are collected automatically from your clients whenever you call the TBClass.KeyChanged method.
  2. You can add/edit keys manually via the Revulytics Usage Intelligence web UI.
  3. You can upload keys in bulk using CSV files from the Revulytics Usage Intelligence web UI.
  4. You can add/edit keys directly from your CRM by using the Revulytics Usage Intelligence Web API.

Please check out this KBase article to learn about the correct file format when uploading keys to the Revulytics Usage Intelligence Key Registry: http://helpdesk.revulytics.com/knowledgebase.php?article=41.

Client vs. Server Managed Licensing

Revulytics Usage Intelligence gives you the option to choose between managing your license key status (i.e. Blacklisted, Whitelisted, Expired or Activated) and key type on the server (server managed) or managing this status youself through your client (client managed). You can individually set whether each license status or license type is either Sever Managed or Client Managed by visiting the License Key Management Settings page on the Revulytics Usage Intelligence web UI. The major difference is outlined below:

1- Client managed: The server licensing mechanism works in reporting-only mode and your application is expected to notify the server that the license status has changed through the use of TBClass.SetLicense.

When to use: You have implemented your own licensing module/mechanism within your application that can identify whether the license key used by this client is blacklisted, whitelisted, expired or activated. In this case you do not need to query the Revulytics Usage Intelligence server to get this license status. However you can simply use this function to passively inform Revulytics Usage Intelligence about the license status used by the client. In this case:

  1. Revulytics Usage Intelligence will use this info filter and report the different key types and statuses and their activity.
  2. Revulytics Usage Intelligence licensing server will operate in passive mode (i.e. reporting only).
  3. Calling TBClass.KeyCheck will return FunctionNotAvailable since the key status is client managed.

2- Server managed: You manage the key status on the server side and your application queries the server to determine the status of a particular license key by calling TBClass.KeyCheck or TBClass.KeyChanged.

When to use: If you do not have your own licensing module/mechanism within your application and thus you have no way to identify the license status at the client side. In this mode, whenever a client changes their license key your application can call TBClass.KeyChanged to register the new license key. In reply to this API call, the server will check if the license key exists on the key register and in the reply it will specify to your application whether this key is flagged as blacklisted, whitelisted, expired or activated, along with the type of key submitted. If you want to verify a key without actually registering a key change for this client you can use TBClass.KeyCheck that returns the same values but does not register this key with the server. In this case:

  1. The key register is maintained manually on the server by the software owner
  2. Revulytics Usage Intelligence licensing server will operate in active mode so apart from using this key info for filtering and reporting, it will also report back the key status (validity) to the SDK whenever requested through the API.
  3. Calling TBClass.KeyCheck or TBClass.KeyChanged will return the 4 status flags denoting whether a registered key is: Blacklisted, Whitelisted, Expired and Activated and the key type.
  4. If the key does not exist on the server, all 4 status flags will be returned as false (0).
TBLicenseInfo TBClass.KeyCheck (String licKey)

By using this method, your software can validate a license key (entered by your client) with the key registry stored on the Revulytics Usage Intelligence server. The function accepts a string parameter that is the license key itself and returns a TBLicenseInfo object.

Parameters:

licKey (string) - The license key to be tested.

Return Type:

An object of type TBLicenseInfo

Code Example:

Passing “Test Key” as the key and checking the return

// Create instance
TBClass tb = new TBClass("<path to Revulytics Usage Intelligence SDK .NET library>");
// Other initialization.....

TBLicenseInfo kCheck = tb.KeyCheck("TEST KEY");
if (kCheck.Status == GenericReturn.OK){
    //Check if the license is activated
    if (kCheck.LicenseActivated == 1){
        MessageBox.Show("License Active");
    } else if (kCheck.LicenseActivated == 0) {
        MessageBox.Show("License Inactive");
    } else {
        MessageBox.Show("License state unknown");
    }

    //check if key is black listed
    if (kCheck.LicenseBlacklisted == 1){
        MessageBox.Show("Key is black listed");
    } else if (kCheck.LicenseBlacklisted == 0) {
        MessageBox.Show("Key is NOT black listed");
    } else {
        MessageBox.Show("Key black list state is unknown");
    }

    //Check if key is expired
    if (kCheck.LicenseExpired == 1){
        MessageBox.Show("Key is expired");
    } else if (kCheck.LicenseExpired == 0) {
        MessageBox.Show("Key is NOT expired");
    } else {
        MessageBox.Show("Key expiration state is unknown");
    }

    //Check if key is white listed
    if (kCheck.LicenseWhiteListed == 1){
        MessageBox.Show("Key is white listed");
    } else if (kCheck.LicenseWhiteListed == 0) {
        MessageBox.Show("Key is NOT white listed");
    } else {
        MessageBox.Show("Key whitelist state is unknown");
    }
} else if (kCheck.Status == GenericReturn.AuthenticationFailure) {
    MessageBox.Show("Authentication Failure");
} else if (kCheck.Status == GenericReturn.FunctionNotAvailable) {
    MessageBox.Show("Function is not currently available");
} else if (kCheck.Status == GenericReturn.ServerError) {
    MessageBox.Show("Server Error");
} else if (kCheck.Status == GenericReturn.ConnectionError) {
    MessageBox.Show("Connection Error");
} else if (kCheck.Status == GenericReturn.InternalError) {
    MessageBox.Show("Internal Error");
}

TBLicenseInfo TBClass.KeyChanged (String licKey)

This method should be called when an end user is trying to enter a new license key into your application and you would like to confirm that the key is in fact valid (i.e. blacklisted or whitelisted), active, or expired. The method is very similar to the TBClass.KeyCheck method, however rather than just being a passive license check, it also registers the new key with the server and associates it with this particular client installation. The method accepts a string parameter that you should use to pass the key and returns a TBLicenseInfo object.

Parameters:

licKey (string) - The license key to be tested.

Return Type:

An object of type TBLicenseInfo

Code Example:

Changing the key to “Test Key Number 2” and checking the return

// Create instance
TBClass tb = new TBClass("<path to Revulytics Usage Intelligence SDK .NET library>");
// Other initialization.....

TBLicenseInfo kCheck = tb.KeyChanged("Test Key Number 2");
if (kCheck.CallStatus < 0){
    MessageBox.Show("Error in keycheck");
} else {
    if (kCheck.Status == GenericReturn.OK)
    {
      //Check if the license is activated
      if (kCheck.LicenseActivated == 1){
        MessageBox.Show("License Active");
      } else if (kCheck.LicenseActivated == 0) {
        MessageBox.Show("License Inactive");
      } else {
        MessageBox.Show("License state unknown");
      }

      //check if key is black listed
      if (kCheck.LicenseBlacklisted == 1){
        MessageBox.Show("Key is black listed");
      } else if (kCheck.LicenseBlacklisted == 0) {
        MessageBox.Show("Key is NOT black listed");
      } else {
        MessageBox.Show("Key black list state is unknown");
      }

      //Check if key is expired
      if (kCheck.LicenseExpired == 1){
        MessageBox.Show("Key is expired");
      } else if (kCheck.LicenseExpired == 0) {
        MessageBox.Show("Key is NOT expired");
      } else {
        MessageBox.Show("Key expiration state is unknown");
      }

      //Check if key is white listed
      if (kCheck.LicenseWhiteListed == 1){
        MessageBox.Show("Key is white listed");
      } else if (kCheck.LicenseWhiteListed == 0) {
        MessageBox.Show("Key is NOT white listed");
      } else {
        MessageBox.Show("Key whitelist state is unknown");
      }
    } else if (kCheck.Status == GenericReturn.AuthenticationFailure){
        MessageBox.Show("Authentication Failure");
    } else if (kCheck.Status == GenericReturn.FunctionNotAvailable){
        MessageBox.Show("Function is not currently available");
    } else if (kCheck.Status == GenericReturn.ServerError){
        MessageBox.Show("Server Error");
    } else if (kCheck.Status == GenericReturn.ConnectionError){
        MessageBox.Show("Connection Error");
    } else if (kCheck.Status == GenericReturn.InternalError) {
        MessageBox.Show("Internal Error");
    }
}

class TBLicenseInfo

This is a simple class that contains properties that represent the status of a license key. An instance of this class is returned when calling the methods TBClass.KeyCheck and TBClass.KeyChanged.

The properties are as follows:

* KeyType keyType
* int LicenseBlacklisted
* int LicenseExpired
* int LicenseActivated
* int LicenseWhiteListed
* GenericReturn ReturnStatus

KeyType is an enum with the following values:

* Evaluation (0)
* Purchased (1)
* Freeware (2)
* Unknown (3)
* NFR (4)     // Not for Resale
* Custom1 (5)
* Custom2 (6)
* Custom3 (7)