1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C#: Free licensing system?

Discussion in 'C, C++, C#' started by kytro360, Nov 26, 2011.

Tags:
  1. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    Hey, I made a program in C# and was wondering if anyone who codes in C#, or even VB would be kind enough to share code to set up a licensing system for my program?
     
  2. Euclid

    Euclid Newbie

    Joined:
    Nov 28, 2011
    Messages:
    13
    Likes Received:
    3
    I doubt so but there are many commercial products available. e.g. softwarekey
     
  3. slugger_mn

    slugger_mn Newbie

    Joined:
    May 5, 2011
    Messages:
    11
    Likes Received:
    0
    Hey,

    I am looking for the same thing. I have two separate new programs that I want to start selling. I would love to find a licensing system for them as well.

    You should keep in touch about your trials. I will do the same.

    That way if we find one that is crap, the other doesnt have to waste there time!

    Let me know. So far I have tried a few.. No go though..

    Thanks-
     
  4. thedelimiter

    thedelimiter Newbie

    Joined:
    Nov 11, 2011
    Messages:
    16
    Likes Received:
    8
    Location:
    Chicago
    Home Page:
    Maybe this will get you started...

    I just make a random key on the server in PHP. Then md5 it. After Paypal success I do...
    Code:
        $licenseKey = makeRandomKey();  //make random key    
        $dbKey = base64_encode(md5($licenseKey, true));
        
        //Save that key to database
    
    In C#, you have to have the user input their key, MD5 it the same way, and send that to the server. The server should check if that MD5 is in the database then.

    Code:
            //C# code to MD5 same way as PHP
    		private string MD5_this(String input)
    		{
    			System.Security.Cryptography.MD5 alg = System.Security.Cryptography.MD5.Create();
    			UTF8Encoding enc = new UTF8Encoding();
    			byte[] hash = alg.ComputeHash(enc.GetBytes(input));
    			string output = Convert.ToBase64String(hash);
    			
    			return output;
    		}
    
    If the server finds MD5 of that key in database... the server then adds a known string to that MD5, then MD5s that again. The C# program knows the string going to be appended so it can MD5 that same string on its own, so it could compare its own value with the response from the server. If the responses match, it's a valid key.

    I'm sure appending the same string on both sides to validate response isn't super secure... but I'm not expecting people trying to crack my software. It works well enough for me.
     
    • Thanks Thanks x 3
  5. ~divinci

    ~divinci Registered Member

    Joined:
    Sep 23, 2009
    Messages:
    51
    Likes Received:
    11
    Occupation:
    Infastructure Reverse Engineer
    Location:
    Liverpool UK
    You should also protect your code from people tampering or easily cracking your licensing system - Visual Studio has a good obfuscator for .Net.
     
  6. OpportunityKnocks

    OpportunityKnocks Newbie

    Joined:
    Jan 6, 2012
    Messages:
    2
    Likes Received:
    2
    Check out Infralution. They have several products including a licensing system at very reasonable prices. I'm not associated with them and as a matter of fact, I'm looking at them for the very same reason you guys are. I'm looking to release a product very soon and I think this is the route that I'm going to go.
     
  7. xenon2010

    xenon2010 Regular Member

    Joined:
    Apr 27, 2010
    Messages:
    231
    Likes Received:
    48
    Occupation:
    web and desktop apps programmer
    Location:
    prison
    Home Page:
    I suggest you to code your own and never use commercial ones because all of them are cracked and vulnerable...


    cheers..
     
  8. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    I decided to just do a webrequest to my sites login form instead