Java software licensing

Getting started with license key verifications in Java

Installing the Java SDK

The easiest way to add software licensing into your Java application is by installing our Java SDK, available open source on GitHub. There are two compilations of the library, cryptolens.jar and cryptolens-android.jar. If you plan to run your application on multiple platforms, we recommend using cryptolens-android.jar.

Example key verification

The code below verifies a license key with our API. This example is covered in more detail on this page. If your application needs to work offline, please check out the following article.

String RSAPubKey = "Enter the RSA Public key here.";
String auth = "Access token with permission to access the activate method.";

LicenseKey license = Key.Activate(auth, RSAPubKey, 
                      new ActivateModel(3349, 
                      "ICVLD-VVSZR-ZTICT-YKGXL", 
                      Helpers.GetMachineCode(2)));

if (license == null || !Helpers.IsOnRightMachine(license,2)) {
    System.out.println("The license does not work.");
} else {

    System.out.println("The license is valid!");
    System.out.println("It will expire: " + license.Expires);
}

For more information on how to obtain the parameters, please read more here.