An older tutorial on how to integrate Cryptolens licensing into a desktop application in .NET
This is an old tutorial that we have kept that shows how you can implement basic license verification in a .NET application. We recommend to review our Getting Started Guide and refer to our key verification tutorial for production ready examples.
Our aim of this tutorial is to guide you through, step by step, the process of implementing Cryptolens into your application. We’ll assume that you’ve developed a .NET application and use Visual Studio 2013. If you are using a different language, we recommend to check out this page.
If you want to jump straight into the code, please check out the key verification tutorial.
Our application will have three features (voice, audio and converter), and the ability to license these as a ‘subscription’ (time-limited) or ‘perpetual’ (unlimited time). We will check the license key when we have an Internet connection. If we’re offline, we will use the saved license file. The user will be able to use the software 90 days offline at most.
Now we can start using all of the power of the Cryptolens Client API.
The easiest way to get Cryptolens Client API is through NuGet in Visual Studio.
Manage NuGet Packages...
Now, type Cryptolens.Licensing
into the Browse tab, select SKM Client API
and install it.
We almost have all the pieces in place to get a working licensing solution. We will cover the code in this section and look at how to retrieve access tokens and public key (RSA) later.
Our application will have two places where we will need to insert the code:
You can download the source code here.
Note, you can find more detailed examples of .NET here and other environments here. Please don’t hesitate to contact us should you have any questions.
This code will retrieve all the license data (using Refresh
) and enable buttons depending on the features in the license. Features 3-5 indicate a certain functionality whereas Feature 1 is used to indicate a time-limit (in case it’s a subscription). Once we have a valid license, we will save it locally (it will be signed by SKM, because sign is set to true in Refresh
).
When your application launches, we will try to get a new version of the license key, in case it has been modified. If we don’t have internet access, we will use the local copy as long as 90 days have not passed since it was retrieved. Everything else is the same as when the user registers the license for the first time.
In all of the code examples, you will see variables such as token
or auth
. They refer to an access token.
The idea behind access tokens is to allow you to:
Using an access token, you can specify the methods you want to be able to call, the product you want to use, the license key, and optionally feature you want to change. You can read more about them here.
In order to create an access token with the permission required by the previous example:
In many cases, you will store license key data locally on your customers’ device, partly to allow your customers to use the application offline. At the same time, you don’t want them to be able to modify the license key data (for example, the number of features they are entitled to and expiration date).
Therefore, Cryptolens will sign the license key (if you explicitly tell it to do so) with your private key. The public key will allow your application to check that the license key file hasn’t been modified since it was by Cryptolens.
The public key won’t allow them to re-sign the data, only to validate it.
In order to find your unique public key:
publicKey
variable).We’re now ready to test the code using your account.
In case you kept the code as it is (without replacing the token and pubkey with yours), you can test the following:
IWXAZ-FVMOD-KBZQU-DKUFW
- all features in one years since this tutorial was writtenIYVOO-JCWXQ-LCRBI-ZAIQZ
- all features but the recorder with no time constraint.You have successfully completed this tutorial! If you would have any questions, please get in touch us with us using chatbox available on each page.
Good luck!
You’ve now implemented Cryptolens into your application. Here’s what’s next:
An older tutorial on how to integrate Cryptolens licensing into a desktop application in .NET
This is an old tutorial that we have kept that shows how you can implement basic license verification in a .NET application. We recommend to review our Getting Started Guide and refer to our key verification tutorial for production ready examples.
Our aim of this tutorial is to guide you through, step by step, the process of implementing Cryptolens into your application. We’ll assume that you’ve developed a .NET application and use Visual Studio 2013. If you are using a different language, we recommend to check out this page.
If you want to jump straight into the code, please check out the key verification tutorial.
Our application will have three features (voice, audio and converter), and the ability to license these as a ‘subscription’ (time-limited) or ‘perpetual’ (unlimited time). We will check the license key when we have an Internet connection. If we’re offline, we will use the saved license file. The user will be able to use the software 90 days offline at most.
Now we can start using all of the power of the Cryptolens Client API.
The easiest way to get Cryptolens Client API is through NuGet in Visual Studio.
Manage NuGet Packages...
Now, type Cryptolens.Licensing
into the Browse tab, select SKM Client API
and install it.
We almost have all the pieces in place to get a working licensing solution. We will cover the code in this section and look at how to retrieve access tokens and public key (RSA) later.
Our application will have two places where we will need to insert the code:
You can download the source code here.
Note, you can find more detailed examples of .NET here and other environments here. Please don’t hesitate to contact us should you have any questions.
This code will retrieve all the license data (using Refresh
) and enable buttons depending on the features in the license. Features 3-5 indicate a certain functionality whereas Feature 1 is used to indicate a time-limit (in case it’s a subscription). Once we have a valid license, we will save it locally (it will be signed by SKM, because sign is set to true in Refresh
).
When your application launches, we will try to get a new version of the license key, in case it has been modified. If we don’t have internet access, we will use the local copy as long as 90 days have not passed since it was retrieved. Everything else is the same as when the user registers the license for the first time.
In all of the code examples, you will see variables such as token
or auth
. They refer to an access token.
The idea behind access tokens is to allow you to:
Using an access token, you can specify the methods you want to be able to call, the product you want to use, the license key, and optionally feature you want to change. You can read more about them here.
In order to create an access token with the permission required by the previous example:
In many cases, you will store license key data locally on your customers’ device, partly to allow your customers to use the application offline. At the same time, you don’t want them to be able to modify the license key data (for example, the number of features they are entitled to and expiration date).
Therefore, Cryptolens will sign the license key (if you explicitly tell it to do so) with your private key. The public key will allow your application to check that the license key file hasn’t been modified since it was by Cryptolens.
The public key won’t allow them to re-sign the data, only to validate it.
In order to find your unique public key:
publicKey
variable).We’re now ready to test the code using your account.
In case you kept the code as it is (without replacing the token and pubkey with yours), you can test the following:
IWXAZ-FVMOD-KBZQU-DKUFW
- all features in one years since this tutorial was writtenIYVOO-JCWXQ-LCRBI-ZAIQZ
- all features but the recorder with no time constraint.You have successfully completed this tutorial! If you would have any questions, please get in touch us with us using chatbox available on each page.
Good luck!
You’ve now implemented Cryptolens into your application. Here’s what’s next: