VirtualGuard can encrypt all the constants within your code, with support for all the primitive types. This protection is enabled in the free version of VirtualGuard and above.
Usage
To use this protection, see instructions for setting up the Web Panel or Configuration. It will be under the "Data Encryption" field.
How it works
See some example code:
public class MyAuthenticator {
public MyAuthenticator(string correctUser, string correctPass) {
this.CorrectUsername = correctUser;
this.CorrectKey = correctPass;
}
public void Authenticate(string username, string password) {
if(username != CorrectUsername)
throw new InvalidUserException();
if(password != CorrectPassword)
throw new InvalidPasswordException();
}
public string CorrectUsername = "testuser";
public string CorrectKey = "testpassword";
}
We can see two constants being used to set the value of two fields here, "testuser" and "testpassword".
VirtualGuard will automatically find these values and replace them with calls into our virtual machine.
public class MyAuthenticator {
public MyAuthenticator(string correctUser, string correctPass) {
this.CorrectUsername = correctUser;
this.CorrectKey = correctPass;
}
public void Authenticate(string username, string password) {
if(username != CorrectUsername)
throw new InvalidUserException();
if(password != CorrectPassword)
throw new InvalidPasswordException();
}
public string CorrectUsername = s6sfg14.hfatr21j(10);
public string CorrectKey = s6sfg14.hfatr21j(16);
}
Notice how these constant values have been completely removed, and have now been encrypted and run on our virtual machine.
Conclusion
Data Encryption is a quick and easy way to secure all the static data within your program, without requiring the full performance hit of a powerful protection like Code Virtualization.