Class Key

java.lang.Object
io.cryptolens.methods.Key

public class Key extends Object

A collection of methods that operate on a license key. Please see a complete list here.

Note (for Android): it's important to run these methods asynchronously, as shown below:

 Thread thread = new Thread(new Runnable() {
     @Override
     public void run() {
         // call eg. Key.Activate(...).
     }
 });
 thread.start();
 

Moreover, the manifest file needs to have internet permission, which can be added as shown below:

 <uses-permission android:name="android.permission.INTERNET"/>

 <application ....
 
  • Constructor Details

    • Key

      public Key()
  • Method Details

    • Activate

      public static LicenseKey Activate(String token, String RSAPubKey, ActivateModel model)
      Calls the Activate method (https://app.cryptolens.io/docs/api/v3/Activate).
      Parameters:
      token - The access token with 'Activate' permission.
      RSAPubKey - Your RSA Public Key, which can be found at https://app.cryptolens.io/docs/api/v3/QuickStart.
      model - Method parameters.
      Returns:
      A LicenseKey object if success and null otherwise.
    • Activate

      public static LicenseKey Activate(String token, String RSAPubKey, ActivateModel model, APIError error)
      Calls the Activate method (https://app.cryptolens.io/docs/api/v3/Activate?modelVersion=3).

      This method allows you to retrieve the error message from the Web API.

      To retrieve the error message, you need to initialize an APIError object and pass it in into the "error" parameter. For example,

      APIError error = new APIError();
      LicenseKey license = Key.Activate(auth, RSAPubKey, new ActivateModel(3349, "ICVLD-VVSZR-ZTICT-YKGXL", Helpers.GetMachineCode()), error);
      System.out.println(error.message);
      Parameters:
      token - The access token with 'Activate' permission.
      RSAPubKey - Your RSA Public Key, which can be found at https://app.cryptolens.io/docs/api/v3/QuickStart.
      model - Method parameters.
      error - The error object whose Message field will be populated if an error has occurred. Please initialize this parameter, i.e. define APIError error = new APIError(); and then pass error into this parameter.
      Returns:
      A LicenseKey object if success and null otherwise.
    • GetKey

      public static LicenseKey GetKey(String token, String RSAPubKey, GetKeyModel model)
      Calls the GetKey method (https://app.cryptolens.io/docs/api/v3/GetKey?modelVersion=3).

      This method allows you to retrieve the error message from the Web API.

      To retrieve the error message, you need to initialize an APIError object and pass it in into the "error" parameter. For example,

      APIError error = new APIError();
      LicenseKey license = Key.GetKey(auth, RSAPubKey, new GetKeyModel(3349, "ICVLD-VVSZR-ZTICT-YKGXL"), error);
      System.out.println(error.message);
      Parameters:
      token - The access token with 'GetKey' permission.
      RSAPubKey - Your RSA Public Key, which can be found at https://app.cryptolens.io/docs/api/v3/QuickStart.
      model - Method parameters.
      Returns:
      A LicenseKey object if success and null otherwise.
    • GetKey

      public static LicenseKey GetKey(String token, String RSAPubKey, GetKeyModel model, APIError error)
      Calls the GetKey method (https://app.cryptolens.io/docs/api/v3/GetKey?modelVersion=3).

      This method allows you to retrieve the error message from the Web API.

      To retrieve the error message, you need to initialize an APIError object and pass it in into the "error" parameter. For example,

      APIError error = new APIError();
      LicenseKey license = Key.GetKey(auth, RSAPubKey, new GetKeyModel(3349, "ICVLD-VVSZR-ZTICT-YKGXL"), error);
      System.out.println(error.message);
      Parameters:
      token - The access token with 'GetKey' permission.
      RSAPubKey - Your RSA Public Key, which can be found at https://app.cryptolens.io/docs/api/v3/QuickStart.
      model - Method parameters.
      error - The error object whose Message field will be populated if an error has occurred. Please initialize this parameter, i.e. define APIError error = new APIError(); and then pass error into this parameter.
      Returns:
      A LicenseKey object if success and null otherwise.
    • Deactivate

      public static boolean Deactivate(String token, DeactivateModel model)
      This method will 'undo' a key activation with a certain machine code. The key should not be blocked, since otherwise this method will throw an error. More info: https://app.cryptolens.io/docs/api/v3/Deactivate
      Parameters:
      token - The access token with 'Deactivate' permission.
      model - Method parameters.
      Returns:
      True if deactivation succeeded and false otherwise.
    • Deactivate

      public static boolean Deactivate(String token, DeactivateModel model, APIError error)
      This method will 'undo' a key activation with a certain machine code. The key should not be blocked, since otherwise this method will throw an error. More info: https://app.cryptolens.io/docs/api/v3/Deactivate
      Parameters:
      token - The access token with 'Deactivate' permission.
      model - Method parameters.
      error - The error object whose Message field will be populated if an error has occurred. Please initialize this parameter, i.e. define APIError error = new APIError(); and then pass error into this parameter.
      Returns:
      True if deactivation succeeded and false otherwise.
    • CreateTrialKey

      public static CreateKeyResult CreateTrialKey(String token, CreateTrialKeyModel model)

      This method creates a license key that is time-limited, node-locked and with the "Time-Limited" and "Trial" features set to true (which can be set by editing the feature definitions on the product page). Note, by default, the trial will work for 15 days. To change this limit, you can set the Feature Lock to the desired value, when creating the access token.

      If a trial key was already created for a certain machine code, this method will try to find the license key and return it instead. However, this will only occur if the license key is still a trial key (based on feature definitions) and is not blocked.

      Parameters:
      token - The access token with 'CreateTrialKey' permission.
      model - Method parameters.
      Returns:
      A new license key or error message.
    • CreateTrialKey

      public static CreateKeyResult CreateTrialKey(String token, CreateTrialKeyModel model, APIError error)

      This method creates a license key that is time-limited, node-locked and with the "Time-Limited" and "Trial" features set to true (which can be set by editing the feature definitions on the product page). Note, by default, the trial will work for 15 days. To change this limit, you can set the Feature Lock to the desired value, when creating the access token.

      If a trial key was already created for a certain machine code, this method will try to find the license key and return it instead. However, this will only occur if the license key is still a trial key (based on feature definitions) and is not blocked.

      Parameters:
      token - The access token with 'CreateTrialKey' permission.
      model - Method parameters.
      error - The error object whose Message field will be populated if an error has occurred. Please initialize this parameter, i.e. define APIError error = new APIError(); and then pass error into this parameter.
      Returns:
      A new license key or error message.
    • ExtendLicense

      public static boolean ExtendLicense(String token, ExtendLicenseModel model, APIError error)
      This method will extend a license by a certain amount of days. If the key algorithm in the product is SKGL, the key string will be changed if necessary. Otherwise, if SKM15 is used, the key will stay the same. More about the way this method works in Remarks.
      Parameters:
      token - The access token with 'ExtendLicense' permission.
      model - Method parameters.
      error - The error object whose Message field will be populated if an error has occurred. Please initialize this parameter, i.e. define APIError error = new APIError(); and then pass error into this parameter.
      Returns:
      True if successful and false otherwise.