How can I obfuscate a test in code to prevent tampering with response processing?
One approach would be to put the code that does the license check into a separate DLL. In the main application, load the DLL at runtime and calculate the checksum of the DLL itself. The app stores the checksum that was calculated with the DLL was built. If the checksums don't match, you have several options, show a wrong-version message - a bit obvious; Do not call the license check - less obvious but will be noticed when the attacker wonders why the license check doesn't get called; call a function with a similar name to the real license-check function.
Think of it as using Public Key Encryption. Use a public key as part of the config and have a private key built into the app. If they mess with the public key, the digital signature of the app will be compromised in a detectable way.
I agree with @camccann that it would help to understand the kind of attack you expect. As a last resort, split the license-check into as many parts as is feasible to make it harder to bypass by changing a single branch point.
[EDIT]
Another thought would be to use a State Machine. See the command structure example in the top answer to this question. Put the evaluation of the license check into the form of a hash lookup and a set of dummy function calls into an array along with the proper one. The decision code that evaluates the license check into a table/hash lookup for the appropriate function will not look like your typical
if(){ pass;} else { fail; }
construct.
Two benefits,
1) there isn't a boolean condition to bypass and
2) they can't do a simple JMP instruction without knowing the address/name of the function to pass control to.
SO thread on a state machine turorial.
SO thread on state machine implementations
Obfuscation doesn't prevent, merely discourage. A sufficiently skilled and determined attacker will always be able to circumvent whatever obfuscation you use, so what you need to know first is: What kind of people are you trying to thwart here?
The Secure Programming Cookbook (O'Reilly) has a whole chapter on Anti-Tampering (the actual book has the chapter, not sure what's available on the website). Neat stuff.