Loading...

Store Secret key on your Registry Editor so that Your Software or application will run ONLY on the Computer You Want in C#

Store Secret Key on Registry Editor using C# :

Hi friends, A lot of people want to store a secret key on the Registry Editor of any Computer they want. You can also make this possible easily that Your Software or Application will not be Spread freely by one of your customer.
Before You Start if You have less information about Registry Editor and Accessing it through C# then please read our these posts first to understand completely:


After Reading the above Posts you are able to understand this post:

First of all , Open a Console Application and write the following Program.. Remember You have to run Visual Studio as Administrator to get the Output:

 class Program
    {
        static void Main(string[] args)
        {
            store_secretkey();
        }
        public static void store_secretkey()
        {
            int secretkey;
            RegistryKey software = Registry.LocalMachine.OpenSubKey("SOFTWARE",true); // accessing software Registry, if it exists 
            
            RegistryKey regnet = software.CreateSubKey("RegDotNet");//accessing "RegDotNet" subdirectory in software registry

            if (regnet != null)
            {
                RegistryKey secret = regnet.CreateSubKey("secret key");//Creating secret key subdirectory in RegDotNet

                Console.WriteLine("Enter secret key");
                secretkey=Convert.ToInt32(Console.ReadLine());
                if (secret != null)
                {
                    secret.SetValue("code", secretkey.ToString()); // storing secret code in the sub directory secret key 
                }
                else
                {
                    Console.WriteLine("Secret key is null");
                }
            }
            else
            {
                Console.WriteLine("RegDotNet is null");
            }}}


You can see what you have stored in the secret key by accessing Registry Editor using run command and see the code You have Stored. The Screen Shot is given below:


What Code you have to write in your Software to run that Software on that Computer on which you have ran this program to store Secret Code in Registry Editor is Given in Run Your Software only in known or specified Computer kindly read this to get the Output.

.. Thank You

This article is taken from our this Blog

Hit the Facebook like button below if you like this article... this helps a lot and keep us motivated :)


Google+

 
TOP