Resource Protection
Protection ID: resources
This protection encodes and compresses embedded resources.
This protection is available in the editions:
Team Scale Enterprise
How It Works
Resource protection encrypts and compresses the embedded resources in your .NET application, such as images, configuration files, text files, and other data files. When applied, this protection transforms the resources so they cannot be easily extracted or viewed using standard decompilers or resource viewers.
The protection can be configured to either compress resources (reducing application size) or encrypt them (preventing unauthorized access), or both. During runtime, resources are automatically decompressed and decrypted as needed, making the protection transparent to your application code.
This protection allows you to choose if you want to encrypt resources, compress them or both options simultaneously.
Parameters
- Compress boolean : This Boolean type parameter sets whether resources should be compressed. true by default
We recommend using this parameter for any type of resource in order to reduce the weight of your application.
- Encrypt boolean : This Boolean type parameter sets whether resources should be protected. true by default
We recommend using this parameter if the application's resources contain important data that you want to protect. It is not recommended when resources are simple images or elements used by the interface.
Rules configuration
shield.config.json
{
"protections": {
"resources": {
"compress": true,
"encrypt": true
}
}
}
Modes
- Default: Use static algorithms with random parameters to encode resources.
Exclusions
- Exclude with attribute
Include this attribute in your source code:
[Obfuscation(Exclude = false, Feature = "-resources")]
- Exclude from the interface
You can exclude specific resources from protection using the Shield configuration interface.
When to Use
Resource protection adds significant value in these scenarios:
- Applications with embedded resources: Any application containing bundled resources benefits from compression and optional encryption
- Sensitive configuration files: JSON, XML, or other configuration files with sensitive settings
- License or validation data: Resources used for license validation or application authentication
- Proprietary data models: Data files that represent your intellectual property
- Embedded database files: SQLite or other databases embedded in your application
- Custom fonts or media assets: Resources that represent significant development investment
- UI assets: Even simple UI resources can benefit from the compression to reduce application size
Shield intelligently analyzes your resources and automatically applies the optimal protection strategy for each type. It differentiates between critical resources that need encryption and standard resources that benefit from compression, ensuring the right balance for your specific application.
For most applications, Shield automatically enables compression for all resources to reduce application size, while selectively applying encryption to resources containing sensitive information or intellectual property. This smart optimization happens without any manual configuration.
Compatibility
Framework | Compatibility | Comments |
---|---|---|
.NET Core | ✔ | |
.NET Framework | ✔ | |
.NET (up to 8 version) | ✔ | |
.NET Standard | ✔ | |
Xamarin IOS | ✔ | |
Xamarin Android | ✔ | |
Xamarin MacOs | ✔ | |
WPF | ✔ | |
Blazor | ✔ | |
.NET Maui | ✔ | |
Unity | ✔ | |
Avalonia | ✔ | Official Partner |
ASP | ✔ | |
Silverlight | ✔ | |
VBa (Visual Basic) or C# (CSharp) | ✔ | |
WinRT | ✔ |
Shield is compatible with all versions of .NET. It automatically adapts to your specific framework, whether you're using .NET 2.0, .NET 4.7, .NET Core 2.1, or Xamarin.Forms 5.0.