Skip to content

Implement Software Activation and Authorization using .NET Licenser API assembly

Rustemsoft LLC edited this page Oct 25, 2018 · 1 revision

.NET Licenser API assembly gives you ability to program the licensing features in your application source code. By using .NET Licenser API you will be able bound your licensed application with user's hardware and check user PC unique code trough authentication web-service. Also by using the web-service you may block your application at user's PC if a license has been refunded by user.
Take a look at provided Licenser Sample projects to figure out how to code the licensing.

.NET Licenser API assembly generates software licenses that are bound to hardware. That means, licenses are activated persistently for specific computers or work stations. Hence, the licensed software may be installed and employed solely on the registered hardware.

Software Activation is the process of generating a computer bound license key. To generate the Registration ID use Skater Licenser interface. The activation Registration ID with your user Order Number can be sent to your customer directly from you. This key enables your software and allows the user to activate his license.

From your application, the user enters the Order Number and Registration ID. Your application then calls the .NET Licenser API which sends the license key along with a computer unique identifier to the .NET Licenser Web service. The .NET Licenser Web service then generates the special record on web database where the computer unique identifier will be stored. Every time when user will start your application it will check the identifier over the internet.

Licenser

To activate a license key (Order Number + Registration ID), your registered user has to invoke the Activate License Dialog (within your application) which displays a license registration form that allows the user to register the license. Also it implements the license authorization by checking user's computer hardware bound code through web service.
Example:

C#

// Define Licenser object to check your application activation 

{ 

RustemSoft.Licenser LicenserObject = new RustemSoft.Licenser(); 

// Define Licenser object properties values 

// Comment: That part of your code should be strictly obfuscated and encrypted by Skater technology 

LicenserObject.AuthorizeRegistrationID = "Trial"; 

LicenserObject.ApplicationTitle = "MyApplication"; 

LicenserObject.RegistryEntry_RegID = "HKEY_CURRENT_USER\\Software\\VB and VBA Program Settings"; 

LicenserObject.RegistryEntry_RegID_SubKey = "SomeRegID"; 

LicenserObject.TrialStopsByDays = true; 

LicenserObject.TrialDays = 30; 

LicenserObject.TrialEndDate = (System.DateTime)"02/20/2013"; 

LicenserObject.RegistryEntry_InstallDate = "HKEY_CURRENT_USER\\Software\\VB and VBA Program Settings"; 

LicenserObject.RegistryEntry_InstallDate_SubKey = "SomeDate"; 

LicenserObject.ReinstallProtection = true; 

LicenserObject.RegistryEntry_ReinstallStopMark = "HKEY_CURRENT_USER\\Software\\VB and VBA Program Settings"; 

LicenserObject.RegistryEntry_ReinstallStopMark_SubKey = "SomeMark"; 

LicenserObject.CryptographyPassword = "password"; 

LicenserObject.CheckHardwareThruWebService = true; 

LicenserObject.LicenseViolationMessage = "License violation!" + Constants.vbLf + "You can install " + LicenserObject.ApplicationTitle + " on one PC only."; 

LicenserObject.RequireConnectToInternet = true; 

LicenserObject.AllowInstallOnSecondPC = true; 

// Check if your application is active at the PC 

if (!LicenserObject.CheckActive()) { 

    // Some users may consider chargeback money that they spent for software license. 

    // To block your application at the user end you have to mark a specific license 

    // order number as 'Refunded' in Skater .NET Licenser interface. 

    if (LicenserObject.Refunded) { 

        MessageBox.Show("You got refund!", LicenserObject.ApplicationTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop); 

        // stop your application 

        System.Environment.Exit(0); 

    } 

    // Define your custom Trial window 

    frmTrial frm = new frmTrial(); 

    // Specify if the trial period is expired or not 

    frm.ShowTrialMessage = LicenserObject.CheckInstallDate(); 

    // Pop up Trial window 

    frm.ShowDialog(); 

    // If the trial period is expired or License violation perform an action that will stop your application 

    if (!frm.ShowTrialMessage | LicenserObject.LicenseViolation) { 

        System.Environment.Exit(0); 

    } 

} 

} 

VB.NET

' Define Licenser object to check your application activation

Dim LicenserObject As New RustemSoft.Licenser() 

' Define Licenser object properties values 

' Comment: That part of your code should be strictly obfuscated and encrypted by Skater technology 

LicenserObject.AuthorizeRegistrationID = "Trial" 

LicenserObject.ApplicationTitle = "MyApplication" 

LicenserObject.RegistryEntry_RegID = "HKEY_CURRENT_USER\Software\VB and VBA Program Settings" 

LicenserObject.RegistryEntry_RegID_SubKey = "SomeRegID" 

LicenserObject.TrialStopsByDays = True 

LicenserObject.TrialDays = 30 

LicenserObject.TrialEndDate = CDate("02/20/2013") 

LicenserObject.RegistryEntry_InstallDate = "HKEY_CURRENT_USER\Software\VB and VBA Program Settings" 

LicenserObject.RegistryEntry_InstallDate_SubKey = "SomeDate" 

LicenserObject.ReinstallProtection = True 

LicenserObject.RegistryEntry_ReinstallStopMark = "HKEY_CURRENT_USER\Software\VB and VBA Program Settings" 

LicenserObject.RegistryEntry_ReinstallStopMark_SubKey = "SomeMark" 

LicenserObject.CryptographyPassword = "password" 

LicenserObject.CheckHardwareThruWebService = True 

LicenserObject.LicenseViolationMessage = "License violation!" + vbLf + "You can install " + LicenserObject.ApplicationTitle + " on one PC only."

LicenserObject.RequireConnectToInternet = True 

LicenserObject.AllowInstallOnSecondPC = True 


' Check if your application is active at the PC 
If Not LicenserObject.CheckActive() Then 

    ' Some users may consider chargeback money that they spent for software license. 

    ' To block your application at the user end you have to mark a specific license 

    ' order number as 'Refunded' in Skater .NET Licenser interface. 

    If LicenserObject.Refunded Then 

        MessageBox.Show("You got refund!", LicenserObject.ApplicationTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop) 

        ' stop your application 

        End 

    End If 

    ' Define your custom Trial window 

    Dim frm As New frmTrial() 

    ' Specify if the trial period is expired or not 

    frm.ShowTrialMessage = LicenserObject.CheckInstallDate() 

    ' Pop up Trial window 

    frm.ShowDialog() 

    ' If the trial period is expired or License violation perform an action that will stop your application 

    If Not frm.ShowTrialMessage Or LicenserObject.LicenseViolation Then 

       End 

    End If 

End If 

.NET Licenser API assembly is a functional software interface for complete license and customer management. Along with Skater .NET Obfuscator it helps you to prepare your product for protection, manage license, encrypt your code and data, send e-mails to registered customers and so on. .NET Licenser API assembly is a part of Skater .NET Obfuscator Ultimate Edition.

For more details please refer to the .NET Licenser API sample project which provides an example how to create the dialog form for entering and processing the activation key.