SKGL – Serial Key Generating Library is a very simple licensing system that might be used to protect .NET Applications. If you like it, please donate or consider the online solution http://serialkeymanager.com/!

Click here to lend your support to: SKGL and Software Protector (Licensing system) and make a donation at pledgie.com !

Features

  • Create and validate human-readable serial keys.
  • Simple 20 characters format:  MUYVD-LSEBY-CXHRQ-XFAGY.
  • Add eight different features.
  • Set a time limit. (Max 999 days).
  • Lock a key for a specific machine.

Introduction

As it is stated in the beginning, this is a library that you can use to secure your application that uses .NET Framework. If you have time, you can look at the algorithms itself by entering here.

In the beginning,  I just wanted to create an easy-to-use licensing system, but now, I would like to share it, so that you also can take a great advantage of it. Please note, there might be some bugs (not what I have discovered though). If so, please report it somehow on codeplex! Much appreciated!

How to use

There are a lots of ways that you can use this library. First of all, you can use an already existing GUI that I did. Secondly, you can use the library by adding it as a reference into your project. Both these ways allows you to create, validate, and configure your keys.

In Software Protector you have two buttons: to create a key "Generate", and to validate a key "Validate"

 

However, you can also include the library into your project. This is how simple it is to create a key: (in Visual Basic)

Dim CreateAKey As New SKGL.Generate ' creating an object
CreateAKey.secretPhase = "My$ecretPa$$W0rd" ' adding a password
TextBox1.Text = CreateAKey.doKey(30) ' generating a key; 30 is the time left.

And this is how simple you can validate a key: (in Visual Basic)

Dim ValidateAKey As New SKGL.Validate ' create an object
ValidateAKey.secretPhase = "My$ecretPa$$W0rd" ' the passsword
ValidateAKey.Key = "LMFME-OTQAF-JVBUP-OKFGP" ' enter a valid key
Console.WriteLine(ValidateAKey.IsValid) ' check whether the key has been modified or not

Remember that the secretPhase should be the same in order to get a valid key. 

Note: IsValid function only checks whether the key has been modified or not. It is therefore good to execute this function first, before collecting information such as date created, features, et cetera.

Eventually, you might also want to get when the key expires, what kind of features are set, et cetera. This can be done by the SKGL GUI and SKGL itself. The GUI part is obvious, but doing it using SKGL itself might be a bit difficult, without any information. Let's start with the simple validation process, and then go to the more "difficult" part. 

Dim ValidateAKey As New SKGL.Validate ' create an object
ValidateAKey.secretPhase = "My$ecretPa$$W0rd" ' the passsword
ValidateAKey.Key = "LMFME-OTQAF-JVBUP-OKFGP" ' enter a valid key

' strongly recommended to use similar code when validating
If ValidateAKey.IsValid Then
    ' displaying date
    ' remember to use .ToShortDateString after each date!
     Console.WriteLine("This key is created {0}", ValidateAKey.CreationDate.ToShortDateString)
     Console.WriteLine("This key will expire {0}", ValidateAKey.ExpireDate.ToShortDateString)

     Console.WriteLine("This key is set to be valid in {0} day(s)", ValidateAKey.SetTime)
     Console.WriteLine("This key has {0} day(s) left", ValidateAKey.DaysLeft)

Else
    ' if invalid
     Console.WriteLine("Invalid!")
End If

However, in order to add features, we will need to add a new variable, SKGL.SerialKeyConfiguration. You can do a lot with this variable; more information is available in the Documentation.

Dim skc As New SKGL.SerialKeyConfiguration
skc.Features = New Boolean(7) {True, False, False, False, False, False, False, False}

As you might see, there are eight features, each is either true or false, and one is set to be true. Including this to SKGL.Generate will change, as you can see, one feature.

Dim skc As New SKGL.SerialKeyConfiguration
skc.Features = New Boolean(7) {True, False, False, False, False, False, False, False}

Dim CreateAKey As New SKGL.Generate(skc) 
CreateAKey.secretPhase = "My$ecretPa$$W0rd" 
Console.WriteLine(CreateAKey.doKey(30)) 

In order to validate, we will not need the variable SKC.

Dim ValidateAKey As New SKGL.Validate ' create an object
ValidateAKey.secretPhase = "My$ecretPa$$W0rd" ' the passsword
ValidateAKey.Key = "JMDIR-PYCOJ-CGIRD-HZXWI" ' enter a valid key

If ValidateAKey.IsValid Then
    Console.WriteLine("Feature 1 is {0}", ValidateAKey.Features(0))
    Console.WriteLine("Feature 2 is {0}", ValidateAKey.Features(1))
    Console.WriteLine("Feature 3 is {0}", ValidateAKey.Features(2))
    Console.WriteLine("Feature 4 is {0}", ValidateAKey.Features(3))
    Console.WriteLine("Feature 5 is {0}", ValidateAKey.Features(4))
    Console.WriteLine("Feature 6 is {0}", ValidateAKey.Features(5))
    Console.WriteLine("Feature 7 is {0}", ValidateAKey.Features(6))
    Console.WriteLine("Feature 8 is {0}", ValidateAKey.Features(7))

End If

Tips

  • The most important, when generating a lot of keys, is to put the SKGL.Generate declaration before the, for example, while or for loop. Never put the declaration of this variable inside a loop, because otherwise, you will get same keys all the time. A good place to put the declaration to is before all procedures.

Security level

Q: How secure is SKGL?

  • It is difficult to say how secure it is, but I would say, as it is with almost all ciphers, it is a matter of time! To make a safe and also a human-readable serial key is hard, maybe even impossible. So, if you would ask if it is possible to "hack" a serial key produced by SKGL, I would say yes. A person who has enough time, and passion, will succeed.

Last edited Nov 19 at 4:23 PM by artemlos, version 27