-1

I have confusion and I am stuck in the process of registering the windows application. I have windows application which have the Demo and the full versions. I have to create two keys for the demo and the full version when user downloads the software and send the demo version key automatically through user/register email address and if user want the full version then he has to contact with the software owner in this Case me to request for the full version licensing. I have already was the this.

do we need to required new build (exe) for the windows application every time to embed the software demo and full version keys? or only one build (exe) can work for us to handle the all users registration process?

If we can do it through one build then how?

Thanks

Community
  • 1
  • 1
  • Software licensing is essentially an unsolvable problem. People can simply reverse-engineer your software and remove the licensing code. Whatever you do, it's not enough. – Artjom B. Aug 22 '16 at 17:35
  • I knew about it but my question was should I require to create the separate build (exe) for each license code or one build can use multiple license info and validate licenses. The Question was about to creating the build not Security – Nawaz Khan Aug 23 '16 at 07:00

1 Answers1

0

1) Create a License key feature for your application Ever wanted to add a license key feature to your application ? It is simple but will take a lot of time from you Because you need to come up with a good algorithm that will be hard to be broken.

What do you need ?

1) Key Generator.

2) Key and DateValidation function in client application

3) Register the information of client in registry or somewhere on the hard drive so you make sure he already entered a registration information.

Now it wont be logical to send the product key like that. Any kid can understand the algorthim here. So what you can do is replacing each char with another char. For example : Original Key : ABCD - EFGH - IJKL - MNOP Product Key : PLHD - OKGC - JJFB - MIEA

1) Key Generator Function :

I`ll be giving the Create_Key date like : ABCDEFGHIJKLMNOP and it will replace everything and add "-" after each 4 chars Code:

private string Create_Key(string data)
{
    byte[] bytes = Encoding.ASCII.GetBytes(data);
    string KEY = string.Empty;

    KEY += data[15];
    KEY += data[14];
    KEY += data[8];
    KEY += data[9];
    KEY += "-";
    KEY += data[6];
    KEY += data[11];
    KEY += data[4];
    KEY += data[12];
    KEY += "-";
    KEY += data[2];
    KEY += data[3];
    KEY += data[13];
    KEY += data[5];
    KEY += "-";
    KEY += data[7];
    KEY += data[10];
    KEY += data[1];
    KEY += data[0];

    return KEY;
}

In client application the client will provide a product key , you need to follow these steps to ensure that the key is valis 1) Check the prefix of the key

2) If prefix is correct then it is a valid key then lets Check the expiration Date of the key

3) If key is not yet expired then open appliation.

- a) Key Validation Function : [Read Prefix]

The key Validation function will be the same Key Generator function which is >>>Create_Key() , Because we are using the same algorthim in key generation process.

Step one : reverse the the product key because we need the original Key to read prefix. Code:

 private string Create_Key(string Product_Key)
    {
        byte[] bytes = Encoding.ASCII.GetBytes(Product_Key);
        string KEY = string.Empty;

        KEY += Product_Key[15];
        KEY += Product_Key[14];
        KEY += Product_Key[8];
        KEY += Product_Key[9];
        KEY += "-";
        KEY += Product_Key[6];
        KEY += Product_Key[11];
        KEY += Product_Key[4];
        KEY += Product_Key[12];
        KEY += "-";
        KEY += Product_Key[2];
        KEY += Product_Key[3];
        KEY += Product_Key[13];
        KEY += Product_Key[5];
        KEY += "-";
        KEY += Product_Key[7];
        KEY += Product_Key[10];
        KEY += Product_Key[1];
        KEY += Product_Key[0];

        return KEY;
    }

Step two : Create a Bool function to retun the legit status of the key :

private bool validate_key(string key)
    {
        string[] seperate_filelds = key.Split('-');
        int counter=0;
        bool is_legit = false;

        foreach (string each_field in seperate_filelds)
        {
            counter++;
            // reading the first field which is prefix field
            if (counter == 1)
            {
                if (each_field == "Your_Prefix")
                {
                    is_legit = true;
                }
            }
            else
            { break; }
        }

        return is_legit;
    }

For Detail Reference

Tanmay Nehete
  • 2,138
  • 4
  • 31
  • 42