Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

a "vairable"

Posted on 2004-08-31
7
Medium Priority
?
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

610 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