In this article we will investigate the machine locking feature, available since SKGL 2.0.3.1.

Why machine locking? 

Machine locking is a feature that allows you to literary lock a specific license to a certain computer. This makes it harder for users to redistribute the key, and hence use it on other computers that are not covered by the license. Please note, this also implies that a key needs to be updated if a registered user wants to switch to another computer, which might be seen as a limitation of this feature. Also, this feature is optional, so it will not be activated unless you explicitly do so.

Assign the key an id

The following example will generate a key with the machine id set to 12345.

Dim GenereateAKey As New SKGL.Generate ' declare the variable
GenereateAKey.secretPhase = "MySecretPassword" ' the password
Dim key As String = GenereateAKey.doKey(30, 12345) ' generating the key

 

Note: Machine code must not contain more than 5 digits, i.e. be bigger than 99999.

Validate the machine code

The following example will compare the machine id of the key with the machine id of the target computer.

Dim ValidateAKey As New SKGL.Validate ' declare the variable
ValidateAKey.secretPhase = "MySecretPassword" ' the password
ValidateAKey.Key = key ' specify the key

If ValidateAKey.IsValid And ValidateAKey.IsOnRightMachine Then
    MsgBox("Valid key!")
Else
    MsgBox("Invalid key!")
End If

 

Retrieve computers id

The following example will calculate the machine id of the current computer.

Dim GenereateAKey As New SKGL.Generate ' declare the variable
Dim machineId As Integer = GenereateAKey.MachineCode ' Retrieve the machine id

 

Please also see:

Last edited Jan 24, 2014 at 4:33 PM by artemlos, version 9