Solved

a "vairable"

Posted on 2004-08-31
7
169 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now