Mobile Considerations
When protecting mobile applications built with .NET MAUI or Xamarin, certain platform-specific considerations must be addressed to ensure optimal security and performance.
Android Protection Considerations
Android applications face specific security challenges due to the platform's open nature and the ease of decompilation.
Android-specific Protections
Shield automatically detects when your application is being built for Android and applies specialized protections:
- APK Content Protection: Protects resources and assets within the APK file
- Dalvik/ART Optimizations: Ensures protection works with Android's runtime environments
- Anti-Rooting Measures: Detects rooted devices and responds according to your configuration
- Native Library Protection: Secures native libraries included in your application
- Anti-Tampering Verification: Ensures the APK hasn't been modified after installation
ProGuard Compatibility
Shield is automatically compatible with ProGuard, working alongside it to provide comprehensive protection for your Android application. No additional configuration is required.
iOS Protection Considerations
iOS applications run in a more controlled environment but still require specialized protection against reverse engineering.
iOS-specific Protections
Shield automatically detects when your application is being built for iOS and applies specialized protections:
- Binary Protection: Secures the compiled application binary
- Jailbreak Detection: Identifies jailbroken devices to prevent tampering
- Objective-C Bridge Protection: Secures the communication between .NET and native iOS code
- Memory Protection: Prevents memory dumping and analysis
- Code Signing Integrity: Ensures the application hasn't been tampered with
Recommended Protections for Mobile Applications
Essential Protections
These protections are highly recommended for mobile applications:
{
"protections": {
"anti_jailbreak": {},
"constants_encryption": {},
"constants_mutation": {},
"rename": {
"rename_public": false,
"rename_arguments": true
}
}
}
The Anti-Jailbreak protection helps prevent your application from running on compromised devices, while Constants Encryption and Mutation ensure sensitive data is properly protected. The Renamer protection helps obfuscate your code while maintaining compatibility with mobile frameworks.
Additional Protections
These protections can be added based on your specific needs:
{
"protections": {
"control_flow_advance": {
"intensity": 6
},
"reference_proxy": {},
"virtualization": {}
}
}
While these additional protections are compatible with mobile environments, consider the following:
- Reference Proxy should be tested thoroughly on target devices
- Virtualization provides strong protection but should be tested thoroughly on target devices
Secure Storage Protection
For securing sensitive data stored on the device, we recommend using Constants Encryption:
{
"protections": {
"constants_encryption": {}
}
}
This ensures that any sensitive constants, including those used for storage, are properly encrypted.
Network Communication Security
For securing network communications, we recommend using Constants Encryption to protect sensitive data:
{
"protections": {
"constants_encryption": {}
}
}
This helps protect sensitive information that might be transmitted over the network.
Testing Mobile Applications
After applying Shield protection to your mobile application:
- Test on a variety of devices with different OS versions
- Verify application startup time and performance
- Test background/foreground transitions
- Verify all platform-specific features
- Test network connectivity scenarios
Always test protected applications on actual devices, not just emulators. Emulators may not accurately reflect the performance and behavior of protected applications on real devices.
Best Practices
- Layer your protection: Combine Shield's protections with platform-specific security measures
- Use anti-tampering: Enable anti-tampering detection for both Android and iOS
- Configure responses: Define appropriate responses to security violations (warning, limiting functionality, or terminating)
- Separate configurations: Use different Shield configurations for debug and release builds
For more information on protecting cross-platform code, see Cross-platform Strategy.