Start with the decision, not the tool
A licensing routine is attractive because it sits at a small but valuable boundary: it decides whether features are enabled. In an unprotected managed assembly, a reviewer can search metadata and literals, find a descriptive method such as HasCommercialEntitlement, and focus on the return path. The practical objective is therefore not to promise an impossible “undecompilable” client. It is to prevent a single obvious edit from becoming a durable license bypass.
That changes the architecture discussion. A local check can support usability-offline access, early feedback, or cached state-but it is still code the customer’s machine executes. For high-value online capabilities, let a service independently decide whether the authenticated account may use the feature. OWASP’s authorization guidance makes the same underlying point: client-side access checks can improve the experience, but must not be the decisive control for access to protected resources.
Map the license path before protecting it
Do not start by selecting every protection option. Trace how a license moves through the program and label each step according to its security value and its runtime compatibility requirements.
- Input and storage: where the application receives, loads, or caches a license artifact.
- Verification: signature checks, expiry evaluation, product binding, and revocation or refresh logic.
- Entitlement translation: conversion of the verified license into an internal set of features or quotas.
- Enforcement points: each operation that consumes a premium entitlement, not merely the first screen that displays it.
- External contracts: code reached by reflection, serializers, dependency injection, plug-ins, COM interop, or XAML/data binding.
This inventory produces two lists: code that must be difficult to reverse engineer, and identifiers that must remain stable because something resolves them by name at runtime. Microsoft documents ObfuscationAttribute as a way for assembly authors to provide instructions to obfuscation tools; use such annotations or an equivalent project configuration to make exclusions deliberate and reviewable.
Use layers with distinct jobs
Layer 1: make the entitlement decision meaningful
A structural check such as a prefix, fixed length, or checksum is useful only as input hygiene. It must not be the condition that grants valuable functionality. Verify a signed entitlement or obtain an authenticated service response, bind it to the intended product and policy, and represent the result as an internal entitlement object rather than a globally writable Boolean.
public sealed class FeatureGate
{
public bool MayExport(Entitlement entitlement, DateTimeOffset now)
{
return entitlement.IsSignatureValid
&& entitlement.Product == ProductKind.Desktop
&& entitlement.ExpiresAt > now
&& entitlement.Features.Contains("export");
}
}
This example is intentionally not a full licensing implementation. Its useful property is that the license decision reflects several verified facts rather than a single easy-to-spot key-format test.
Layer 2: remove easy landmarks
Skater can rename private and public members and encrypt selected string values. Apply these features to the license verifier, entitlement mapper, feature gates, internal error codes, and protocol strings that disclose the location or shape of the decision. Skater describes member-name obfuscation and string encryption among its product capabilities.
String encryption improves resistance to static browsing, but it is not a secret-management system. A key or token that must be available to the client can be observed during execution. Keep signing private keys, authoritative revocation data, and irreversible authorization decisions on systems the user does not control.
Layer 3: disrupt simple branch reading
Use control-flow obfuscation on the verification and enforcement methods that make or consume the entitlement decision. The aim is to make decompiled output a poor explanation of the program’s real flow, increasing the analysis effort required to identify a reliable patch point. This protection belongs in a narrow critical region; using it indiscriminately makes diagnosis and performance work harder without proportionate benefit.
Layer 4: make bypasses short-lived
Where a connection is appropriate, refresh entitlement state, validate premium server operations independently, and change policy or capability formats across maintained releases. A patched local screen should not unlock a server-side service. For offline use, use bounded validity, signed renewal artifacts, and a clearly defined grace policy that you test explicitly.
Configure Skater as a release-stage control
Skater’s command-line mode is designed to reuse settings established in the graphical application, which makes it suitable for a repeatable release process. Store the settings alongside source-controlled build inputs, and run protection only after compilation has produced the release assembly.
- Build deterministically: compile the Release configuration and collect its DLLs, symbols, configuration, and native dependencies.
- Load the release assembly in Skater: never tune protection against a Debug build and assume the result applies unchanged.
- Set exclusions first: preserve types and members reached by reflection or name-based serialization. Be as narrow as possible-exclude a DTO property or plug-in entry point, not an entire licensing namespace.
- Rename the critical graph: apply member-name obfuscation to the verifier, cache, policy mapper, and feature gates that do not participate in a runtime name contract.
- Encrypt selected literals: prioritize endpoint names, feature identifiers, protocol markers, product identifiers, and user-facing license messages that would act as search anchors.
- Apply control-flow protection narrowly: begin with the signature verification and authorization-result processing methods. Expand only after each protected build passes testing.
- Automate: invoke the stored configuration in the build or release pipeline, then package every output the protected program needs.
Type.GetType, GetMethod, plug-in discovery, and reflection-based serializers can look up original strings at runtime. Treat these names as contracts and document the exception.Prove the release works and is harder to patch
Validation is a two-part exercise. Functional tests tell you whether protection preserved behavior; adversarial inspection tells you whether the obvious route to a bypass remains. Both must run against the exact packaged, obfuscated artifact.
Functional release matrix
- Valid license: correct product, active term, and permitted features.
- Negative cases: expired, revoked, malformed, wrong-product, and altered license data.
- State changes: renewal, refresh, clock changes within your policy, upgrade/downgrade, and uninstall/reinstall where relevant.
- Connectivity conditions: first launch, offline grace period, reconnect, service timeout, and service failure.
- Compatibility surfaces: JSON/XML payloads, plug-ins, reflection paths, XAML, data binding, and any dynamically located member.
- Operations: startup time, validation time, crash reporting, and a recovery plan for a protection configuration that causes a production failure.
Inspection checklist
- Open the protected output in a .NET decompiler and search for the original verifier names, endpoint fragments, product names, and license-error messages.
- Confirm that the protected license methods no longer present as a short, self-explanatory chain of conditions.
- Confirm that enforcement exists beyond the first UI gate: restricted work should require an entitlement when it is performed.
- Record the protection profile, Skater version, input hashes, and test results so a future release can reproduce the artifact.
Common design mistakes
One local Boolean controls every premium feature
Why it fails: a single return value creates one highly valuable patch target.
Better pattern: derive feature decisions from a verified entitlement and enforce them at the operations that need them.
All code receives maximum protection
Why it fails: debugging becomes difficult and name-dependent frameworks can break, while noncritical code gains little security value.
Better pattern: protect the small decision graph aggressively and keep explicit, minimal exclusions for runtime contracts.
Encrypted client strings are treated as durable secrets
Why it fails: software must eventually recover values it consumes; runtime analysis remains possible.
Better pattern: use string encryption to remove static clues, while retaining signing keys and authoritative checks outside the distributed binary.
The original DLL is tested after protection is configured
Why it fails: that does not test the transformed control flow, renamed metadata, or packaged dependencies customers receive.
Better pattern: make the obfuscated package the test subject and a first-class build artifact.
A practical release decision
Ship only when the following answer is “yes” for the relevant tier: Is each valuable capability enforced at its point of use? Are online authorizations independently verified by the service? Have the critical methods and useful literals been protected with Skater? Are reflection and serialization exclusions documented and minimal? Does the protected package pass negative licensing tests and inspection in a decompiler?
That approach does not rely on obscurity alone. It combines product policy, server authority where available, targeted transformation of the managed assembly, and repeatable verification. The result is a licensing implementation that remains maintainable for developers while demanding materially more work from someone attempting to patch it.
Frequently asked questions
Can obfuscation make an offline .NET license check unbreakable?
No. A determined user controls the client and may alter it. Obfuscation increases the work needed to find and understand a patch target; pair it with server-side authorization where the product model permits.
Which code should receive the strongest protection?
Prioritize signature verification, entitlement conversion, feature gates, license-state transitions, tamper checks, and static literals that reveal the licensing path. Keep only genuine runtime name contracts excluded from renaming.
Why did renaming break my application?
Reflection, plug-in activation, serializers, and UI frameworks can resolve metadata by its original string name. Audit these routes, preserve their required identifiers, and test the protected artifact.
Does string encryption replace secret management?
No. It removes convenient static clues, but a client-resident value can still be observed at runtime. Do not distribute signing private keys or treat a client-only authorization check as an authoritative backend control.