troubleshooting Question

Looking for a robust solution to protect code from piracy

Avatar of C_Sharp_Programmer
C_Sharp_Programmer asked on
.NET ProgrammingC#
6 Comments1 Solution313 ViewsLast Modified:
I am developing a desktop app in C#, and am trying to implement a (nearly) foolproof means of having my software hacked/pirated.  I know that .NET languages are very susceptible to reverse engineering / decompiling.  I have taken the precaution of obfuscating my code, and have the program set up to only run in "full" mode with the presence of a valid registration code (without the registration code, only portions of the program work).  However, as someone pointed out, when the program starts, it uses an IF statement to check the registration file for a valid license key as shown in the following pseudo-code:

if ( readLicenseKey() == true )
  programRegistered = true;

The problem with this code, as pointed out to me, is that anyone can decompile the program and change this IF statement to the following:

if ( ! (readLicenseKey() == true) )
   programRegistered = true;

As seen, simply making the IF conditional return as false effectively bypasses any negative results from an invalid registration code.

So, my question is:  what can I implement into my program to avoid the weak security given by an IF statement?  I can have the program go to the trouble of uploading the registration code to a Web server, check it against the valid codes that have been issued, and return a pass/fail value but, again, if it is checked by a simple IF statement, all the parsing/checking/validation in the world won't help.  This might be easier than it seems to me, but I have been stumped over it for some time now.  I'd appreciate any suggestions, links to articles, or products / solutions that I might be able to use (I'm on a limited budget, though, so very expensive products are out of the question).

Thank you all so much!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros