Babel Obfuscator
HomeDocumentationShop
  • Introduction
    • General Features
  • Getting Started
    • Install
    • Product Activation
  • Command Line
    • Command Line Reference
      • Miscellaneous
      • Input Files
      • Output Files
      • Plugins
      • Merge and Embed
      • Renaming
      • Control Flow Obfuscation
      • Encryption and Protection
      • Code Generation
  • MSBuild Task
    • Babel Task Reference
    • Customizing Intellisense
  • NuGet Package
    • NuGet Pakage Reference
  • User Interface
    • Obfuscation
    • Tools
    • Custom Themes
  • Obfuscation Rules
    • XML Rules
      • Example Rules
    • Custom Attributes
    • Obfuscation Agent
  • Merge and Embed
    • Assembly Merging
    • Assembly Embedding
  • Symbols Renaming
    • XML Map Files
    • Cross Assembly Renaming
    • XAML Renaming
    • Decoding Stack Traces
  • String Encryption
    • Custom String Encryption
  • Control Flow Obfuscation
  • Code Encryption
    • External Code Files
    • Password Protected Code
    • Dynamic Code
  • Dynamic Proxy
  • Resource Encryption
  • Value And Array Encryption
  • Tampering Detection
  • Anti Debugging
  • Enhancing Code Security
  • Optimizations
    • Dead Code Removal
    • Metadata Optimizations
    • Code Optimizations
  • Appendix
  • Examples
    • Examples
    • General Samples
      • ClickOnce Deploy
      • Detecting Babel Obfuscation
      • Obfuscate .NET MAUI
      • Blazor Web App
    • Code Encryption
      • Feature Based Licenses
    • Cross Assembly Renaming
      • Publish .NET App
    • Build Servers
      • GitHub Actions
      • Unit Tests
    • Babel Obfuscator NuGet
      • Android Application
  • Plugins
    • Babel Obfuscator Plugins
    • Encrypt Plugin
      • Getting Started
      • Source Code
Powered by GitBook
On this page
  • User Interface
  • Command Line
  • MSBuild Babel Task

Was this helpful?

  1. String Encryption

Custom String Encryption

Custom string encryption enables users to formulate their own methods for encrypting and decrypting strings, allowing for personalized obfuscation of strings. To leverage custom string encryption, users are required to define two specific methods within the target assembly: EncryptString and DecryptString. Both methods must have identical signatures, accepting a string as a parameter and returning a string, which represents either the encrypted or decrypted string, respectively. By establishing these methods, users have the flexibility to implement any custom encryption algorithm of their choice to encrypt strings in their code, granting enhanced adaptability and command over the obfuscation process.

/// <summary>
/// Encrypt a string.
/// </summary>
/// <param name="text">The string to encrypt.</param>
/// <returns>The encrypted string.</returns>
[Obfuscation(Feature = "string encryption encrypt method")]
internal static string EncryptString(string text)
{
   // Encrypt the text string and return the encrypted string object.
   return ...;
}
/// <summary>
/// Decrypt an encrypted string.
/// </summary>
/// <param name="text">The encrypted string.</param>
/// <returns>The decrypted string.</returns>
[Obfuscation(Feature = "string encryption decrypt method")]
internal static string DecryptString(string text)
{
   // Decrypt the text string and return the decrypted string object.
   return ...;
}

The EncryptString and DecryptString methods are addressed by the Obfuscation attribute with a proper Feature string, which allows Babel to identify the code entry points for encrypting and decrypting strings.

Once you have defined the EncryptString and DecryptString methods and addressed them with the proper Obfuscation attribute, you can then enable custom string encryption with Babel.

To encrypt or decrypt strings using the methods provided, you have several options based on your project setup and preferences. These include configuring the Babel UI, utilizing the command line, or implementing an MSBuild task.

User Interface

To utilize Custom String Encryption through the Babel Obfuscator User Interface (UI), navigate to Settings within the Babel UI, you are required to enable the Encrypt Strings check box and select the custom option.

Command Line

To enable Babel custom string encryption using the command line, you can enter the command:

babel myapp.exe --strings custom

MSBuild Babel Task

If you are using the Babel task, you can enable custom string encryption by adding the following to your project file:

<PropertyGroup>
  <StringEncryption>custom</StringEncryption>
</PropertyGroup>

<Babel StringEncryption="$(StringEncryption)" ... />

Last updated 1 year ago

Was this helpful?

Additionally, for further customization and extension of the encryption capabilities, Babel supports the integration of . This feature allows for a more flexible and robust encryption mechanism, tailored to the specific needs and security requirements of your application.

In addition, users can also implement custom string encryption using external plugins (see ).

external plugins
Babel Obfuscator Plugins
Babel UI Custom String Encription