Licensing Development Kit (LDK)
The LDK is an ActiveX component that may be used instead of the SLU. The LDK provides an interface for a developer to set the License Configuration File path and other properties as well as initiate requests to the licensing web service to generate license keys.
When installing the license, the user you are running as must have Administrator access so that the Registry can be accessed and the license can be added to the system.
The files for the SLU (slu.exe and AccuLicClient.dll) are stored on the development machine by the product installer. You can find them in the sub-path "Common\Licensing\Deployment" in the product's main install location.
Assigned Access Keys
Unlike the SLU, the LDK allows for the optional assignment of Access Keys to specific users. By doing this, you can specify which of your licenses are assigned to your users. This also limits the distribution of licenses. When Runtime licenses are purchased, a list of Access Keys is distributed to you for this use.
You can log into the
customer portal and go to the deployment purchased item where you will be able to download the access keys.
Automatic (Connected) Mode Registration
This mode corresponds to the Automatic (Connected) Registration section described in the SLU section. The process is shown in the C# sample code below:
|
Copy Code
|
// Instantiate the LDK ActiveX component
IDeploymentComponent ldk = new DeploymentComponent();
// Set the path to the configuration file provided
// when the Runtime licenses were purchased.
ldk.ConfigPath = @"C:\config.txt";
// Attempt to get the next available license.
// Note that you may alternately pass an Access Key
ldk.GetLicKeyAuto("");
if (ldk.ResultCode != enumLdkErrorCodes.LDK_SUCCESS)
{
// Automatic Registration Failed - A temporary license
// has been installed but will expire in 15 days.
// TODO add code to notify user of issue and 15 day expiration.
if (ldk.ResultCode == enumLdkErrorCodes.LDK_ERR_INET_CONN_BROKEN)
{
// No Internet Connection – Optionally do manual registration
}
}
else
{
// The license has been registered and installed.
}
|
The registration process is then complete. If any part of the registration process fails, a temporary license key is installed and is typically valid for 15 days. During this time, you are allowed to use the product while resolving any licensing related problems.
Manual (Disconnected) Mode Registration
This mode corresponds to the Manual (Disconnected) Registration section described in the SLU section. The process is shown in the C# code below:
|
Copy Code
|
// Instantiate the LDK ActiveX component
IDeploymentComponent ldk = new DeploymentComponent();
// Set the path to the configuration file provided
// when the Runtime licenses were purchased.
ldk.ConfigPath = @"C:\config.txt";
// Get the hardware key for the system. Note
// that you may alternately pass an Access Key
string hardwareKey = ldk.GetHdwKey("");
// Write the hardware key to some type of removable media.
ApplicationSpecificMethodToWriteHardwareKey(hardwareKey);
|
At this point, you have the hardware key on some type of removable media. Take the media to a system that is connected to the Internet, acquire the license key by uploading the hardware key, write the new license key to the removable media, and then return to the disconnected system. The application then reads the license key from the removable media and installs the license key as shown below.
|
Copy Code
|
// After taking the hardware key to a system with an Internet
// connection and acquiring the license key string from the
// manual registration web site, read the key into your
// application.
string manuallyAcquiredLicenseKey = ApplicationSpecificMethodToReadLicenseKey();
// Install the license key
ldk.LicKey = manuallyAcquiredLicenseKey;
|
The manual license registration and installation is then complete. Like the automatic case above, if any error occurs during the setting of the license key, a temporary license is installed.
Evaluation
The LDK also has the ability to install an Evaluation license for purchased runtime products. This process is simply:
|
Copy Code
|
// Instantiate the LDK ActiveX component
IDeploymentComponent ldk = new DeploymentComponent();
// Set the path to the configuration file provided
// when the Runtime licenses were purchased.
ldk.ConfigPath = @"C:\config.txt";
// Install an Evaluation license
ldk.StartEvalPeriod();
|
Licensing Development Kit Interface
The interface to the LDK is shown below:
|
Copy Code
|
interface IDeploymentComponent : IDispatch
{
[propget, id(1)] HRESULT LicKey([out, retval] BSTR* pVal);
[propput, id(1)] HRESULT LicKey([in] BSTR newVal);
[propget, id(2)] HRESULT srvURL([out, retval] BSTR* pVal);
[propput, id(2)] HRESULT srvURL([in] BSTR newVal);
[propget, id(3)] HRESULT ConfigPath([out, retval] BSTR* pVal);
[propput, id(3)] HRESULT ConfigPath([in] BSTR newVal);
[propget, id(4)] HRESULT ResultString([out, retval] BSTR* pVal);
[propget, id(5)] HRESULT ResultCode([out, retval] enumLdkErrorCodes* pVal);
[id(6)] HRESULT GetLicKeyAuto([in] BSTR accKey);
[id(7)] HRESULT GetHdwKey([in] BSTR accKey, [out,retval] BSTR* hdwKey);
[id(8)] HRESULT StartEvalPeriod(void);
[propget] HRESULT LicenseInfo([out, retval] BSTR* pVal);
[propput] HRESULT LicenseInfo([in] BSTR newVal);
[id(10)] HRESULT GetEvalPeriod([out, retval] long* pVal);
};
|
Licensing Development Kit Properties
- LicKey - Stores the License Key to the registry when it is set, and reads it from the registry during the get operation.
- srvURL - Gets and sets the URL path to the licensing web service. The default is the URL path to Accusoft’s Deployment Licensing Service.
- ConfigPath - Gets and sets a path to the deployment configuration file. Multiple products can be registered at one time by setting the filenames as a semicolon-delimited list: e.g., "c:\config.txt;c:\config2.txt".
- ResultString - Contains the string descriptions of any error that may have occurred during the last operation.
- ResultCode - Can be used to contain any of the error codes described in Licensing Component Error Codes and Messages.
- LicenseInfo - Used to transfer license information onto new system hardware. To transfer the license information into new system hardware, do the following:
- Get the LicenseInfo value of the current/source system and store it in a safe place.
- Change the system hardware.
- Set the LicenseInfo to the value you saved in step 1.
- Run the GetLicKeyAuto method (or perform its manual equivalent) to obtain a license for the new system hardware.
Licensing Development Kit Methods
- GetLicKeyAuto - Obtains a License Key for the end user’s system using the automatic (or connected) scenario. It takes an Access Key as its input parameter, and stores the obtained license key in the registry. If you choose not to distribute individual Access Keys, the accKey argument should be an empty string.
- GetHdwKey - Obtains a hardware key from the current machine and returns it (as hdwKey). If you choose not to distribute individual access keys, the accKey argument should be an empty string.
- StartEvalPeriod - Sets an Evaluation licensing mode for the product and starts an evaluation period. This method is provided so you can distribute an evaluation version of your application, without having to distribute Access Keys to people who would like to evaluate your software. Using this method you can license Accusoft components on the end user’s system for a limited time – the default is 30 days, but it can be customized per request to Accusoft. If the evaluators purchase your software, you can then issue them an access key using either the automatic or manual scenarios to obtain permanent component licenses, just as Accusoft does for its evaluators.
- GetEvalPeriod - Obtains the remaining time on an evaluation (in days). It returns EvalPeriod < 0 if the evaluation period is expired.