Today we have released a client library for Node.js, which can be installed quite easily using the command below:
npm install cryptolens
Once it’s installed, you can verify a license key using the code below:
const Key = require('cryptolens').Key;
var RSAPubKey = "{Your RSA Public key, which can be found here: https://app.cryptolens.io/User/Security}";
var result = Key.Activate(token="{Access token with with Activate permission}", RSAPubKey, ProductId=3349, Key="GEBNC-WZZJD-VJIHG-GCMVD", MachineCode="test");
result.then(function(license) {
if (!license) {
// failure
return;
}
// Please see https://app.cryptolens.io/docs/api/v3/model/LicenseKey for a complete list of parameters.
console.log(license.Created);
});
If you want to load a license key (eg. for offline activation), you can use LoadFromString method available in the Helpers namespace. You can read more about it here.
Disclaimer: this is not an April joke, we support Node.js for real 🙂
Not a customer yet? Sign Up for a free trial and implement our software licensing system within minutes.
If you want to implement a Golang License Key Manager, there are two main choices to make. A simple way to get started with software licensing in a Golang application is by creating a simple license key generator and a subset of license keys to validate. However, many software vendors quickly rule out that option and instead, opt for a more serious and long-term software licensing solution. In this blog, we will briefly cover the benefits of outsourcing software licensing as opposed to coding your own software license key manager for your Golang product.
Golang License Key Generator – A Shortcut to Licensing
So why is a license key generator not a scalable and long-term solution for Golang apps? Well, a simple self-coded license key generator only performs partial license key verification, and the structure you use to create a subset of license keys will start to leak over time. As a result, this solution is quite easy to bypass. Coding a key generator is usually fine for smaller prototypes and for learning purposes. However, for applications in production, a more long-term and serious software license manager is oftentimes needed. You can read more about this option in this blog post.
Cryptolens – Your Golang License Key Manager
So how do you code a software licensing system that performs full license key verification? As you might expect, coding and maintaining a fully scalable software licensing system will take a lot of time. Many software vendors are instead outsourcing software licensing to a Licensing as a Service (LaaS) provider such as Cryptolens.
Then, you get all of our advanced licensing features in an easy-to-use dashboard from day 1. We support all major licensing models and have detailed guides in Golang, along with other languages. Implementing our cloud-based licensing solution is effortless!
Our Golang library is available on GitHub, and you can sign up to our platform for free. Then, you have to paste a short code snippet into your Golang code. Our full documentation page is available for reference, but to verify a license key, a similar code to the one below can be used:
Easily Unity software licensing with Cryptolens! Unity is a powerful cross-platform game engine. Since it uses C# as the scripting language, we can easily integrate it with Cryptolens client library. In this post, we explain how you can add license key verification into a Unity game and briefly cover payment integration.
Adding software licensing
Download the binaries (please pick those without “System.Management”).
Once licensing is in place, the next step is to add payment integration. Since Cryptolens is cloud-based, you can easily integrate it with your own billing system or use our existing integrations with popular platforms such as Stripe and PayPal. You can read more about how this can be accomplished here.
Please feel free to reach out should you have any questions!
Not a customer yet? Sign Up for a free trial and implement our software licensing system in Unity within minutes.
Floating licenses makes it easier for your customers to switch between machines that actively run your software, without having to deactivate them first. For instance, you can constrain the number of concurrent users to 10, but still allow the software to be installed on eg. 100 computers.
In Cryptolens, floating licensing works by letting your app to regularly poll the server to check if the number of concurrent users has been exceeded, which can be accomplished with the code snippet below:
import io.cryptolens.methods.*;
import io.cryptolens.models.*;
public static void main(String args[]) {
String RSAPubKey = "RSA Public Key";
String auth = "Access token";
LicenseKey license = Key.Activate(auth, RSAPubKey, new ActivateModel(3349, "MTMPW-VZERP-JZVNZ-SCPZM", Helpers.GetMachineCode(), 300, 1));
if (license == null || !Helpers.IsOnRightMachine(license, true, true)) {
System.out.println("The license does not work.");
} else {
System.out.println("The license is valid!");
System.out.println("It will expire: " + license.Expires);
}
}
Normally, if the app stops polling the server, that user will be automatically deactivated within the specified period of time. However, if you want to deactivate it instantly, you can use the code below:
import io.cryptolens.methods.*;
import io.cryptolens.models.*;
public static void main(String args[]) {
String auth = "";
boolean result = Key.Deactivate(auth, new DeactivateModel(3349, "MTMPW-VZERP-JZVNZ-SCPZM", Helpers.GetMachineCode(), true));
if (result == true) {
System.out.println("Deactivation successful.");
} else {
System.out.println("Deactivation failed.");
}
}
If you want to manage and create license keys for Java applications, you have a few different alternatives to choose between. The simplest way to implement software licensing is to code a license key generator that performs partial key verification. However, for more serious and long-term use cases, a software licensing solution that performs full key verification is to be preferred. In this blog, we will briefly cover those two alternatives to help you license and protect your Java applications with license keys.
License Key Generator in Java
A software license solution has to create a lock in your Java project that only unlocks the application if the user inserts a valid license key. Creating a license key generator is a shortcut to licensing where your code performs partial key verification and generates subsets of license keys. However, such a solution is far from optimal for larger-scale use. The structure that you use to generate license keys will leak over time, and it is quite easy to bypass the homemade and lightweight licensing system. If you want to learn more, please read this blog post.
LaaS – Manage and Create License Keys for Java Applications
Coding a software licensing system that performs full key verification and has the necessary licensing features you need for an application in production will take a lot of time and money. Outsourcing software licensing to a Licensing as a Service (LaaS) provider such as Cryptolens is then a more optimal choice for many software companies. Then, you get all of the advanced licensing features at a fraction of the price of coding and maintaining a licensing system yourself.
Getting started with our software license manager for Java applications is easy! Our Java client API allows you to easily verify license keys, and you can read more about how to add it to your project on GitHub. You then have to sign up to our platform for free and add a code snippet to your Java code.
Below is an example of the code that you can use in your application.
import io.cryptolens.Cryptolens;
import io.cryptolens.Helpers;
import io.cryptolens.LicenseKey;
public class Main {
public static void main(String[] args) {
String RSAPubKey = "<RSAKeyValue><Modulus>sGbvxwdlDbqFXOMlVUnAF5ew0t0WpPW7rFpI5jHQOFkht/326dvh7t74RYeMpjy357NljouhpTLA3a6idnn4j6c3jmPWBkjZndGsPL4Bqm+fwE48nKpGPjkj4q/yzT4tHXBTyvaBjA8bVoCTnu+LiC4XEaLZRThGzIn5KQXKCigg6tQRy0GXE13XYFVz/x1mjFbT9/7dS8p85n8BuwlY5JvuBIQkKhuCNFfrUxBWyu87CFnXWjIupCD2VO/GbxaCvzrRjLZjAngLCMtZbYBALksqGPgTUN7ZM24XbPWyLtKPaXF2i4XRR9u6eTj5BfnLbKAU5PIVfjIS+vNYYogteQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
Cryptolens cryptolens = Cryptolens.getDefault();
cryptolens.setRSAPublicKey(RSAPubKey);
Cryptolens.ActivateResponse response =
cryptolens.activate( "WyIyNTk1IiwidVVrQm94OGlYS3pHZlhTc0x6Rm9mN1piektrT0FSd0REaFZ0ZXZJMSJd"
, 3349
, "ICVLD-VVSZR-ZTICT-YKGXL"
, Helpers.GetMachineCode()
);
if (!response.successful()) {
System.out.println("Failed to activate!");
Cryptolens.ActivateServerError er = response.getServerError();
Exception ex = response.getException();
if (er != null) {
System.out.println("Server error: " + er);
}
if (ex != null) {
ex.printStackTrace(System.out);
}
return;
}
LicenseKey licenseKey = response.getLicenseKey();
System.out.println("Activation was successful!");
System.out.println(licenseKey.getKey());
System.out.println(licenseKey.getF1());
}
}
Not a customer yet? Sign Up for a free trial and implement our software licensing system within minutes.
How do you create license keys for software in Python? Well, setting up a Python license key system is effortless with Cryptolens. Instead of coding your own solution from scratch, we have detailed guides and SDKs so you can set up key verification and protect your Python code. If you want to read more about the code-it-yourself VS outsourcing route, please read this blog post.
We have also made the following YouTube video that goes into detail about how you implement a Python license key manager:
Creating License Keys for a Python Application
A software license management solution has to establish a lock in your software code that only allows entry to people who put in a valid digital license key. If the key is invalid, or if they are unable to insert a key, the system should deny entry to the application. Without this system in place, anyone can access your software app, and it becomes very difficult to sell such a product. That is why a software licensing solution is important when protecting your code against unauthorized users.
1. Let us begin with the SDK. Cryptolens offers comprehensive SDKs in your favorite programming languages, including Python, to make it effortless to implement a Licensing as a Service (LaaS) platform within minutes. Install our Python SDK here.
2. Create a free Cryptolens account to get access to our easy-to-use dashboard where you can create and manage license keys and restrictions. You can also find your access tokens and other parameters that you have to insert into your code. Cryptolens offers you a way to implement licensing for free at your own pace, and you only have to pay when you get customers of your own. Check out our pricing plans here, and you can always get started for free.
3. The last step for implementing a Python license key system is to insert a code snippet into your application’s code. We provide comprehensive help guides to make the implementation seem effortless. See the full code snippet in your programming language here. This is an overview of what the Python code snippet looks like:
from licensing.helpers import Helpers
from licensing.models import Response, RSAPublicKey
from licensing.methods import Key
pubKey = "<RSAKeyValue><Modulus>sGbvxwdlDbqFXOMlVUnAF5ew0t0WpPW7rFpI5jHQOFkht/326dvh7t74RYeMpjy357NljouhpTLA3a6idnn4j6c3jmPWBkjZndGsPL4Bqm+fwE48nKpGPjkj4q/yzT4tHXBTyvaBjA8bVoCTnu+LiC4XEaLZRThGzIn5KQXKCigg6tQRy0GXE13XYFVz/x1mjFbT9/7dS8p85n8BuwlY5JvuBIQkKhuCNFfrUxBWyu87CFnXWjIupCD2VO/GbxaCvzrRjLZjAngLCMtZbYBALksqGPgTUN7ZM24XbPWyLtKPaXF2i4XRR9u6eTj5BfnLbKAU5PIVfjIS+vNYYogteQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"
res = Key.activate(token="WyIyNTU1IiwiRjdZZTB4RmtuTVcrQlNqcSszbmFMMHB3aWFJTlBsWW1Mbm9raVFyRyJd",\
rsa_pub_key=pubKey,\
product_id=3349, key="ICVLD-VVSZR-ZTICT-YKGXL", machine_code="test")
if res[0] == None:
print("An error occured: {0}".format(res[1]))
else:
print("Success")
One of the problems experienced by software vendors when selling to large customers is that some of their machines that will be running the software do not have direct internet access.
Although it is still possible to use offline activation, having an active connection to Cryptolens makes things much easier for both you as the software vendor and your customers.
To solve this, we can use a license server that will re-route all the license verification requests from the computers in the network to Cryptolens, as shown below:
If you have already implemented key verification in your application, the license server can be set up quite quickly in two steps:
Several months ago, we introduced support for floating licenses, which, in simple terms, is a way to permit a certain number of concurrent end users at a time.
Overdraft license is a way to allow your users to temporarily exceed the upper bound of the number of concurrent licenses to take into account for potential peak usages. Once this occurs, a special event is going to be registered so that you can increase the limit in the next billing cycle.
In .NET, this can be implemented as follows (below, we allow the users to exceed the upper bound by one more concurrent license):
var auth = "{access token with permission to access the activate method}";
var result = Key.Activate(token: auth, parameters: new ActivateModel()
{
Key = licenseKey,
ProductId = 3349,
Sign = true,
MachineCode = Helpers.GetMachineCode(),
FloatingTimeInterval = 100, // needed for floating licenses
MaxOverdraft = 1 // needed to allow overdraft
});
if(Helpers.IsOnRightMachine(res2.LicenseKey, isFloatingLicense: true, allowOverdraft: true))
{
// everything OK!
}
On a mission to make software licensing more accessible, we have recently improved our Web API to make integrations with other services easier. For example, we have made it possible to return license keys as plain text, which many third party platforms require.
When selling software, there are two problems that need to be solved: payment processing and software licensing. Cryptolens core has always been the comprehensive licensing API. If you are using SendOwl or DPD, you can keep using them for payments and Cryptolens for software licensing.
If you have a new project, I would recommend to check out our new tutorial about built-in recurring payments and payment forms.
Not a customer yet? Sign Up for a free trial and implement our software licensing system within minutes.
A year ago we announced the ability to authenticate your customers inside the app using their credentials instead of using license keys. The key advantages are security (harder to crack properly secured account than a license key string) and time savings (customers can easily restore access to an account vs. restoring access to a lost license key). Today, we have released several changes to make the implementation of this much easier, as described under What’s new later in the article.
How Cryptolens approach is different
When we reviewed the way our competitors solve the problem of authenticating users, all of them used the simple solution of a method that takes in username and password and returns an access token. The problem with this approach is that the user needs to trust the client application, which can be compromised (eg. an attacker can create a similar app to trick the user to expose their login information). Even if the account itself may not pose high value, since users tend to reuse their passwords, it can serve as a gateway into their other accounts.
Instead of trusting the app, our approach puts trust in the web browser. The app will never receive the username or password. For extra-paranoid users, it is also possible to authenticate the request on a different machine.
To put the problem and our solution in simple terms, there is a concrete example from everyday life, namely when you pay using your credit card. The first approach we described is similar to paying using the terminal provided by the shop (i.e. you need to trust each store that their terminal does not record your card number and PIN). The second approach is similar to new types of payment methods where you need to scan a QR code and authorise the transaction on your phone. It is easier to trust your phone than the terminals provided by the store (and you will have to trust every single one of them).
What’s new
With the new release of Cryptolens.Licensing, implementation of account verification has become much simpler (as you can see later in the Getting started section). It now supports .NET Framework 4.0, 4.6 and .NET Standard 2.0. Moreover, we improved the backend to help automating account creation for customers (eg. portal link can now be obtained through Add Customer method).
Getting started
We have summarised the necessary steps to get started in this article. To sum up, two steps are necessary. First, you need to send an invite link to your customer (which can be automated). The second step is to include the following code in your application.
string RSAPubKey = "RSA Pub key";
string token = "access token with GetToken permission";
string existingToken = null; // in case you've already authenticated them once and the token is still valid.
var res = UserAccount.GetLicenseKeys(Helpers.GetMachineCode(), token, "TestApp", 30, RSAPubKey, existingToken);
if(res == null || !string.IsNullOrEmpty(res.Error))
{
Console.WriteLine("Something went wrong.");
}
// if they have a license with F1=true and which has not yet expired.
if(res.Licenses.Count(x => x.F1 == true && x.Expires >= DateTime.UtcNow && x.ProductId == 3349) > 0)
{
Console.WriteLine("Success");
}
else
{
Console.WriteLine("Failure");
}
Not a customer yet? Sign Up for a free trial and implement our software licensing system within minutes.