### ArmDot Project Configuration (.armdotproj) Source: https://context7.com/softanics/armdot-tutorial-sample/llms.txt The .armdotproj file configures ArmDot's obfuscation settings, including RSA cryptography for license validation, assembly information, license keys, and file system isolation. ```xml ``` -------------------------------- ### Add ArmDot NuGet Packages to .csproj Source: https://context7.com/softanics/armdot-tutorial-sample/llms.txt Add these NuGet package references to your .csproj file to enable ArmDot integration with MSBuild. ```xml 2020.13.0 2020.13.0 ``` -------------------------------- ### Windows Forms Application Entry Point Source: https://context7.com/softanics/armdot-tutorial-sample/llms.txt Standard C# entry point for a Windows Forms application. This sets up the application's visual styles and runs the main form. ```csharp using System; using System.Windows.Forms; namespace armdot_tutorial_sample { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } ``` -------------------------------- ### Validate License Key with ArmDot.Client.Api Source: https://context7.com/softanics/armdot-tutorial-sample/llms.txt Use the ArmDot.Client.Api to validate license keys, checking states like Valid, Blocked, Expired, and more. This API integrates with RSA cryptography configured in the .armdotproj file for authenticity verification. ```csharp using System; using System.Windows.Forms; public partial class Form1 : Form { [ArmDot.Client.VirtualizeCode] private void buttonCheckLicense_Click(object sender, EventArgs e) { // Submit the license key for validation ArmDot.Client.Api.PutKey(textBoxPassword.Text); string state; string userName = null; // Check the license state and handle each possible outcome switch (ArmDot.Client.Api.GetLicenseState()) { case ArmDot.Client.Api.LicenseKeyState.Valid: state = "valid"; // Retrieve registered user name from valid license userName = ArmDot.Client.Api.GetUserName(); break; case ArmDot.Client.Api.LicenseKeyState.Blocked: state = "blocked"; break; case ArmDot.Client.Api.LicenseKeyState.Expired: state = "expired"; break; case ArmDot.Client.Api.LicenseKeyState.MaximumBuildDateExpired: state = "maximum build date expired"; break; case ArmDot.Client.Api.LicenseKeyState.BadHardwareId: state = "bad hardware id"; break; case ArmDot.Client.Api.LicenseKeyState.Invalid: default: state = "invalid"; break; } MessageBox.Show($"The key state is {state}, user name is {userName ?? \"\"}"); } } ``` -------------------------------- ### Configure Post-build Obfuscation with ArmDot MSBuild Task Source: https://context7.com/softanics/armdot-tutorial-sample/llms.txt This MSBuild target runs after the build process to obfuscate the compiled assemblies using ArmDot. Ensure the ProjectPath points to your .armdotproj configuration file. ```xml ``` -------------------------------- ### Protect Method with VirtualizeCode Attribute Source: https://context7.com/softanics/armdot-tutorial-sample/llms.txt Apply the [ArmDot.Client.VirtualizeCode] attribute to methods containing sensitive logic, such as password verification, to protect them from static analysis by converting IL code to virtual machine instructions. ```csharp using System; using System.Security.Cryptography; using System.Text; using System.Windows.Forms; public partial class Form1 : Form { // Apply VirtualizeCode attribute to protect sensitive password verification logic [ArmDot.Client.VirtualizeCode] private void buttonCheckPassword_Click(object sender, EventArgs e) { // Hash the user-provided password using SHA256 byte[] hash = (new SHA256Managed()).ComputeHash( Encoding.Unicode.GetBytes(textBoxPassword.Text) ); // Compare hash bytes against expected values // This comparison logic will be virtualized and protected if (hash[0] == 81 && hash[1] == 96 && hash[2] == 9 && hash[3] == 150 && hash[4] == 45 && hash[5] == 146 && hash[6] == 51 && hash[7] == 201 && hash[8] == 238 && hash[9] == 22 && hash[10] == 103 && hash[11] == 233 && hash[12] == 209 && hash[13] == 135 && hash[14] == 107 && hash[15] == 39 && hash[16] == 228 && hash[17] == 171 && hash[18] == 22 && hash[19] == 78 && hash[20] == 218 && hash[21] == 213 && hash[22] == 11 && hash[23] == 131 && hash[24] == 71 && hash[25] == 17 && hash[26] == 241 && hash[27] == 180 && hash[28] == 118 && hash[29] == 9 && hash[30] == 163 && hash[31] == 249) { MessageBox.Show("The password is correct"); } else { MessageBox.Show("The password is wrong"); } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.