ImageGear .NET - Updated
Using the LDK when the Target Machine Does Not Have Internet Access (Offline Mode)
User Guide > Licensing and Distributing > Runtime Licensing > Node-Locked Licensing > Using the LDK when the Target Machine Does Not Have Internet Access (Offline Mode)

If you are using the LDK and anticipate that there will be target machines that do not have internet access for security or other reasons, you will need to account for some additional interaction points, some of them manual. The instructions here delineate the general process and indicate where you will need to write some additional code to account for these interaction points.

  1. Build a new project that utilizes the LDK module to acquire the license key.    
    You can use the LDK module in any project. But, we recommend building a separate project so that it will be easier to isolate the licensing apart from your normal application operation.
  2. Add the AccuLicClient.dll to your project references. AccuLicClient.dll is available in the following folders:
    • C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Licensing\Deployment\x64
    • C:\Users\Public\Documents\Accusoft\ImageGear.NET v24\Licensing\Deployment\x86
  3. You'll need to register AccuLicClient.dll on the target machine during runtime, for example, as part of your installation or licensing process.
    • In your code, run the following to COM-register AccuLicClient.dll on the target machine: 
      Copy Code
      %SYSTEMROOT%\System32\regsvr32.exe AccuLicClient.DLL
      Copy Code
      %SYSTEMROOT%\syswow64\regsvr32.exe AccuLicClient.DLL
  4. Add the license configuration file (and the access key file, if you’re assigning access keys) that you downloaded in step 1: Generate a License Configuration File.

  5. When using the LDK module on a target machine that does not have internet access, these are the main steps to be done in your code:

    1. Obtain the hardware key from the target machine (via GetHdwKey())
      The following code example extends the example provided in the Using the LDK when the Target Machine Has Internet Access (Online Mode) to demonstrate how to handle the offline scenario (i.e., when the target machine does not have an internet connection).
      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";
      //Check to see if a license is currently on the machine
      //If so, then there’s no need to proceed
      If (ldk.LicKey != "")
           MessageBox.Show("A license already exists on this machine.");
      // Attempt to get the next available license.
      // Pass an Access Key as a parameter if you are using annual licensing or have opted to use Access Keys
      if (ldk.ResultCode != enumLdkErrorCodes.LDK_SUCCESS)
          // Automatic Registration Failed - A temporary license
          // has been installed but will expire in 14 days.
          // You will need to add code to notify your user of this issue and the 14 day
          // expiration.
          if (ldk.ResultCode == enumLdkErrorCodes.LDK_ERR_INET_CONN_BROKEN)
              // You will need to handle what happens when your user does not have an internet connection on the target machine.
              // Get the hardware key for the target system. Note
              // that you may optionally pass an Access Key
              string hardwareKey = ldk.GetHdwKey("");
              // Write the hardware key to some type of removable media.
              // Uncomment the next line and use your custom method ...
              // ApplicationSpecificMethodToWriteHardwareKey(hardwareKey);
          // The license has been registered and installed.
    2. You will need to handle how you will get the hardware key to a system with internet access so that your user can receive the returned license key. For example, they could copy it into a text file and send it to you so that you could obtain a license on a system that has internet access (e.g., copy to a portable storage device, network drive, or via email).
    3. On a machine with internet access:
      1. Open a browser and go to the Accusoft Licensing Center page.
      2. Paste the hardware key.
      3. Click Download License to download a text file with the generated license key.
      4. You can download your access key listing from your license pool in the customer portal. You must provide an access key if you are using Annual Licenses; if you’re not using Annual Licenses, then access keys are optional. Access keys allow you to track which machines are assigned licenses. In cases where you don't supply an access key, the licensing component will assign an access key for you.
      5. Copy the file with the license key (and access key, if using) into a text file that you can transfer back to the offline target machine.
    4. Copy and paste the license key back onto the machine to be licensed. Set the LicKey property in the LDK module with its value to have it placed onto the system.
      Copy Code
      // After taking the hardware key to a system with an Internet
      // connection and acquiring the license key string from the
      // manual registration website, read the key into your
      // application.
      // Uncomment the next line and use your custom method …
      // string manuallyAcquiredLicenseKey = ApplicationSpecificMethodToReadLicenseKey();
      // Install the license key
      ldk.LicKey = manuallyAcquiredLicenseKey;
  6. Execute your built application on the target machine.
    On successfully executing your code, the license provided in the LicKey property is then placed into the registry.

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 );
[id(10)] HRESULT GetEvalPeriod ( [out, retval] long* pVal );

LDK Properties

LDK Methods