String Encryption Enterprise
Literal strings in an unobfuscated .NET assembly are stored in plain text. Anyone with a hex editor can read your connection strings, API keys, error messages, and business logic. Demeanor removes the literal text from the shipped file; the application sees the original strings only when it uses them, and they are not visible to a static search of the binary.
Usage
| CLI | MSBuild | Default |
|---|---|---|
| (enabled by default at Enterprise) | (enabled by default) | On |
--no-strings | <DemeanorNoStrings>true</DemeanorNoStrings> | Disable |
Before & After
YOUR CODE
public string FormatReceipt(int quantity, TaxRegion region)
{
decimal total = CalculateTotal(quantity, region);
return $"Receipt: {quantity}x {_currency} {_basePrice:F2} = {_currency} {total:F2}";
}
if (key.StartsWith("TRIAL-"))
Console.WriteLine("Trial expired — grace period active.");AFTER OBFUSCATION
string a(int a, h a)
{
decimal value = k.a(this, a, a);
defaultInterpolatedStringHandler.AppendLiteral(
l.a("O\u000f]O\u00c3\u001e6\u0080\u00bf"));
...
}
if (a.StartsWith(l.a("\u00e8d\u0096\u001f\u00c3\u0017")))
Console.WriteLine(l.a(
"\u00f2\r\u00e5\u0011\u0097\u00e1..."));Real ILSpy output. The original literal text is gone from the shipped file; a binary search for any of these strings returns nothing.
When to Disable
- Performance-critical hot loops — the first use of each encrypted string has a small one-time cost; subsequent uses are effectively free. In practice this is negligible.
- Debugging — encrypted strings make debugging harder. Use
--no-stringsfor Debug builds (this is the default MSBuild configuration).
Ready to protect your .NET code?