Solved

a "vairable"

Posted on 2004-08-31
7
172 Views
Last Modified: 2010-04-15
I am building something taht a client has paid for a specific amount of license for, so in our code we have a number represnting that...but if they purchase more license we need to update taht number.
Is there a better way of doing this other than resend the client another DLL?
Please adivse of another way, but it needs to be secure and in a way so the client wont figure it out so they wont increase the license number.

Please advise.
0
Comment
Question by:solraccheffy
  • 3
  • 2
  • 2
7 Comments
 
LVL 69

Expert Comment

by:Callandor
ID: 11946681
You could construct a key that incorporates the number of licenses allowed, then have the program read the key and calculate how many licenses that key represents.  The encryption algorithm to create the key needs to be sophisticated enough (perhaps involving large prime numbers) to prevent breaking and will only allow the program to work if a valid key is provided.
0
 

Author Comment

by:solraccheffy
ID: 11947421
That is kind of what I am looking for....I have that thought but not sure on how to go about implementing it.
please advise.
0
 
LVL 69

Expert Comment

by:Callandor
ID: 11948599
Have you taken a look at how PGP is implemented?  There is a public key and a private key, and though you don't need a public and private key, you could code the public key to decrypt what you send that's encrypted with the private key.  This could include how many licenses, and the program could reject any answer outside a range.  The client would only see an encrypted license key, which the program would decrypt and figure out how many licenses they have.  They would not be able to change the license key without knowing what the private key was.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:solraccheffy
ID: 11951194
Makes sense, where can I get an example on how to do this, step by step?
0
 
LVL 69

Expert Comment

by:Callandor
ID: 11952006
Take a look at http://www.pgpi.org/
0
 
LVL 7

Accepted Solution

by:
jackiechen858 earned 125 total points
ID: 11954859
I think it don't need to be so complex.  you can just samply use a md5 method
to do it.

using System.Text;
using System.Security.Cryptography;

            public static string GetLicenseString (int nlicenseNumber  )
            {
                  string strMDAppend = "xzkale2sx789ASw";
                  string strMD = nlicenseNumber.ToString() + strMDAppend;


                  UTF8Encoding encoder =new UTF8Encoding();

                  MD5CryptoServiceProvider md5 =  new MD5CryptoServiceProvider();
                  byte[] result =md5.ComputeHash( encoder.GetBytes(strMD) );
                  string strResult="";
                  for ( int i=0;i<16;i++ )
                  {
                        strResult += result[i].ToString("X00");
                  }
                  return strResult;
            }

using the above function, you can get a unique string for any number.
save the number and the string into a file. and when you load the dll,
call the same function to generate a new string for the same number.
the two strings should be same.  it used MD5 algorithm to generate
a 16 bytes array for a string. If the input strings are different, the output
arrays will "almost for sure"( 1/ (2^(8*16) )  )  be different. and the
good thing is even if the input string only has little difference, the output
arrays will be totally mess, so it's impossible to reversely get the string
from the array. So if the user can't get the strMDAppend "xzkale2sx789ASw",
he can't generate the string.




0
 
LVL 7

Expert Comment

by:jackiechen858
ID: 11954957
the bad thing about the sample solution is if they trace the dll and find the
strMDAppend , then you are screwed :-( but if they can trace the binary
code, I guess they can do everything.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question